From 29d99c68667fa1efdd55f01f3de86004792a3cd5 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 24 Aug 2020 17:34:19 +0200 Subject: [PATCH] Use releases instead of tags to download PowerShell PhpManager I just started to publish PhpManager to GitHub Releases too --- src/scripts/win32.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 6d17ee8f..3fb254d8 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -45,13 +45,15 @@ Function Add-ToProfile { Function Install-PhpManager() { $repo = "mlocati/powershell-phpmanager" - $zip_file = "$php_dir\PhpManager.zip" - $tag = (Invoke-RestMethod https://api.github.com/repos/$repo/tags)[0].Name - $module_path = "$php_dir\PhpManager\powershell-phpmanager-$tag\PhpManager" - Invoke-WebRequest -UseBasicParsing -Uri https://github.com/$repo/archive/$tag.zip -OutFile $zip_file - Expand-Archive -Path $zip_file -DestinationPath $php_dir\PhpManager -Force + $tag = (Invoke-RestMethod https://api.github.com/repos/$repo/releases/latest).tag_name + $module_path = "$bin_dir\PhpManager\powershell-phpmanager-$tag\PhpManager\PhpManager.psm1" + if(-not (Test-Path $module_path -PathType Leaf)) { + $zip_file = "$bin_dir\PhpManager.zip" + Invoke-WebRequest -UseBasicParsing -Uri https://github.com/$repo/archive/$tag.zip -OutFile $zip_file + Expand-Archive -Path $zip_file -DestinationPath $bin_dir\PhpManager -Force + } Import-Module $module_path - Add-ToProfile $current_profile "PhpManager" "Import-Module $module_path" + Add-ToProfile $current_profile 'powershell-phpmanager' "Import-Module $module_path" } Function Add-Extension {