Browse Source

sync with au-packages-template

Miodrag Milic 7 years ago
parent
commit
5811f8c101
4 changed files with 36 additions and 34 deletions
  1. 21 24
      .appveyor.yml
  2. 3 3
      README.md
  3. 1 0
      setup/README.md
  4. 11 7
      update_all.ps1

+ 21 - 24
.appveyor.yml

@@ -46,36 +46,33 @@ init:
 install:
 - ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version'
 - ps: $PSVersionTable
+- git --version
 - ps: |
-    $x=$null; $is_branch = ($Env:au_version -ne $null) -and ([version]::TryParse($Env:au_version, [ref]$x) -eq $false)
-    if ($is_branch) {
-        pushd ..
-            git clone -q https://github.com/majkinetor/au.git
-            cd au
-            git fetch
-            git checkout -q $Env:au_version
-            ./build.ps1 -Install -NoChocoPackage
-        popd
-    } else {
-        Install-PackageProvider -Name NuGet -Force
-        Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
-
-        $params = @{ Name = 'au' }
-        if ( $Env:au_version -ne $null ) { $params.MinimumVersion = $Env:au_version }
-        Install-Module @params
-
-        Get-Module au -ListAvailable | select Name, Version
-    }
+    git clone -q https://github.com/majkinetor/au.git $Env:TEMP/au
+    . "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version
 
 build_script:
 - ps: |
-    if ( ($Env:APPVEYOR_REPO_COMMIT_MESSAGE -match '\[AU (.+?)\]') -and
-         ($Env:APPVEYOR_SCHEDULED_BUILD -ne 'true') -and
-         ($Env:APPVEYOR_FORCED_BUILD -ne 'true')
-    ) { $forced = $Matches[1] }
+    if ( ($Env:APPVEYOR_SCHEDULED_BUILD -ne 'true') -and ($Env:APPVEYOR_FORCED_BUILD -ne 'true') ) {
+        switch -regex ($Env:APPVEYOR_REPO_COMMIT_MESSAGE) 
+        {
+            '\[AU (.+?)\]'   { $forced = $Matches[1] }
+
+            '\[PUSH (.+?)\]' {
+                $packages = $Matches[1] -split ' '
+                Write-Host "PUSHING PACKAGES: $packages"
+                foreach ($package in $packages) {
+                    Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package")
+                    $package_dir = ls -recurse | ? { $_.Name -eq "$package.nuspec"} | select -First 1 | % Directory
+                    if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue }
+                    pushd $package_dir; choco pack; Push-Package; popd
+                }
+                return
+            }
+        }
+    }
 
     ./update_all.ps1 -ForcedPackages $forced
-
     7z a au_temp.zip $Env:TEMP\chocolatey\au\*
 
 artifacts:

+ 3 - 3
README.md

@@ -17,7 +17,6 @@ You can choose to use one or both of the different methods currently supported i
 
 ### Folder Structure
 
-* au - The scripts for running Automatic Updater (AU) are here.
 * automatic - where automatic packaging and packages are kept. These are packages that are automatically maintained using either [AU](https://chocolatey.org/packages/au) or [Ketarin](https://chocolatey.org/packages/ketarin)/[ChocolateyPackageUpdater](https://chocolatey.org/packages/chocolateypackageupdater) combo.
 * icons - Where you keep icon files for the packages. This is done to reduce issues when packages themselves move around.
 * ketarin - where ketarin jobs (aka applications or searches) exported as XML are kept. This is done to allow ease of contribution.
@@ -43,6 +42,8 @@ For setting up your own automatic package repository, please see [Automatic Pack
 * PowerShell v4+.
 * The [AU module](https://chocolatey.org/packages/au).
 
+For daily operations check out the AU packages [template README](https://github.com/majkinetor/au-packages-template/blob/master/README.md).
+
 ### Getting started
 
 1. Fork this repository and rename it to `chocolatey-packages` (on GitHub - go into Settings, Repository name and rename).
@@ -62,7 +63,6 @@ So for best visibility, enjoying the ease of using AppVeyor, and for a nice repo
 You want to bring in all of your packages into the proper folders. We suggest using some sort of diffing tool to look at the differences between your current solution and this solution and then making adjustments to it. Pay special attention to the setup folder.
 
 1. Bring over the following files to your package source repository:
- * `au\*.*`
  * `automatic\README.md`
  * `icons\README.md`
  * `ketarin\README.md`
@@ -70,7 +70,7 @@ You want to bring in all of your packages into the proper folders. We suggest us
  * `manual\README.md`
  * `ops\*.*`
  * `setup\*.*`
- * `appveyor.yml`
+ * `.appveyor.yml`
 1. Inspect the following file and add the differences:
  * `.gitignore`
 

+ 1 - 0
setup/README.md

@@ -16,3 +16,4 @@
 * Run `au_setup.ps1`.
 * Configure AU [plugins](https://github.com/majkinetor/au/wiki/Plugins).
 * Configure [AppVeyor](https://github.com/majkinetor/au/wiki/AppVeyor).
+* Configure [local run](https://github.com/majkinetor/au/wiki#local-run).

+ 11 - 7
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,13 +54,17 @@ $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
+$global:info = updateall -Name $Name -Options $Options
 
 #Uncomment to fail the build on AppVeyor on any package error
-#if ($info.error_count.total) { throw 'Errors during update' }
+#if ($global:info.error_count.total) { throw 'Errors during update' }