The honey flavoured psake task automation tool
Open up a command line and enter the following command:
powershell -noprofile -executionpolicy unrestricted -command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/kristofferahl/Koshu/master/install.ps1'))"
This will create a file called koshu.ps1 in the current directory. This file enables you to invoke tasks as well as do scaffolding of task files and plugins.
Note nuget must be in your path or located in a subdirectory of the current directory.
In powershell, enter the path to the koshu.ps1 file and invoke it with the switch -load.
<directoryPath>\koshu.ps1 -load
Scaffolding a taskfile is as easy as calling Koshu-Scaffold passing a single parameter (-template)
Koshu-Scaffold -template <templateName>
There are currently 2 templates to choose from. build
and empty
.
.\koshu [<tasks>] [<taskFile>]
.\koshu
.\koshu compile
.\koshu -taskfile build.ps1
.\koshu compile build.ps1
powershell .\koshu [<tasks>] [<taskFile>]
powershell .\koshu
powershell .\koshu compile
powershell .\koshu -taskfile build.ps1
powershell .\koshu compile build.ps1
powershell ./koshu [<tasks>] [<taskFile>]
powershell ./koshu
powershell ./koshu compile
powershell ./koshu -taskfile build.ps1
powershell ./koshu compile build.ps1
Simply double click .cmd to run
koshu
koshu compile
koshu compile build.ps1
Koshu can easily be extended through plugin packages. Plugin packages is simply a neat way for you to package up reusable powershell scripts and modules.
A plugin is usually a nuget package containing a powershell module that you want to import and use when running tasks. Packages can also be defined as git repositories or directories on a file share. You can read more on how to create a plugin here: https://github.com/kristofferahl/Koshu.PluginTemplate
Simply add a packages section at the top of your task file and specify the plugins you want to use.
packages @{
"NugetPackageId"=""
}
Some plugin packages supports the Koshu configuration model. It will give you a chance to change default values before running tasks.
config @{
"PackageName"=@{}
}
Have a look at the plugins homepage to find out what configuration options that are available.
packages @{
# Unspecified version
"NugetPackageId"=""
# Specific version
"NugetPackageId"=""
}
packages @{
"PluginName"="git+file:///C/SomeDirectory/KoshuPluginRepository"
"PluginName"="git+file:///C/SomeDirectory/KoshuPluginRepository#branch"
"PluginName"="git+file:///C/SomeDirectory/KoshuPluginRepository#tag"
"PluginName"="git+file:///C/SomeDirectory/KoshuPluginRepository#sha"
"PluginName"="git+https://github.com/username/koshu-plugin.git"
"PluginName"="git+https://github.com/username/koshu-plugin.git#branch"
"PluginName"="git+https://github.com/username/koshu-plugin.git#tag"
"PluginName"="git+https://github.com/username/koshu-plugin.git#sha"
}
packages @{
"PluginName"="dir+C:\SomeDirectory" # Looks for a plugin at C:\SomeDirectory\PluginName
}
https://www.nuget.org/packages?q=Tags%3A%22koshu%22
Before you can call pack_solution you need to make sure that the project (csproj) file you want to pack has imported the Microsoft.WebApplication.targets file. Next you add a Publish task that depends on PipelinePreDeployCopyAllFilesToOneFolder.
<Target Name="Publish" DependsOnTargets="PipelinePreDeployCopyAllFilesToOneFolder" />