-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
epanipinto-jc
committed
Aug 18, 2020
1 parent
b350ad3
commit 41dcbe4
Showing
10 changed files
with
175 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,68 @@ | ||
. ($PSScriptRoot + '/' + 'Get-Config.ps1') | ||
########################################################################### | ||
ForEach ($RequiredModule In $RequiredModules) | ||
# Install NuGet | ||
If (!(Get-PackageProvider -Name:('NuGet') -ListAvailable -ErrorAction:('SilentlyContinue'))) | ||
{ | ||
Write-Host("Setting up dependency '$RequiredModule'") | ||
Write-Host ('[status]Installing package provider NuGet'); | ||
Install-PackageProvider -Name:('NuGet') -Scope:('CurrentUser') -Force | ||
} | ||
# Install dependent modules | ||
$DependentModules = @('PSScriptAnalyzer', 'PlatyPS') | ||
ForEach ($DependentModule In $DependentModules) | ||
{ | ||
Write-Host("[status]Setting up dependency '$DependentModule'") | ||
# Check to see if the module is installed | ||
If ([System.String]::IsNullOrEmpty((Get-InstalledModule).Where( { $_.Name -eq $DependentModule }))) | ||
{ | ||
Write-Host("[status]Installing '$DependentModule' from 'PSGallery'") | ||
Install-Module -Repository:('PSGallery') -Force -Name:($DependentModule) -Scope:('CurrentUser') | ||
} | ||
# Get-Module -Refresh -ListAvailable | ||
If ([System.String]::IsNullOrEmpty((Get-Module).Where( { $_.Name -eq $DependentModule }))) | ||
{ | ||
Write-Host("[status]Importing '$DependentModule'") | ||
Import-Module -Name:($DependentModule) -Force | ||
} | ||
} | ||
# Register PSRepository | ||
$Password = $SYSTEM_ACCESSTOKEN | ConvertTo-SecureString -AsPlainText -Force | ||
$Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $SYSTEM_ACCESSTOKEN, $Password | ||
If (-not (Get-PackageSource -Name:('JumpCloudPowershell-Dev') -ErrorAction SilentlyContinue)) | ||
{ | ||
Write-Host("[status]Register-PackageSource 'JumpCloudPowershell-Dev'") | ||
Register-PackageSource -Trusted -ProviderName:("PowerShellGet") -Name:('JumpCloudPowershell-Dev') -Location:("https://pkgs.dev.azure.com/JumpCloudPowershell/_packaging/Dev/nuget/v2/") -Credential:($Credentials) | ||
} | ||
# Install required modules | ||
ForEach ($RequiredModule In $Psd1.RequiredModules) | ||
{ | ||
Write-Host("[status]Setting up dependency '$RequiredModule'") | ||
# Check to see if the module is installed | ||
If ([System.String]::IsNullOrEmpty((Get-InstalledModule).Where( { $_.Name -eq $RequiredModule }))) | ||
{ | ||
Write-Host("Installing '$RequiredModule'") | ||
Install-Module -Name:($RequiredModule) -Force | ||
Write-Host("[status]Installing '$RequiredModule' from 'JumpCloudPowershell-Dev'") | ||
Install-Module -Repository:('JumpCloudPowershell-Dev') -AllowPrerelease -Force -Name:($RequiredModule) -Credential:($Credentials) -Scope:('CurrentUser') | ||
} | ||
# Get-Module -Refresh -ListAvailable | ||
If ([System.String]::IsNullOrEmpty((Get-Module).Where( { $_.Name -eq $RequiredModule }))) | ||
{ | ||
Write-Host("Importing '$RequiredModule'") | ||
Write-Host("[status]Importing '$RequiredModule'") | ||
Import-Module -Name:($RequiredModule) -Force | ||
} | ||
} | ||
# Load current module | ||
If ([System.String]::IsNullOrEmpty((Get-Module).Where( { $_.Name -eq $ModuleName }))) | ||
{ | ||
Write-Host("[status]Importing '$ModuleName'") | ||
Import-Module ($FilePath_psd1) -Force | ||
} | ||
# Load "Deploy" functions | ||
$DeployFunctions = @(Get-ChildItem -Path:($PSScriptRoot + '/Functions/*.ps1') -Recurse) | ||
Foreach ($DeployFunction In $DeployFunctions) | ||
{ | ||
Try | ||
{ | ||
. $DeployFunction.FullName | ||
} | ||
Catch | ||
{ | ||
Write-Error -Message:('Failed to import function: ' + $DeployFunction.FullName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.