Skip to content

Commit aafa531

Browse files
committed
Fixed install script
1 parent b5af0cc commit aafa531

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
</Target>
290290

291291
<!-- Publish all packages -->
292-
<Target Name="Publish">
292+
<Target Name="Publish" DependsOnTargets="Build">
293293
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
294294
<Message Importance="high" Text="Publishing Cmdlets..." />
295295

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,19 @@ Finalizing installation of Azure PowerShell.
2626
Installing Azure Modules from PowerShell Gallery.
2727
This may take some time...
2828
"@
29+
$env:PSModulePath = "$env:HOME\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
30+
2931
Import-Module PackageManagement
3032

3133
$result = Get-PackageProvider -Name NuGet -ForceBootstrap
3234

3335
Import-Module PowerShellGet
3436

35-
$NuGetPublishingSource = $env:NuGetPublishingSource
36-
if ([string]::IsNullOrWhiteSpace($NuGetPublishingSource)) {
37-
Install-Module Azure
38-
Write-Output "Azure $((Get-InstalledModule -Name Azure)[0].Version) installed..."
39-
Install-Module AzureRM
40-
Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
41-
Update-AzureRM
42-
} else {
43-
Install-Module Azure -Repository $NuGetPublishingSource
44-
Write-Output "Azure $((Get-InstalledModule -Name Azure)[0].Version) installed..."
45-
Install-Module AzureRM -Repository $NuGetPublishingSource
46-
Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
47-
Update-AzureRM -Repository $NuGetPublishingSource
48-
}
37+
Install-Module Azure
38+
Write-Output "Azure $((Get-InstalledModule -Name Azure)[0].Version) installed..."
39+
Install-Module AzureRM
40+
Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
41+
Update-AzureRM
4942
} else {
5043
cd c:\
5144
$welcomeMessage = @"

tools/PublishModules.ps1

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,25 @@
1515
param(
1616
[Parameter(Mandatory = $false, Position = 0)]
1717
[string] $buildConfig,
18-
[Parameter(Mandatory = $false, Position = 1)]
18+
[Parameter(Mandatory = $false, Position = 1)]
1919
[string] $apiKey,
20-
[Parameter(Mandatory = $false, Position = 2)]
21-
[string] $repository
20+
[Parameter(Mandatory = $false, Position = 2)]
21+
[string] $repositoryLocation
2222
)
2323

2424
if ([string]::IsNullOrEmpty($buildConfig))
2525
{
26-
Write-Verbose "Setting build configuration to 'Release'"
27-
$buildConfig = 'Release'
26+
Write-Verbose "Setting build configuration to 'Release'"
27+
$buildConfig = "Release"
2828
}
2929

3030
if ([string]::IsNullOrEmpty($repositoryLocation))
3131
{
32-
Write-Verbose "Setting repository location to 'https://dtlgalleryint.cloudapp.net/api/v2'"
32+
Write-Verbose "Setting repository location to 'https://dtlgalleryint.cloudapp.net/api/v2'"
3333

34-
$repository = 'https://dtlgalleryint.cloudapp.net'
34+
$repositoryLocation = "https://dtlgalleryint.cloudapp.net/api/v2"
3535
}
3636

37-
$repositoryLocation = '$repository/api/v2/'
38-
$repositoryPackageLocation = '$repository/api/v2/package'
39-
4037

4138
$packageFolder = "$PSScriptRoot\..\src\Package"
4239

@@ -45,7 +42,7 @@ if ($repo -ne $null) {
4542
$repoName = $repo.Name
4643
} else {
4744
$repoName = $(New-Guid).ToString()
48-
Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryPackageLocation -InstallationPolicy Trusted
45+
Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation/package -InstallationPolicy Trusted
4946
}
5047
$modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure"
5148
# Publish Azure module
@@ -64,10 +61,10 @@ Write-Host "Published AzureRM.Profile module"
6461
# Publish AzureRM modules
6562
$resourceManagerModules = Get-ChildItem -Path "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager" -Directory
6663
foreach ($module in $resourceManagerModules) {
67-
if ($module -ne "AzureRM.Profile") {
68-
$modulePath = $module.FullName
69-
Write-Host "Publishing $module module from $modulePath"
64+
if ($module -ne "AzureRM.Profile") {
65+
$modulePath = $module.FullName
66+
Write-Host "Publishing $module module from $modulePath"
7067
Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure", "AzureRM")
71-
Write-Host "Published $module module"
72-
}
73-
}
68+
Write-Host "Published $module module"
69+
}
70+
}

0 commit comments

Comments
 (0)