Minor tweaks for windows env
This commit is contained in:
parent
1c4e9feb1f
commit
c5311de65a
|
@ -452,7 +452,7 @@ function _Init {
|
|||
}
|
||||
|
||||
$_profiles | Foreach-Object {
|
||||
$local:p = Invoke-Expression "`$profile.$_"
|
||||
$local:p = $profile."$_"
|
||||
if( -not $p ) { $p = $_ }
|
||||
$local:profileContent = $randomSeed;
|
||||
$local:exists = Test-Path $p
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
param([switch]$IgnoreSystem,[switch]$MissingOnly,[switch]$GenInstallCode)
|
||||
param(
|
||||
[switch]$IgnoreSystem,
|
||||
[switch]$MissingOnly,
|
||||
[switch]$GenInstallCode,
|
||||
[switch]$UserScope
|
||||
)
|
||||
|
||||
$local:scopeStr = ""
|
||||
if( $UserScope ) { $scopeStr = " -Scope CurrentUser" }
|
||||
$local:currentSys = @('Always') + ([SystemName]::_GetValidValues('',$true,$true));
|
||||
|
||||
$local:oldPSGet = Get-Module PowerShellGet -ListAvailable -ErrorAction SilentlyContinue |
|
||||
|
@ -11,9 +18,9 @@ if( $local:oldPSGet ) {
|
|||
"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"
|
||||
, " Install-PackageProvider -Name NuGet -Force${scopeStr}"
|
||||
, " Remove-Module PowerShellGet"
|
||||
, " Install-Module -Name PowerShellGet -Force"
|
||||
, " Install-Module -Name PowerShellGet -Force${scopeStr}"
|
||||
, " Update-Module -Name PowerShellGet"
|
||||
) -join "`n" )
|
||||
}
|
||||
|
@ -41,5 +48,8 @@ if( $GenInstallCode ) {
|
|||
} | ForEach-Object {
|
||||
if( -not $GenInstallCode ) { return $_ }
|
||||
"Write-Host -ForegroundColor Cyan 'Installing $_...';"
|
||||
"Install-Module $_ -AllowClobber"
|
||||
"Install-Module $_ -AllowClobber${scopeStr}"
|
||||
}
|
||||
if( $GenInstallCode ) {
|
||||
". Reload-MyScripts"
|
||||
}
|
||||
|
|
|
@ -6,14 +6,9 @@ if( -not (Test-Path variable:global:ScoopRefreshed) ) {
|
|||
$global:ScoopRefreshed = [SessionData]::Get("ScoopRefreshed",$false)
|
||||
|
||||
if( -not $ScoopRefreshed ) {
|
||||
if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) {
|
||||
if($Host.Name -ne 'Visual Studio Code Host' ) {
|
||||
scoop refresh
|
||||
[SessionData]::Set("ScoopRefreshed",$true)
|
||||
}
|
||||
} else {
|
||||
Write-Warning ("No recorded time for last 'scoop refresh', to remedy, run 'scoop refresh' at least once manually." +
|
||||
"`nIf the issue still persists, please run 'scoop alias-update' to update to latest refresh code, and try again.")
|
||||
if($Host.Name -ne 'Visual Studio Code Host' ) {
|
||||
scoop refresh
|
||||
[SessionData]::Set("ScoopRefreshed",$true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue