Skip to content

Commit 2b0d360

Browse files
JPRuskinryanrichter94
authored andcommitted
(#230) Change "files" directory to "packages" directory
The manifest folders lived in a folder named after one in the Ansible project. This didn't make sense here, where it often lives inside a /files/ directory already. This has been changed.
1 parent c446da8 commit 2b0d360

9 files changed

+24
-24
lines changed

OfflineInstallPreparation.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ if (-not $Licensed) {
9090
}
9191
Copy-Item $LicensePath $InstalledLicensePath -Force
9292
}
93-
$ExtensionSource = if (Test-Path $PSScriptRoot\files\chocolatey.extension.*.nupkg) {
94-
Convert-Path $PSScriptRoot\files\
93+
$ExtensionSource = if (Test-Path $PSScriptRoot\packages\chocolatey.extension.*.nupkg) {
94+
Convert-Path $PSScriptRoot\packages\
9595
} else {
9696
'https://licensedpackages.chocolatey.org/api/v2/'
9797
}
@@ -103,7 +103,7 @@ $PackageWorkingDirectory = Join-Path $WorkingDirectory "Packages"
103103
if (-not (Test-Path $PackageWorkingDirectory)) {
104104
$null = New-Item -Path $PackageWorkingDirectory -ItemType Directory -Force
105105
}
106-
foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages) {
106+
foreach ($Package in (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages) {
107107
$ChocoArgs = @(
108108
"download", "$($Package.Name)"
109109
"--output-directory", $PackageWorkingDirectory
@@ -118,7 +118,7 @@ foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertF
118118
}
119119

120120
try {
121-
if (-not (Get-ChocolateyPackageMetadata -Path $PackageWorkingDirectory -Id $Package.Name) -and -not (Get-ChocolateyPackageMetadata -Path "$PSScriptRoot\files\" -Id $Package.Name)) {
121+
if (-not (Get-ChocolateyPackageMetadata -Path $PackageWorkingDirectory -Id $Package.Name) -and -not (Get-ChocolateyPackageMetadata -Path "$PSScriptRoot\packages\" -Id $Package.Name)) {
122122
Write-Host "Downloading '$($Package.Name)'"
123123

124124
while ((Get-ChildItem $PackageWorkingDirectory -Filter *.nupkg).Where{$_.CreationTime -gt (Get-Date).AddMinutes(-1)}.Count -gt 5) {
@@ -132,18 +132,18 @@ foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertF
132132
throw $_
133133
}
134134
}
135-
Move-Item -Path $PackageWorkingDirectory\*.nupkg -Destination $PSScriptRoot\files\
135+
Move-Item -Path $PackageWorkingDirectory\*.nupkg -Destination $PSScriptRoot\packages\
136136

137137
# Jenkins Plugins
138138
$PluginsWorkingDirectory = Join-Path $WorkingDirectory "JenkinsPlugins"
139139
if (-not (Test-Path $PluginsWorkingDirectory)) {
140140
$null = New-Item -Path $PluginsWorkingDirectory -ItemType Directory -Force
141141
}
142-
if (Test-Path $PSScriptRoot\files\JenkinsPlugins.zip) {
143-
Expand-Archive -Path $PSScriptRoot\files\JenkinsPlugins.zip -DestinationPath $PluginsWorkingDirectory -Force
142+
if (Test-Path $PSScriptRoot\packages\JenkinsPlugins.zip) {
143+
Expand-Archive -Path $PSScriptRoot\packages\JenkinsPlugins.zip -DestinationPath $PluginsWorkingDirectory -Force
144144
}
145145
$ProgressPreference = "Ignore"
146-
foreach ($Plugin in (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom-Json).plugins) {
146+
foreach ($Plugin in (Get-Content $PSScriptRoot\packages\jenkins.json | ConvertFrom-Json).plugins) {
147147
$RestArgs = @{
148148
Uri = "https://updates.jenkins-ci.org/latest/$($Plugin.Name).hpi"
149149
OutFile = Join-Path $PluginsWorkingDirectory "$($Plugin.Name).hpi"
@@ -155,12 +155,12 @@ foreach ($Plugin in (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom-
155155
Invoke-WebRequest @RestArgs -UseBasicParsing
156156
}
157157
}
158-
Compress-Archive -Path $PluginsWorkingDirectory\* -Destination $PSScriptRoot\files\JenkinsPlugins.zip -Force
158+
Compress-Archive -Path $PluginsWorkingDirectory\* -Destination $PSScriptRoot\packages\JenkinsPlugins.zip -Force
159159

160160
# BCryptDll
161161
$null = Get-BcryptDll
162162

163163
# License
164-
if ($LicensePath -ne "$PSScriptRoot\files\chocolatey.license.xml") {
165-
Copy-Item -Path (Convert-Path $LicensePath) -Destination $PSScriptRoot\files\chocolatey.license.xml
164+
if ($LicensePath -ne "$PSScriptRoot\packages\chocolatey.license.xml") {
165+
Copy-Item -Path (Convert-Path $LicensePath) -Destination $PSScriptRoot\packages\chocolatey.license.xml
166166
}

Start-C4bCcmSetup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ process {
2727
$ErrorActionPreference = 'Stop'
2828
Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bCcmSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"
2929

30-
$Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages
30+
$Packages = (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages
3131

3232
Set-ChocoEnvironmentProperty -Name DatabaseUser -Value $DatabaseCredential
3333

Start-C4bJenkinsSetup.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ process {
6868
Stop-Service -Name Jenkins
6969

7070
#region Jenkins Plugin Install & Update
71-
$JenkinsPlugins = (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom-Json).plugins
71+
$JenkinsPlugins = (Get-Content $PSScriptRoot\packages\jenkins.json | ConvertFrom-Json).plugins
7272

73-
if (Test-Path $PSScriptRoot\files\JenkinsPlugins.zip) {
74-
Expand-Archive -Path $PSScriptRoot\files\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force
73+
if (Test-Path $PSScriptRoot\packages\JenkinsPlugins.zip) {
74+
Expand-Archive -Path $PSScriptRoot\packages\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force
7575
}
7676

7777
# Performance is killed by Invoke-WebRequest's progress bars, turning them off to speed this up

Start-C4bNexusSetup.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ process {
2626
$ErrorActionPreference = 'Stop'
2727
Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bNexusSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"
2828

29-
$Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages
29+
$Packages = (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages
3030

3131
# Install base nexus-repository package
3232
Write-Host "Installing Sonatype Nexus Repository"
@@ -55,7 +55,7 @@ process {
5555
$NuGetApiKey = (Get-NexusNuGetApiKey -Credential $Credential).apikey
5656

5757
# Push all packages from previous steps to NuGet repo
58-
Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\files" -Filter *.nupkg | ForEach-Object {
58+
Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\packages" -Filter *.nupkg | ForEach-Object {
5959
Invoke-Choco push $_.FullName --source "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --apikey $NugetApiKey --force
6060
}
6161

Start-C4bSetup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ param(
2121
[Parameter(ParameterSetName='Attended')]
2222
[string]
2323
$LicenseFile = $(
24-
if (Test-Path $PSScriptRoot\files\chocolatey.license.xml) {
24+
if (Test-Path $PSScriptRoot\packages\chocolatey.license.xml) {
2525
# Offline setup has been run, we should use that license.
26-
Join-Path $PSScriptRoot "files\chocolatey.license.xml"
26+
Join-Path $PSScriptRoot "packages\chocolatey.license.xml"
2727
} elseif (Test-Path $env:ChocolateyInstall\license\chocolatey.license.xml) {
2828
# Chocolatey is already installed, we can use that license.
2929
Join-Path $env:ChocolateyInstall "license\chocolatey.license.xml"
@@ -99,7 +99,7 @@ try {
9999
Write-Host "Setting up initial directories in"$env:SystemDrive\choco-setup"" -ForegroundColor Green
100100
$ChocoPath = "$env:SystemDrive\choco-setup"
101101
$FilesDir = Join-Path $ChocoPath "files"
102-
$PkgsDir = Join-Path $FilesDir "files"
102+
$PkgsDir = Join-Path $FilesDir "packages"
103103
$TempDir = Join-Path $ChocoPath "temp"
104104
$TestDir = Join-Path $ChocoPath "tests"
105105
$xmlDir = Join-Path $ChocoPath "clixml"
@@ -134,8 +134,8 @@ try {
134134

135135
& $FilesDir\OfflineInstallPreparation.ps1 -LicensePath $LicenseFile
136136

137-
if (Test-Path $FilesDir\files\*.nupkg) {
138-
Invoke-Choco source add --name LocalChocolateySetup --source $FilesDir\files\ --Priority 1
137+
if (Test-Path $FilesDir\packages\*.nupkg) {
138+
Invoke-Choco source add --name LocalChocolateySetup --source $FilesDir\packages\ --Priority 1
139139
}
140140

141141
# Set Choco Server Chocolatey Configuration
File renamed without changes.
File renamed without changes.

scripts/Create-ChocoLicensePkg.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ param(
1313
# Local path used to build the license package.
1414
[Parameter()]
1515
[string]
16-
$PackagesPath = "$env:SystemDrive\choco-setup\files\files",
16+
$PackagesPath = "$env:SystemDrive\choco-setup\files\packages",
1717

1818
# Path to the license file.
1919
[Parameter()]

tests/jenkins.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Describe "Jenkins Configuration" {
7474

7575
Context "Required Plugins" {
7676
BeforeDiscovery {
77-
$ExpectedPlugins = (Get-Content $PSScriptRoot\..\files\jenkins.json | ConvertFrom-Json).plugins.name
77+
$ExpectedPlugins = (Get-Content $PSScriptRoot\..\packages\jenkins.json | ConvertFrom-Json).plugins.name
7878
}
7979

8080
BeforeAll {

0 commit comments

Comments
 (0)