Make Restore-PSModule -Name parameter a [string[]]

This commit is contained in:
Sergei Vorobev authored and Sergei Vorobev committed 2016-11-19 23:52:16 -08:00
1 parent 1fff6760b6
commit 5ff63e50b7
1 file changed
+17 -15
+17 -15
View File
@@ -406,8 +406,7 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
# so we need to get its parent directory
$publishPath = Split-Path $Options.Output -Parent
log "Restore PowerShell modules to $publishPath"
Restore-PSModule -Name PackageManagement -Destination (Join-Path -Path $publishPath -ChildPath "Modules")
Restore-PSModule -Name PowerShellGet -Destination (Join-Path -Path $publishPath -ChildPath "Modules")
Restore-PSModule -Name @('PackageManagement','PowerShellGet') -Destination (Join-Path -Path $publishPath -ChildPath "Modules")
}
}
@@ -2556,7 +2555,7 @@ function Restore-PSModule
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name,
[string[]]$Name,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
@@ -2612,21 +2611,24 @@ function Restore-PSModule
log ("Name='{0}', Destination='{1}', Repository='{2}'" -f $Name, $Destination, $RepositoryName)
$command = @{
Name=$Name
Path = $Destination
Repository =$RepositoryName
}
$Name | ForEach-Object {
if($RequiredVersion)
{
$command.Add("RequiredVersion", $RequiredVersion)
$command = @{
Name=$_
Path = $Destination
Repository =$RepositoryName
}
if($RequiredVersion)
{
$command.Add("RequiredVersion", $RequiredVersion)
}
# pull down the module
log "running save-module $Name"
PowerShellGet\Save-Module @command -Force -Verbose
}
# pull down the module
log "running save-module $Name"
PowerShellGet\Save-Module @command -Force -Verbose
# Clean up
if($needRegister)
{