-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: relocate bootstrap modules (#105)
# Pull Request ## Issue Issue #, if available: N/A ## Description This PR is a significant refactor to de-couple bootstrap and starter modules. It moves to a configuration based approach for shared inputs and have many other enhancements to the user experience. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
- Loading branch information
1 parent
41a7a16
commit 6728899
Showing
29 changed files
with
1,128 additions
and
607 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
72 changes: 72 additions & 0 deletions
72
src/ALZ/Private/Convert-InterfaceInputToUserInputConfig.ps1
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
function Convert-InterfaceInputToUserInputConfig { | ||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
param ( | ||
[Parameter(Mandatory = $false)] | ||
[PSCustomObject]$inputConfig, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[PSCustomObject]$validators, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[PSCustomObject]$appendToObject = $null | ||
) | ||
|
||
if ($PSCmdlet.ShouldProcess("Parse Interface Variables into Config", "modify")) { | ||
|
||
$starterModuleConfiguration = [PSCustomObject]@{} | ||
if($appendToObject -ne $null) { | ||
$starterModuleConfiguration = $appendToObject | ||
} | ||
|
||
Write-Verbose $validators | ||
|
||
foreach($variable in $inputConfig.inputs.PSObject.Properties) { | ||
Write-Verbose "Parsing variable $($variable.Name)" | ||
$description = $variable.Value.description | ||
|
||
$order = 0 | ||
if($variable.PSObject.Properties.Name -contains "display_order") { | ||
$order = $variable.Value.display_order | ||
} | ||
|
||
$inputType = $variable.Value.source -eq "input" ? "UserInput" : "ComputedInput" | ||
$dataType = $variable.Value.type | ||
|
||
$sensitive = $false | ||
if($variable.Value.PSObject.Properties.Name -contains "sensitive") { | ||
$sensitive = $variable.Value.sensitive | ||
} | ||
|
||
$starterModuleConfigurationInstance = [PSCustomObject]@{} | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Order" -NotePropertyValue $order | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Type" -NotePropertyValue $inputType | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Value" -NotePropertyValue "" | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "DataType" -NotePropertyValue $dataType | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Sensitive" -NotePropertyValue $sensitive | ||
|
||
if($variable.Value.PSObject.Properties.Name -contains "default") { | ||
$defaultValue = $variable.Value.default | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $defaultValue | ||
} | ||
|
||
if($variable.Value.PSObject.Properties.Name -contains "validation") { | ||
$validationType = $variable.Value.validation | ||
$validator = $validators.PSObject.Properties[$validationType].Value | ||
$description = "$description ($($validator.Description))" | ||
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)" | ||
if($validator.Type -eq "AllowedValues"){ | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues | ||
} | ||
if($validator.Type -eq "Valid"){ | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid | ||
} | ||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType | ||
} | ||
|
||
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Description" -NotePropertyValue $description | ||
$starterModuleConfiguration | Add-Member -NotePropertyName $variable.Name -NotePropertyValue $starterModuleConfigurationInstance | ||
} | ||
} | ||
|
||
return $starterModuleConfiguration | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function Get-ExistingLocalRelease { | ||
param( | ||
[Parameter(Mandatory = $false)] | ||
[string] $targetDirectory, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string] $targetFolder | ||
) | ||
|
||
$releaseTag = "" | ||
$path = "" | ||
$checkPath = Join-Path $targetDirectory $targetFolder | ||
$checkFolders = Get-ChildItem -Path $checkPath -Directory | ||
if($null -ne $checkFolders) { | ||
$checkFolders = $checkFolders | Sort-Object { $_.Name } -Descending | ||
$mostRecentCheckFolder = $checkFolders[0] | ||
|
||
$releaseTag = $mostRecentCheckFolder.Name | ||
$path = $mostRecentCheckFolder.FullName | ||
} else { | ||
Write-InformationColored "You have passed the skipInternetChecks parameter, but there is no existing version in the $targetFolder module, so we can't continue." | ||
throw | ||
} | ||
|
||
return @{ | ||
releaseTag = $releaseTag | ||
path = $path | ||
} | ||
} |
Oops, something went wrong.