Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shaynevanasperen committed Feb 19, 2015
0 parents commit 44008c6
Show file tree
Hide file tree
Showing 47 changed files with 1,440 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -text
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Oo]bj
[Bb]in
[Dd]ebug*
*.user
*.suo
*.DS_Store
[Tt]humbs.db
NuGet.exe
[Pp]ackages/
builds/
readme.txt
4 changes: 4 additions & 0 deletions .nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Invoke-Build" version="2.9.13" />
</packages>
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Shayne van Asperen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

33 changes: 33 additions & 0 deletions PowerTasks.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7CD7DDC9-4300-4915-99F4-AA50B81C12CF}"
ProjectSection(SolutionItems) = preProject
.nuget\packages.config = .nuget\packages.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notice", "notice", "{1EA83ECC-202E-427C-96F3-6E327228198D}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerTasks", "PowerTasks\PowerTasks.csproj", "{0451BAEF-DF2E-4B98-8644-94EE9415E389}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0451BAEF-DF2E-4B98-8644-94EE9415E389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0451BAEF-DF2E-4B98-8644-94EE9415E389}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0451BAEF-DF2E-4B98-8644-94EE9415E389}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0451BAEF-DF2E-4B98-8644-94EE9415E389}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions PowerTasks/.Tasks.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
param(
$buildsPath = (property buildsPath $basePath\builds),
$prereleaseVersion = (property prereleaseVersion "beta-1")
)

. .\.Tasks\Clean.ps1
. .\.Tasks\Version.ps1
. .\.Tasks\Push.ps1

task CopyReadme {
Get-Content $basePath\README.md | Set-Content README.txt
}

task Pack Clean, Version, CopyReadme, {
New-Item $buildsPath -Type directory -Force | Out-Null
$packageVersion = $version | Resolve-PackageVersion $prereleaseVersion
exec { & NuGet pack $basePath\$projectName\$projectName.nuspec -OutputDirectory $buildsPath -Properties Version=$packageVersion -NoPackageAnalysis }
Get-ChildItem $basePath\$projectName\.Tasks\*.nuspec -Recurse | %{ exec { & NuGet pack $_.FullName -OutputDirectory $buildsPath -NoPackageAnalysis } }
}

task . Pack
27 changes: 27 additions & 0 deletions PowerTasks/.Tasks/Clean.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>PowerTasks.Plugins.Clean</id>
<version>1.0.0-beta-1</version>
<authors>Shayne van Asperen, Kenneth Truyers</authors>
<owners>Shayne van Asperen</owners>
<licenseUrl>https://github.com/shaynevanasperen/PowerTasks/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/shaynevanasperen/PowerTasks</projectUrl>
<iconUrl>C:\DEV\Shayne\PowerTasks\pt32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>A PowerTasks plugin providing a "Clean" task</summary>
<description>Clean</description>
<language>en-US</language>
<tags>powershell, invoke, build, tasks, plugin, clean</tags>
<developmentDependency>true</developmentDependency>
<dependencies>
<dependency id="PowerTasks" version="1.0.0-beta-1" />
</dependencies>
</metadata>
<files>
<file src="nuspec\DUMMY.txt" target="lib" />
<file src="nuspec\install.ps1" target="tools" />
<file src="nuspec\uninstall.ps1" target="tools" />
<file src="Clean.ps1" target="scripts" />
</files>
</package>
12 changes: 12 additions & 0 deletions PowerTasks/.Tasks/Clean.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$script:buildsPath = (property buildsPath $basePath\builds)

