From 455bb662a4e65d615d420bf3d31b5a660b6bfce9 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 23 Oct 2017 10:22:11 +0200 Subject: [PATCH] installation of dependencies moved to ps function --- appveyor.yml | 9 +-------- tools/AppVeyor.psm1 | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7223d82..88d3d95 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,15 +14,8 @@ image: Visual Studio 2017 # Install pester module and init the Appveyor support. install: - - ps: Install-PackageProvider -Name NuGet -MinimumVersion '2.8.5.201' -Force -Verbose - - ps: Import-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force - - ps: Install-Module -Name 'Pester' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber - - ps: Update-Module 'Pester' - - ps: Install-Module -Name 'posh-git' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber - - ps: Update-Module 'posh-git' - - ps: Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber - - ps: Import-Module 'PSCoverage' - ps: Import-Module .\tools\AppVeyor.psm1 + - ps: Invoke-InstallDependencies environment: NuGetToken: diff --git a/tools/AppVeyor.psm1 b/tools/AppVeyor.psm1 index cd63f10..de78763 100644 --- a/tools/AppVeyor.psm1 +++ b/tools/AppVeyor.psm1 @@ -9,6 +9,32 @@ $CALLSIGN = 'PSCredentialStore' Write-Host ("Callsign is: {0}" -f $CALLSIGN) -ForegroundColor Yellow + +Function Invoke-InstallDependencies() { + [CmdletBinding()] + Param() + + Process { + Try { + Install-PackageProvider -Name NuGet -RequiredVersion '2.8.5.208' -Force -Verbose + Import-PackageProvider -Name NuGet -RequiredVersion '2.8.5.208' -Force + Install-Module -Name 'Pester' -Scope CurrentUser -RequiredVersion '4.0.8' -Force -SkipPublisherCheck -AllowClobber + Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '0.7.1' -Force -SkipPublisherCheck -AllowClobber + Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber + Import-Module -Name 'Pester', 'posh-git', 'PSCoverage' + } + Catch { + $MsgParams = @{ + Message = 'Could not install the required dependencies!' + Category = 'Error' + Details = $_.Exception.Message + } + Add-AppveyorMessage @MsgParams + Throw $MsgParams.Message + } + + } +} Function Invoke-AppVeyorBumpVersion() { [CmdletBinding()] Param()