Skip to content

Instantly share code, notes, and snippets.

@logicbomb
Created August 15, 2012 18:30
Show Gist options
  • Select an option

  • Save logicbomb/3362172 to your computer and use it in GitHub Desktop.

Select an option

Save logicbomb/3362172 to your computer and use it in GitHub Desktop.
Example build system task
# the task file (backup-database-task.ps1)
properties {
$config = read-globalconfiguration($path)
$source = $config.Environments[$sourceEnv]
$dest = $config.Environments[$destEnv]
}
task default -depends exportDatabase
task exportDatabase {
write-host "exporting from: " $source.SqlDatabaseName
write-host "to: " $dest.StorageAccountName
}
task ? -Description "Helper to display task info" {
Write-Host "Backs up a Sql Database to BlobStorage"
}
# calling the task
Invoke-psake .\backup-database-task.ps1 -parameters @{ "path"="..\global-configuration.xml"; "sourceEnv"="test"; "destEnv"="commit" }
# output
Executing exportDatabase
exporting from: lemurtesting
to: lemurcommit
Build Succeeded!
----------------------------------------------------------------------
Build Time Report
----------------------------------------------------------------------
Name Duration
---- --------
exportDatabase 00:00:00.1435565
Total: 00:00:00.5048296
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment