Parcel
Parcel copied to clipboard
Script "repo" and tags
Here are some ideas
Well, sometimes its not there, on any repo, and sometimes its more then 1 dep you want to handle as unit.. Not sure if pre/post/when can fit into this semantics...
Here is example from my personal project (never published it...). See those where Repo is script.
packages.ps1
<# Notes
- Packages are installed via Install-Dependencies. See its help page for details.
- SqlServer2016 installation requires project environment loaded into global $Environment variable.
#>
[ordered]@{
"invoke-build" = @{ Repository = 'Chocolatey'; Tags = 'build test'; Version = '5.4.1' }
"dotnetcore-sdk" = @{ Repository = 'Chocolatey'; Tags = 'build'; Version = '2.1.301' }
"dotnetcore" = @{ Repository = 'Chocolatey'; Tags = 'runtime'; Version = '2.1.1' }
"papercut" = @{ Repository = 'Chocolatey'; Tags = 'test' }
"pester" = @{ Repository = 'PSGallery'; Tags = 'test'; Version = '4.4.2'; Options = @{ Force = $true; SkipPublisherCheck = $true } }
"IIS" = @{
Repository = 'Windows'
Name = 'Web-WebServer'
Tags = 'runtime_iis'
Options = @{ IncludeAllSubFeature = $true; IncludeManagementTools = $true }
}
"dotnetcore-windowshosting" = @{ Repository = 'Chocolatey'; Tags = 'runtime_iis' }
"SqlServer2016" = @{
Repository = 'Script'
Tags = 'db-local'
Script = "https://github.com/majkinetor/Install-SqlServer/blob/master/Install-SqlServer.ps1"
Options = @{
Features = 'SQLEngine'
IsoPath = $Environment.db.SqlServer.ISOPath
ShareCredential = $Environment.db.OS.Users.Deploy_Credential
SaPassword = $Environment.db.SqlServer.Users.Admin | Select -Index 1
}
Test = { (Get-Service mssql* -ea 0) -ne $null }
}
"Invoke-Sqlcmd" = @{
Repository = 'Script'
Tags = 'db-remote', 'test'
Script = { cinst -y sql2014.clrtypes sql2014.smo sql2014-powershell }
Test = {
(ls "${Env:ProgramFiles(x86)}\Microsoft SQL Server" -Include SQLPS.psd1 -Recurse -ea 0) -ne $null -or
(ls "${Env:ProgramFiles}\Microsoft SQL Server" -Include SQLPS.psd1 -Recurse -ea 0) -ne $null
}
}
}
Tags are also interesting concept.
It allows me to keep everything 3rd party in single hashtable and cherry pick what I need in specific context based on tags:
Install-Dependencies -Tags build, test # install all matching 'build' or 'test'
Install-Dependencies -Tags { (build -and runtime) -or test } # complex tag expression
This allows me to do some funky stuff in invoke build
task build {
Install-Dependencies -tags build #install dotnet core sdk & friends
# do build stuff...
}
task test {
Install-Dependencies -tags runtime, test, db-local #install dotnet core runtime, pester, db
}
This means I can give the same build file to bunch of teams, and they get installed just what they need for their particular domain.