ScoopInstaller / Main

📦 The default bucket for Scoop.
https://scoop.sh
The Unlicense
1.6k stars 970 forks source link

azure-ps modules and junction directories #2272

Open ghotz opened 3 years ago

ghotz commented 3 years ago

Currently a junction named AzureRM is created under ..\Scoop\modules directory that points to ..\Scoop\apps\azure-ps\current directory.

However, the package is not a single PowerShell module, but a collection of modules, and while cmdlets are still found, and modules loaded on first reference (assuming ..\Scoop\modules is present in psmodulepath environment variable), importing modules with import-module doesn't work (I think it has to do with modules being well-formed).

My proposal is to change the behavior so that each module sub-directory in ..\Scoop\apps\azure-ps\current is added as a distinct junction directory directly under ..\Scoop\modules.

My current workaround is to execute the following code after installation:


if (Test-Path "$Env:SCOOP\Modules\AzureRM") { (Get-Item "$Env:SCOOP\Modules\AzureRM").Delete() }
Get-ChildItem "$Env:SCOOP\apps\azure-ps\current" | 
    ? { $_.PSIsContainer } |
    % {
        if (!(Test-Path "$Env:SCOOP\Modules\$($_.Name)"))
        {New-Item -Path "$Env:SCOOP\Modules\$($_.Name)" -ItemType Junction -Value $_.FullName }
    }
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.