@@ -25,7 +25,7 @@ using module ".\logo.psm1"
25
25
26
26
# ---------------------------------[Parameters]--------------------------------------------------------
27
27
param (
28
- [string ] $ModulePackageName = " Gutters.for.Sitecore.Data.Exchange.Framework-Sitecore.10.1.0.for.DEF.5.0.0.zip "
28
+ [string ] $ModulePackageName = " "
29
29
)
30
30
31
31
# ---------------------------------[Read configuration]------------------------------------------------
@@ -36,149 +36,163 @@ $satPackageName = $jsonConfiguration.Parameters.SitecoreAzureToolkitPackageName.
36
36
37
37
Show-Start
38
38
39
- Write-Host " ================================================================================================================================="
40
- Write-Host " `n "
41
- Write-Host " START - [Sitecore Azure Toolkit download]"
42
- Write-Host " `n "
43
-
44
- $satDirecory = $PSScriptRoot + " \SAT"
45
-
46
- If (! (Test-Path ($satDirecory ))) {
47
- New-Item - ItemType Directory - Force - Path $satDirecory
48
- }
49
-
50
- if (Test-Path - Path " $satDirecory \$satPackageName " ) {
51
- Write-Host " SKIPPING - $satDirecory folder already contains the $satPackageName file" - ForegroundColor Cyan
52
- }
53
- else {
54
- Write-Host " START - downloading the $satPackageName file from dev.sitecore.net"
55
- Invoke-WebRequest - Uri $satUrl - OutFile " $satDirecory \$satPackageName "
39
+ if (! $ModulePackageName ) {
40
+ Write-Host " ================================================================================================================================="
56
41
Write-Host " `n "
57
- Write-Host " SUCCESS - Downloaded the $satPackageName file from dev.sitecore.net" - ForegroundColor Green
58
- }
59
-
60
- Write-Host " `n "
61
-
62
- Write-Host " =================================================================================================================================="
63
- Write-Host " `n "
64
- Write-Host " START - [Sitecore Azure Toolkit extract]"
65
- Write-Host " `n "
66
-
67
- if (-not (Test-Path " .\SAT\tools\Sitecore.Cloud.Cmdlets.dll" )) {
68
- Expand-Archive - Path " $satDirecory \$satPackageName " - DestinationPath " $satDirecory " - Force
69
- Write-Host " SUCCESS - Extracted $satPackageName to the $satDirecory directory" - ForegroundColor Green
42
+ Write-Host " ERROR - Make sure you pass in the -ModulePackageName parameter. e.g. .\\Create-SitecoreModule-DockerAssetImage.ps1 -ModulePackageName 'YOUR PACKAGE NAME'" - ForegroundColor Red
70
43
Write-Host " `n "
44
+ Write-Host " ================================================================================================================================="
71
45
}
72
46
else {
73
- Write-Host " SKIPPING - $satPackageName is already extracted to the $satDirecory directory " - ForegroundColor Cyan
47
+ Write-Host " ================================================================================================================================= "
74
48
Write-Host " `n "
75
- }
76
-
77
- Write-Host " =================================================================================================================================="
78
- Write-Host " `n "
79
- Write-Host " START - [Convert Sitecore Module to .scwdp]"
80
- Write-Host " `n "
81
-
82
- $packagePath = $PSScriptRoot + " \Package\$ModulePackageName "
83
- $scwdpDirectory = $PSScriptRoot + " \scwpd"
84
-
85
- Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.psm1
86
- Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.dll
87
-
88
- If (! (Test-Path ($packagePath ))) {
89
- Write-Host " ERROR - Make sure the $packagePath exists!" - ForegroundColor Red
90
- }
91
- else {
92
- If (! (Test-Path ($scwdpDirectory ))) {
93
- New-Item - ItemType Directory - Force - Path $scwdpDirectory
94
- }
95
-
96
- Get-ChildItem - Path $scwdpDirectory - Recurse | Foreach-object { Remove-item - Recurse - path $_.FullName }
97
-
98
- $scwdpPath = ConvertTo-SCModuleWebDeployPackage - Path $packagePath - Destination $scwdpDirectory - Force
99
- Write-Host " SUCCESS - Your Sitecore Module was converted to a Sitecore WebDeploy package and is located at:" - ForegroundColor Green
100
- Write-Host " `n "
101
- Write-Host " $scwdpPath " - ForegroundColor Yellow
49
+ Write-Host " START - [Sitecore Azure Toolkit download]"
102
50
Write-Host " `n "
103
51
104
- Write-Host " =================================================================================================================================="
105
- Write-Host " `n "
106
- Write-Host " START - [Extracting Sitecore WebDeploy package]"
107
- Write-Host " `n "
52
+ $satDirecory = $PSScriptRoot + " \SAT"
108
53
109
- $extractSCwdpDirectory = $scwdpDirectory + " \extract"
54
+ If (! (Test-Path ($satDirecory ))) {
55
+ New-Item - ItemType Directory - Force - Path $satDirecory
56
+ }
110
57
111
- if (! (Test-Path ($extractSCwdpDirectory ))) {
112
- New-Item - ItemType Directory - Force - Path $extractSCwdpDirectory
58
+ if (Test-Path - Path " $satDirecory \$satPackageName " ) {
59
+ Write-Host " SKIPPING - $satDirecory folder already contains the $satPackageName file" - ForegroundColor Cyan
60
+ }
61
+ else {
62
+ Write-Host " START - downloading the $satPackageName file from dev.sitecore.net"
63
+ Invoke-WebRequest - Uri $satUrl - OutFile " $satDirecory \$satPackageName "
64
+ Write-Host " `n "
65
+ Write-Host " SUCCESS - Downloaded the $satPackageName file from dev.sitecore.net" - ForegroundColor Green
113
66
}
114
67
115
- Expand-Archive - Path " $scwdpPath " - DestinationPath " $extractSCwdpDirectory " - Force
68
+ Write-Host " `n "
116
69
117
70
Write-Host " =================================================================================================================================="
118
71
Write-Host " `n "
119
- Write-Host " START - [Creating Sitecore module asset image structure ]"
72
+ Write-Host " START - [Sitecore Azure Toolkit extract ]"
120
73
Write-Host " `n "
121
74
122
- $moduleDirectory = $PSScriptRoot + " \Module"
123
- $cmContentDirectory = $moduleDirectory + " \cm\content"
124
- $dbDirectory = $moduleDirectory + " \db"
125
- $solrDirectory = $moduleDirectory + " \solr"
126
- $toolsDirectory = $moduleDirectory + " \tools"
127
-
128
- If (! (Test-Path ($moduleDirectory ))) {
129
- New-Item - ItemType Directory - Force - Path $moduleDirectory
130
- }
131
-
132
- Remove-Item - Path $moduleDirectory - Recurse
133
-
134
- If (! (Test-Path ($cmContentDirectory ))) {
135
- New-Item - ItemType Directory - Force - Path $cmContentDirectory
136
- }
137
-
138
- If (! (Test-Path ($dbDirectory ))) {
139
- New-Item - ItemType Directory - Force - Path $dbDirectory
75
+ if (-not (Test-Path " $satDirecory \tools\Sitecore.Cloud.Cmdlets.dll" )) {
76
+ Expand-Archive - Path " $satDirecory \$satPackageName " - DestinationPath " $satDirecory " - Force
77
+ Write-Host " SUCCESS - Extracted $satPackageName to the $satDirecory directory" - ForegroundColor Green
78
+ Write-Host " `n "
140
79
}
141
-
142
- If (! (Test-Path ($solrDirectory ))) {
143
- New-Item - ItemType Directory - Force - Path $solrDirectory
144
- }
145
-
146
- If (! (Test-Path ($toolsDirectory ))) {
147
- New-Item - ItemType Directory - Force - Path $toolsDirectory
80
+ else {
81
+ Write-Host " SKIPPING - $satPackageName is already extracted to the $satDirecory directory" - ForegroundColor Cyan
82
+ Write-Host " `n "
148
83
}
149
84
150
85
Write-Host " =================================================================================================================================="
151
86
Write-Host " `n "
152
- Write-Host " START - [Copying over .scwdp contents to Sitecore module asset image structure ]"
87
+ Write-Host " START - [Convert Sitecore Module to .scwdp ]"
153
88
Write-Host " `n "
154
89
155
- # Copy content
156
- Copy-Item - Path " $extractSCwdpDirectory \Content\Website\* " - Destination $cmContentDirectory - PassThru - Recurse
90
+ $packagePath = $PSScriptRoot + " \Package\ $ModulePackageName "
91
+ $scwdpDirectory = $PSScriptRoot + " \scwpd "
157
92
158
- # Copy dacpacs + rename
159
- if (Test-Path (" $extractSCwdpDirectory \core.dacpac" )) {
160
- Copy-Item - Path " $extractSCwdpDirectory \core.dacpac" - Destination $dbDirectory - PassThru
161
- Rename-Item - Path " $dbDirectory \core.dacpac" - NewName " Sitecore.Core.dacpac"
162
- }
93
+ Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.psm1
94
+ Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.dll
163
95
164
- if (Test-Path (" $extractSCwdpDirectory \master.dacpac" )) {
165
- Copy-Item - Path " $extractSCwdpDirectory \master.dacpac" - Destination $dbDirectory - PassThru
166
- Rename-Item - Path " $dbDirectory \master.dacpac" - NewName " Sitecore.Master.dacpac"
96
+ If (! (Test-Path ($packagePath ))) {
97
+ Write-Host " ERROR - Make sure the $packagePath exists!" - ForegroundColor Red
167
98
}
99
+ else {
100
+ If (! (Test-Path ($scwdpDirectory ))) {
101
+ New-Item - ItemType Directory - Force - Path $scwdpDirectory
102
+ }
103
+
104
+ Get-ChildItem - Path $scwdpDirectory - Recurse | Foreach-object { Remove-item - Recurse - path $_.FullName }
105
+
106
+ $scwdpPath = ConvertTo-SCModuleWebDeployPackage - Path $packagePath - Destination $scwdpDirectory - Force
107
+ Write-Host " SUCCESS - Your Sitecore Module was converted to a Sitecore WebDeploy package and is located at:" - ForegroundColor Green
108
+ Write-Host " `n "
109
+ Write-Host " $scwdpPath " - ForegroundColor Yellow
110
+ Write-Host " `n "
111
+
112
+ Write-Host " =================================================================================================================================="
113
+ Write-Host " `n "
114
+ Write-Host " START - [Extracting Sitecore WebDeploy package]"
115
+ Write-Host " `n "
116
+
117
+ $extractSCwdpDirectory = $scwdpDirectory + " \extract"
118
+
119
+ if (! (Test-Path ($extractSCwdpDirectory ))) {
120
+ New-Item - ItemType Directory - Force - Path $extractSCwdpDirectory
121
+ }
122
+
123
+ Expand-Archive - Path " $scwdpPath " - DestinationPath " $extractSCwdpDirectory " - Force
124
+
125
+ Write-Host " =================================================================================================================================="
126
+ Write-Host " `n "
127
+ Write-Host " START - [Creating Sitecore module asset image structure]"
128
+ Write-Host " `n "
129
+
130
+ $moduleDirectory = $PSScriptRoot + " \Module"
131
+ $cmContentDirectory = $moduleDirectory + " \cm\content"
132
+ $dbDirectory = $moduleDirectory + " \db"
133
+ $solrDirectory = $moduleDirectory + " \solr"
134
+ $toolsDirectory = $moduleDirectory + " \tools"
135
+
136
+ If (! (Test-Path ($moduleDirectory ))) {
137
+ New-Item - ItemType Directory - Force - Path $moduleDirectory
138
+ }
139
+
140
+ Remove-Item - Path $moduleDirectory - Recurse
141
+
142
+ If (! (Test-Path ($cmContentDirectory ))) {
143
+ New-Item - ItemType Directory - Force - Path $cmContentDirectory
144
+ }
145
+
146
+ If (! (Test-Path ($dbDirectory ))) {
147
+ New-Item - ItemType Directory - Force - Path $dbDirectory
148
+ }
149
+
150
+ If (! (Test-Path ($solrDirectory ))) {
151
+ New-Item - ItemType Directory - Force - Path $solrDirectory
152
+ }
153
+
154
+ If (! (Test-Path ($toolsDirectory ))) {
155
+ New-Item - ItemType Directory - Force - Path $toolsDirectory
156
+ }
157
+
158
+ Write-Host " =================================================================================================================================="
159
+ Write-Host " `n "
160
+ Write-Host " START - [Copying over .scwdp contents to Sitecore module asset image structure]"
161
+ Write-Host " `n "
162
+
163
+ # Copy content
164
+ Copy-Item - Path " $extractSCwdpDirectory \Content\Website\*" - Destination $cmContentDirectory - PassThru - Recurse
165
+
166
+ # Copy dacpacs + rename
167
+ if (Test-Path (" $extractSCwdpDirectory \core.dacpac" )) {
168
+ Copy-Item - Path " $extractSCwdpDirectory \core.dacpac" - Destination $dbDirectory - PassThru
169
+ Rename-Item - Path " $dbDirectory \core.dacpac" - NewName " Sitecore.Core.dacpac"
170
+ }
171
+
172
+ if (Test-Path (" $extractSCwdpDirectory \master.dacpac" )) {
173
+ Copy-Item - Path " $extractSCwdpDirectory \master.dacpac" - Destination $dbDirectory - PassThru
174
+ Rename-Item - Path " $dbDirectory \master.dacpac" - NewName " Sitecore.Master.dacpac"
175
+ }
168
176
169
- Write-Host " =================================================================================================================================="
170
- Write-Host " `n "
171
- Write-Host " SUCCESS - Succesfully created the Docker Asset Image structure in directory $moduleDirectory " - ForegroundColor Green
172
- Write-Host " `n "
177
+ Write-Host " =================================================================================================================================="
178
+ Write-Host " `n "
179
+ Write-Host " START - [Copying over dockerfile] "
180
+ Write-Host " `n "
173
181
174
- tree $moduleDirectory / f / a
182
+ Copy-Item - Path " $PSScriptRoot \dockerfile " - Destination $moduleDirectory - PassThru
175
183
176
- Write-Host " `n "
177
- Write-Host " ================================================================================================================================== "
178
- Write-Host " `n "
179
- }
184
+ Write-Host " ================================================================================================================================== "
185
+ Write-Host " `n "
186
+ Write-Host " SUCCESS - Succesfully created the Docker Asset Image structure in directory $moduleDirectory " - ForegroundColor Green
187
+ Write-Host " `n "
180
188
189
+ tree $moduleDirectory / f / a
181
190
191
+ Write-Host " `n "
192
+ Write-Host " =================================================================================================================================="
193
+ Write-Host " `n "
194
+ }
195
+ }
182
196
183
197
Show-Stop
184
198
0 commit comments