task Clean {
if (Test-Path $buildsPath) {
"Cleaning builds folder"
Remove-Item $buildsPath\* -Recurse
}
"Cleaning bin folders"
Remove-Directory "$basePath\*\bin"
"Cleaning obj folders"
Remove-Directory "$basePath\*\obj"
}
27 changes: 27 additions & 0 deletions PowerTasks/.Tasks/Compile.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>PowerTasks.Plugins.Compile</id>
<version>1.0.0-beta-1</version>
<authors>Shayne van Asperen, Kenneth Truyers</authors>
<owners>Shayne van Asperen</owners>
<licenseUrl>https://github.com/shaynevanasperen/PowerTasks/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/shaynevanasperen/PowerTasks</projectUrl>
<iconUrl>C:\DEV\Shayne\PowerTasks\pt32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>A PowerTasks plugin providing a "Compile" task</summary>
<description>Compile</description>
<language>en-US</language>
<tags>powershell, invoke, build, tasks, plugin, clean</tags>
<developmentDependency>true</developmentDependency>
<dependencies>
<dependency id="PowerTasks" version="1.0.0-beta-1" />
</dependencies>
</metadata>
<files>
<file src="nuspec\DUMMY.txt" target="lib" />
<file src="nuspec\install.ps1" target="tools" />
<file src="nuspec\uninstall.ps1" target="tools" />
<file src="Compile.ps1" target="scripts" />
</files>
</package>
76 changes: 76 additions & 0 deletions PowerTasks/.Tasks/Compile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
$script:buildsPath = (property buildsPath $basePath\builds)
$script:config = (property config "Release")
$script:outputPath = (property outputPath (Get-OutputPath $basePath $buildsPath $projectName))
$script:azureTargetProfile = (property azureTargetProfile "")

$script:projectTests = @(Get-TestProjectsFromSolution $basePath\$projectName.sln $basePath)

task Compile Clean, Version, {
use 12.0 MSBuild
Convert-Project $config $basePath $projectName $outputPath $azureTargetProfile
$ilMerge = Get-PackageInfo ILMerge $basePath\$projectName
if ($ilMerge.Exists) {
Merge-Application "$($ilMerge.Path)" $outputPath $projectName
}
Convert-ProjectTests $config $basePath $projectName $projectTests
}

function script:Convert-Project($config, $basePath, $projectName, $outputPath, $azureTargetProfile) {
$projectFile = Get-ProjectFile $basePath $projectName
$isCloudProject = $projectFile.EndsWith("ccproj")
$isWebProject = (((Select-String -pattern "<UseIISExpress>.+</UseIISExpress>" -path $projectFile) -ne $null) -and ((Select-String -pattern "<OutputType>WinExe</OutputType>" -path $projectFile) -eq $null))
$isWinProject = (((Select-String -pattern "<UseIISExpress>.+</UseIISExpress>" -path $projectFile) -eq $null) -and ((Select-String -pattern "<OutputType>WinExe</OutputType>" -path $projectFile) -ne $null))
$isExeProject = (((Select-String -pattern "<UseIISExpress>.+</UseIISExpress>" -path $projectFile) -eq $null) -and ((Select-String -pattern "<OutputType>Exe</OutputType>" -path $projectFile) -ne $null))

$projectName = Get-ProjectName $projectFile
if ($isCloudProject) {
Write-Host "Compiling $projectName to $outputPath"
exec { MSBuild $projectFile /p:Configuration=$config /nologo /p:DebugType=None /p:Platform=AnyCpu /t:publish /p:OutputPath=$outputPath\ /p:TargetProfile=$azureTargetProfile /verbosity:quiet }
}
elseif ($isWebProject) {
Write-Host "Compiling $projectName to $outputPath"
exec { MSBuild $projectFile /p:Configuration=$config /nologo /p:DebugType=None /p:Platform=AnyCpu /p:WebProjectOutputDir=$outputPath /p:OutDir=$outputPath\bin /verbosity:quiet }
}
elseif ($isWinProject -or $isExeProject) {
Write-Host "Compiling $projectName to $outputPath"
exec { MSBuild $projectFile /p:Configuration=$config /nologo /p:DebugType=None /p:Platform=AnyCpu /p:OutDir=$outputPath /verbosity:quiet }
}
elseif (!$projectName.EndsWith("Tests")) {
Write-Host "Compiling $projectName"
exec { MSBuild $projectFile /p:Configuration=$config /nologo /p:Platform=AnyCpu /verbosity:quiet }
}
}

function script:Convert-ProjectTests($config, $basePath, $projectName, $projectTests) {
if ($projectTests.Length -gt 0) {
foreach ($projectTest in $projectTests) {
"Compiling $($projectTest.Name)"
$projectFile = "$basePath\$($projectTest.Path)\$($projectTest.File)"
if (Test-Path $projectFile) {
if(@($projectTest.Types | ?{ $_.Name -eq "SpecFlow" }).Length -gt 0) {
@(Get-SolutionConfigurations $basePath\$projectName.sln) | Where { (Get-IsLocalTest $_ $basePath\$($projectTest.Path)) -ne $true } | foreach {
exec { MSBuild $projectFile /p:Configuration=$_ /nologo /verbosity:quiet }
}
}
else {
exec { MSBuild $projectFile /p:Configuration=$config /nologo /verbosity:quiet }
}
}
}
}
}

