-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild_Deploy.ps1
53 lines (37 loc) · 2.95 KB
/
Build_Deploy.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
$Scripthome = $PSScriptRoot
$moduleFolder = "$Scripthome/psFilesCli"
$CrescendoBuildersCompletePath = "$Scripthome/CrescendoCommandConfigsComplete"
$CrescendoCommandsPath = "$Scripthome/CrescendoCommandConfigs"
$CrescendoBuildersPath = "$Scripthome/CrescendoBuilders"
$globalFlagsParameters = (Get-Content "$CrescendoBuildersPath/GlobalFlags.json" | ConvertFrom-Json).commands.parameters
$StartAndEndFlagsParameters = (Get-Content "$CrescendoBuildersPath/StartAndEndFlags.json" | ConvertFrom-Json).commands.parameters
$APIPagingParameters = (Get-Content "$CrescendoBuildersPath/APIPaging.json" | ConvertFrom-Json).commands.parameters
$ObjectFormatingParameters = (Get-Content "$CrescendoBuildersPath/ObjectFormating.json" | ConvertFrom-Json).commands.parameters
$FilesCLIChildItem_AutoComplete_string = "[ArgumentCompleter ({" + (Get-Content "$CrescendoBuildersPath/FilesCLIChildItem_AutoComplete.ps1" -raw) + "})]"
$CrescendoBuilderFiles = Get-ChildItem $CrescendoCommandsPath -Recurse -File
new-item -ItemType Directory -Path $CrescendoBuildersCompletePath -ErrorAction SilentlyContinue
Get-ChildItem $CrescendoBuildersCompletePath | Where-Object { $_.FullName -match 'CrescendoCommandConfigsComplete(/|\\)CrescendoComplete_' } | Remove-Item -Force
foreach ($builderfile in $CrescendoBuilderFiles) {
write-host "$($builderfile.fullname)"
$psobjectofCresendoCommandConfig = (Get-Content $builderfile.FullName | ConvertFrom-Json)
$commandConfig = Import-CommandConfiguration $builderfile.FullName
$commandConfig.Parameters += $globalFlagsParameters
$skipObjectFormating=@("Set-FilesCliConfig_Crecendo.json","Reset-FilesCliConfig_Crecendo.json","Get-FilesCliConfig_Crecendo.json")
if ($builderfile.name -notin $skipObjectFormating) { $commandConfig.Parameters += $ObjectFormatingParameters }
if ($psobjectofCresendoCommandConfig.AdditionalCrescendoBuilders -contains "StartAndEndFlags") { $commandConfig.Parameters += $StartAndEndFlagsParameters }
if ($psobjectofCresendoCommandConfig.AdditionalCrescendoBuilders -contains "APIPaging") { $commandConfig.Parameters += $APIPagingParameters }
$commandConfig.parameters | ForEach-Object {
if ($_.AdditionalParameterAttributes) {
$_.AdditionalParameterAttributes = $_.AdditionalParameterAttributes | ForEach-Object {
if ($_ -eq '---CrecendoBuilder-ReplaceWith-FilesCLIChildItem_AutoComplete_string---') {
write-host "replace"
$_.replace("---CrecendoBuilder-ReplaceWith-FilesCLIChildItem_AutoComplete_string---", $FilesCLIChildItem_AutoComplete_string)
} else {
$_
}
}
}
}
Export-CrescendoCommand -command $commandConfig -fileName "$CrescendoBuildersCompletePath/CrescendoComplete_$($builderfile.Name)" -Force
}
Export-CrescendoModule -ConfigurationFile @((Get-ChildItem $CrescendoBuildersCompletePath).fullname) -ModuleName "$moduleFolder/psFilesCli.psm1" -Force