Skip to content

Commit 0a114fa

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 63ef04c commit 0a114fa

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
@@ -39,7 +39,7 @@ process {
3939
# Dot-source helper functions
4040
. .\scripts\Get-Helpers.ps1
4141

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

4444
# DB Setup
4545
Write-Host "Installing SQL Server Express"

Start-C4bJenkinsSetup.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ process {
7777
Stop-Service -Name Jenkins
7878

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

82-
if (Test-Path $PSScriptRoot\files\JenkinsPlugins.zip) {
83-
Expand-Archive -Path $PSScriptRoot\files\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force
82+
if (Test-Path $PSScriptRoot\packages\JenkinsPlugins.zip) {
83+
Expand-Archive -Path $PSScriptRoot\packages\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force
8484
}
8585

8686
# 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
@@ -38,7 +38,7 @@ process {
3838
# Dot-source helper functions
3939
. .\scripts\Get-Helpers.ps1
4040

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

4343
# Install base nexus-repository package
4444
Write-Host "Installing Sonatype Nexus Repository"
@@ -67,7 +67,7 @@ process {
6767
$NuGetApiKey = (Get-NexusNuGetApiKey -Credential $Credential).apikey
6868

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

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"
@@ -106,7 +106,7 @@ try {
106106
Write-Host "Setting up initial directories in"$env:SystemDrive\choco-setup"" -ForegroundColor Green
107107
$ChocoPath = "$env:SystemDrive\choco-setup"
108108
$FilesDir = Join-Path $ChocoPath "files"
109-
$PkgsDir = Join-Path $FilesDir "files"
109+
$PkgsDir = Join-Path $FilesDir "packages"
110110
$TempDir = Join-Path $ChocoPath "temp"
111111
$TestDir = Join-Path $ChocoPath "tests"
112112
@($ChocoPath, $FilesDir, $PkgsDir, $TempDir, $TestDir) | ForEach-Object {
@@ -133,8 +133,8 @@ try {
133133

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

136-
if (Test-Path $FilesDir\files\*.nupkg) {
137-
choco source add --name LocalChocolateySetup --source $FilesDir\files\ --Priority 1
136+
if (Test-Path $FilesDir\packages\*.nupkg) {
137+
choco source add --name LocalChocolateySetup --source $FilesDir\packages\ --Priority 1
138138
}
139139

140140
# 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.test.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)