function script:Merge-Application($ilMergePath, $outputPath, $projectName) {
Write-Host "Merging application executables and assemblies"
$exeNames = Get-ChildItem -Path "$outputPath\*" -Filter *.exe | ForEach-Object { """" + $_.FullName + """" }
$assemblyNames = Get-ChildItem -Path "$outputPath\*" -Filter *.dll | ForEach-Object { """" + $_.FullName + """" }

$assemblyNamesArgument = [System.String]::Join(" ", $assemblyNames)
$exeNamesArgument = [System.String]::Join(" ", $exeNames)

$appFileName = "$outputPath\$projectName.exe"

Invoke-Expression "$ilMergePath\tools\ILMerge.exe /t:exe /targetPlatform:""v4"" /out:$appFileName $exeNamesArgument $assemblyNamesArgument"

Get-ChildItem -Path "$outputPath\*" -Exclude *.exe,*.config | foreach { $_.Delete() }
}
25 changes: 25 additions & 0 deletions PowerTasks/.Tasks/Create7zip.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>PowerTasks.Plugins.Create7zip</id>
<version>1.0.0-beta-1</version>
<authors>Shayne van Asperen, Kenneth Truyers</authors>
<owners>Shayne van Asperen</owners>
<licenseUrl>https://github.com/shaynevanasperen/PowerTasks/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/shaynevanasperen/PowerTasks</projectUrl>
<iconUrl>C:\DEV\Shayne\PowerTasks\pt32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>A PowerTasks plugin providing a "Create7zip" task</summary>
<description>Create7zip</description>
<language>en-US</language>
<tags>powershell, invoke, build, tasks, plugin, clean</tags>
<developmentDependency>true</developmentDependency>
<dependencies>
<dependency id="PowerTasks" version="1.0.0-beta-1" />
</dependencies>
</metadata>
<files>
<file src="nuspec\DUMMY.txt" target="lib" />
<file src="Create7zip.ps1" target="scripts" />
</files>
</package>
11 changes: 11 additions & 0 deletions PowerTasks/.Tasks/Create7zip.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$script:buildsPath = (property buildsPath $basePath\builds)
$script:outputPath = (property outputPath (Get-OutputPath $basePath $buildsPath $projectName))

task Create7zip {
"7-Zipping files in $outputPath"

$7zipPath = Get-RequiredPackagePath "7-Zip.CommandLine" $basePath\.nuget
$outputFile = "$outputPath.7z"
$include = "-ir!$outputPath\*"
exec { & $7zipPath\tools\7za.exe u -t7z $outputFile $include -mx9 }
}
27 changes: 27 additions & 0 deletions PowerTasks/.Tasks/DeployAzure.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>PowerTasks.Plugins.DeployAzure</id>
<version>1.0.0-beta-1</version>
<authors>Shayne van Asperen, Kenneth Truyers</authors>
<owners>Shayne van Asperen</owners>
<licenseUrl>https://github.com/shaynevanasperen/PowerTasks/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/shaynevanasperen/PowerTasks</projectUrl>
<iconUrl>C:\DEV\Shayne\PowerTasks\pt32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>A PowerTasks plugin providing a "DeployAzure" task</summary>
<description>DeployAzure</description>
<language>en-US</language>
<tags>powershell, invoke, build, tasks, plugin, clean</tags>
<developmentDependency>true</developmentDependency>
<dependencies>
<dependency id="PowerTasks" version="1.0.0-beta-1" />
</dependencies>
</metadata>
<files>
<file src="nuspec\DUMMY.txt" target="lib" />
<file src="nuspec\install.ps1" target="tools" />
<file src="nuspec\uninstall.ps1" target="tools" />
<file src="DeployAzure.ps1" target="scripts" />
</files>
</package>
Loading

0 comments on commit 44008c6

Please sign in to comment.