public/Sync-Chocolatey.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
function Sync-Chocolatey () { Param( [Parameter(Position = 0, ValueFromPipeline = $true)] [String] $Uri, [Pscredential] $Credential ) if($Uri -and $Uri.StartsWith(".")) { $Uri = (Resolve-Path $URi).Path } Write-Banner $Config = Read-ChocolateyUpdateConfig -Uri $Uri if($Config) { $cfg = $Config; if($config.Chocolatey) { $cfg = $Config.Chocolatey Install-Chocolatey -Config $cfg Update-ChocolateySources -Config $cfg Update-ChocolateyPackages -Config $cfg } if($Config.boxstarter -and $Config.boxstarter.packages) { $cfg = $Config.Chocolatey if(!$cfg) { $cfg = [PSCustomObject]{} Install-Chocolatey $cfg } Install-BoxStarter Import-Module "$Env:ProgramData\Boxstarter\Boxstarter.Chocolatey" $feeds = $Config.boxstarter.feeds; $packages = $Config.boxstarter.packages; if($feeds -and $feeds -is [Array] -and !($feeds -is [String])) { $feeds = [String]::Join(";", $Config.boxstarter.feeds) Set-BoxstarterConfig -NugetSources $feeds } if($packages -is [Array] -and !($packages -is [String])) { $packages = $packages[0]; } #TODO: support multiple packages if($Credential) { Install-BoxStarterPackage -PackageName $packages -Credential $Credential } else { Install-BoxStarterPackage -PackageName $packages } } } } |