Introducting PowerLine module

Added ExistingModules to packages, for module dependent package manifest
Moved PowerLine styling code to the PowerLine pacakge.
Added Package install code generation to Get-MyModules.
Fixed typo in EnsureJoinString
Fixed: Scoop operations would fail calling internal url function.
This commit is contained in:
Gal 2021-10-29 13:31:24 -04:00
parent c7ec1e8c5d
commit b0ec8e1780
9 changed files with 68 additions and 29 deletions

View file

@ -1,4 +1,4 @@
param([switch]$IgnoreSystem,[switch]$MissingOnly)
param([switch]$IgnoreSystem,[switch]$MissingOnly,[switch]$GenInstallCode)
$local:currentSys = @('Always') + ([SystemName]::_GetValidValues('',$true,$true));
@ -9,6 +9,7 @@ $local:oldPSGet = Get-Module PowerShellGet -ListAvailable -ErrorAction SilentlyC
if( $local:oldPSGet ) {
Write-Warning $(@(
"PowerShellGet is an old version ($($oldPSGet.Version)), the following code should upgrade it"
, "# Set-PSRepository -Name PSGallery -InstallationPolicy Trusted"
, " [Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
, " Install-PackageProvider -Name NuGet -Force"
, " Remove-Module PowerShellGet"
@ -17,6 +18,10 @@ if( $local:oldPSGet ) {
) -join "`n" )
}
if( $GenInstallCode ) {
$MissingOnly = $true
"# Set-PSRepository -Name PSGallery -InstallationPolicy Trusted"
}
[MyConfig]::GetConfigPaths('mymodules',$false) |
ForEach-Object {
$local:modules = $( Get-Content $_ | ConvertFrom-Json );
@ -33,4 +38,8 @@ if( $local:oldPSGet ) {
-not (Get-Module -ListAvailable $_ -ErrorAction stop)
} catch { $true }
)
} | ForEach-Object {
if( -not $GenInstallCode ) { return $_ }
"Write-Host -ForegroundColor Cyan 'Installing $_...';"
"Install-Module $_ -AllowClobber"
}