The honey flavoured psake task automation tool
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
Source
.editorconfig
.gitignore
.version
bump-version.ps1
install.ps1
license
pester.ps1
readme.md
release.ps1

readme.md

Koshu

The honey flavoured psake task automation tool

Build status Gitter

Installing Koshu

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.

Initializing Koshu

In powershell, enter the path to the koshu.ps1 file and invoke it with the switch -load.

<directoryPath>\koshu.ps1 -load

Scaffolding a taskfile

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.

Running Koshu

Powershell

.\koshu [<tasks>] [<taskFile>]

Powershell examples

.\koshu
.\koshu compile
.\koshu -taskfile build.ps1
.\koshu compile build.ps1

Command line

powershell .\koshu [<tasks>] [<taskFile>]

Command line examples

powershell .\koshu
powershell .\koshu compile
powershell .\koshu -taskfile build.ps1
powershell .\koshu compile build.ps1

Bash

powershell ./koshu [<tasks>] [<taskFile>]

Bash examples

powershell ./koshu
powershell ./koshu compile
powershell ./koshu -taskfile build.ps1
powershell ./koshu compile build.ps1

Using koshu.cmd or .cmd

From explorer

Simply double click .cmd to run

From command line

koshu
koshu compile
koshu compile build.ps1

Plugins

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

Using plugin packages

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.

NuGet package plugins

packages @{
	# Unspecified version
    "NugetPackageId"=""

    # Specific version
    "NugetPackageId"=""
}

Git repository plugins

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"
}

Directory plugins

packages @{
	"PluginName"="dir+C:\SomeDirectory" # Looks for a plugin at C:\SomeDirectory\PluginName
}

Plugins on Nuget

https://www.nuget.org/packages?q=Tags%3A%22koshu%22

Pack task

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" />