Skip to content

✨Allow Source to be specified just by hostname (e.g. pwsh.gallery) #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
✨Allow Source to be specified just by hostname (e.g. pwsh.gallery)
  • Loading branch information
JustinGrote committed Sep 8, 2024
commit 526f3c36045445d0f18bc5953833a7d88c9e21a6
12 changes: 9 additions & 3 deletions ModuleFast.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,18 @@ function Install-ModuleFast {
)
begin {
trap {$PSCmdlet.ThrowTerminatingError($PSItem)}



#Clear the ModuleFastCache if -Update is specified to ensure fresh lookups of remote module availability
if ($Update) {
Clear-ModuleFastCache
}

#Cleanup that allows for shorthand such as pwsh.gallery
[Uri]$srcTest = $Source
if ($srcTest.Scheme -notin 'http', 'https') {
Write-Debug "Appending https and index.json to $Source"
$Source = "https://$Source/index.json"
}

$defaultRepoPath = $(Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'powershell/Modules')
if (-not $Destination) {
#Special function that will retrieve the default module path for the current user
Expand All @@ -279,6 +283,8 @@ function Install-ModuleFast {
throw 'Failed to determine destination path. This is a bug, please report it, it should always have something by this point.'
}



# Require approval to create the destination folder if it is not our default path, otherwise this is automatic
if (-not (Test-Path $Destination)) {
if ($configRepoPath -or
Expand Down