From 04e5fbc6548547d120fefc8717539d6b83d8d62f Mon Sep 17 00:00:00 2001 From: Miodrag Milic Date: Sun, 23 Oct 2016 16:49:30 +0200 Subject: [PATCH] AU command --- README.md | 27 +++++++++++++++++++++++++-- update_all.ps1 | 14 +++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 695bc49..7b5e50d 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,32 @@ In a package directory run: `Test-Package`. ## Automatic package update -Run `/update.ps1` from within the directory of the package to update that package. If this script is missing, the package is not automatic. +### Single package -You can also call AU method `Update-AUPackages` (alias `updateall`) in the repository root. This will just update each package without any other action. +Run from within the directory of the package to update that package: + + cd + ./update.ps1 + +If this script is missing, the package is not automatic. Set `$au_Force = $true` prior to script call to update the package even if no new version is found. + +### Multiple packages + +To update all packages run `./update_all.ps1`. It accepts few options: + + ./update_all.ps1 -Name a* #Update all packages which name start with letter 'a' + ./update_all.ps1 -ForcedPackages 'cpu-z copyq' #Update all packages and force cpu-z and copyq + ./update_all.ps1 -ForcedPackages 'copyq:1.2.3' #Update all packages but force copyq and use explicit version + ./update_all.ps1 -Root 'c:\packages' #Update all packages in the c:\packages folder + +The following global variables influence the execution of `update_all.ps1` script if set prior to the call: + + $au_NoPlugins = $true #Do not execute plugins + $au_Push = $false #Do not push to chocolatey + +You can also call AU method `Update-AUPackages` (alias `updateall`) in the repository root. This will just update each package without any other action. For example to force update of all packages with a single command execute: + + updateall -Options ([ordered]@{ Force = $true }) ## Start using AU with your own packages diff --git a/update_all.ps1 b/update_all.ps1 index 05f11d9..8022536 100644 --- a/update_all.ps1 +++ b/update_all.ps1 @@ -22,9 +22,9 @@ $Options = [ordered]@{ } Gist = @{ - Id = $Env:gist_id #Your gist id or leave empty for anonymous - ApiKey = $Env:github_api_key #Your github api key - Path = "$PSScriptRoot\Update-AUPackages.md" #List of files to add to gist + Id = $Env:gist_id #Your gist id; leave empty for new private or anonymous gist + ApiKey = $Env:github_api_key #Your github api key - if empty anoymous gist is created + Path = "$PSScriptRoot\Update-AUPackages.md" #List of files to add to the gist } #Git = @{ @@ -54,11 +54,15 @@ $Options = [ordered]@{ ForcedPackages = $ForcedPackages -split ' ' BeforeEach = { param($PackageName, $Options ) - if ($Options.ForcedPackages -contains $PackageName) { $global:au_Force = $true } + $p = $Options.ForcedPackages | ? { $_ -match "^${PackageName}(?:\:(.+))$" } + if (!$p) { return } + + $global:au_Force = $true + $global:au_Version = ($p -split ':')[1] } } -if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" } +if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" } $global:au_Root = $Root #Path to the AU packages $info = updateall -Name $Name -Options $Options