From ba6e4649efe11f29e2507792b6f37533d983ce21 Mon Sep 17 00:00:00 2001 From: Miodrag Milic Date: Tue, 20 Dec 2016 11:25:40 +0100 Subject: [PATCH] added history plugin, test_all and small improvements --- test_all.ps1 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ update_all.ps1 | 15 ++++++++++++--- 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 test_all.ps1 diff --git a/test_all.ps1 b/test_all.ps1 new file mode 100644 index 0000000..d43057e --- /dev/null +++ b/test_all.ps1 @@ -0,0 +1,46 @@ +#Name can be 'random N' to randomly force the Nth group of packages. + +param( [string[]] $Name, [string] $Root = "$PSScriptRoot" ) + +if (Test-Path $PSScriptRoot/update_vars.ps1) { . $PSScriptRoot/update_vars.ps1 } +$global:au_root = Resolve-Path $Root + +if (($Name.Length -gt 0) -and ($Name[0] -match '^random (.+)')) { + [array] $lsau = lsau + + $group = [int]$Matches[1] + $n = (Get-Random -Maximum $group) + Write-Host "TESTING GROUP $($n+1) of $group" + + $group_size = [int]($lsau.Count / $group) + 1 + $Name = $lsau | select -First $group_size -Skip ($group_size*$n) | % { $_.Name } + + Write-Host ($Name -join ' ') + Write-Host ('-'*80) +} + +$options = [ordered]@{ + Force = $true + Push = $false + + Report = @{ + Type = 'markdown' #Report type: markdown or text + Path = "$PSScriptRoot\Update-Force-Test-${n}.md" #Path where to save the report + Params= @{ #Report parameters: + Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner + NoAppVeyor = $false # Markdown: do not show AppVeyor build shield + Title = "Update Force Test - Group ${n}" + UserMessage = "[Update report](https://gist.github.com/$Env:gist_id) | **USING AU NEXT VERSION**" # Markdown, Text: Custom user message to show + } + } + + Gist = @{ + Id = $Env:gist_id_test #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-Force-Test-${n}.md" #List of files to add to the gist + Description = "Update Force Test Report #powershell #chocolatey" + } +} + + +$global:info = updateall -Name $Name -Options $Options diff --git a/update_all.ps1 b/update_all.ps1 index 4d65ba0..71c1571 100644 --- a/update_all.ps1 +++ b/update_all.ps1 @@ -1,6 +1,6 @@ # AU Packages Template: https://github.com/majkinetor/au-packages-template -param([string] $Name, [string] $ForcedPackages, [string] $Root = $PSScriptRoot) +param([string[]] $Name, [string] $ForcedPackages, [string] $Root = $PSScriptRoot) if (Test-Path $PSScriptRoot/update_vars.ps1) { . $PSScriptRoot/update_vars.ps1 } @@ -17,14 +17,23 @@ $Options = [ordered]@{ Params= @{ #Report parameters: Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner NoAppVeyor = $false # Markdown: do not show AppVeyor build shield - UserMessage = '' # Markdown, Text: Custom user message to show + UserMessage = "[History](#update-history)" # Markdown, Text: Custom user message to show + NoIcons = $false # Markdown: don't show icon + IconSize = 32 # Markdown: icon size + Title = '' # Markdown, Text: TItle of the report, by default 'Update-AUPackages' } } + History = @{ + Lines = 30 #Number of lines to show + Github_UserRepo = $Env:github_user_repo #User repo to be link to commits + Path = "$PSScriptRoot\Update-History.md" #Path where to save history + } + 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 + Path = "$PSScriptRoot\Update-AUPackages.md", "$PSScriptRoot\Update-History.md" #List of files to add to the gist } Git = @{