@@ -80,54 +80,65 @@ Write-Host "START - [Convert Sitecore Module to .scwdp]"
8080Write-Host " `n "
8181
8282$packagePath = $PSScriptRoot + " \Package\$ModulePackageName "
83- $destinationPath = $PSScriptRoot + " \scwpd"
83+ $scwdpDirectory = $PSScriptRoot + " \scwpd"
8484
8585Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.psm1
8686Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.dll
8787
88- Remove-Item - Path $destinationPath - Recurse
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+ }
8995
90- $scwdpPath = ConvertTo-SCModuleWebDeployPackage - Path $packagePath - Destination $destinationPath - Force
91- Write-Host " SUCCESS - Your Sitecore Module was converted to a Sitecore WebDeploy package and is located at:" - ForegroundColor Green
92- Write-Host " `n "
93- Write-Host " $scwdpPath " - ForegroundColor Yellow
94- Write-Host " `n "
96+ Get-ChildItem - Path $scwdpDirectory - Recurse | Foreach-object { Remove-item - Recurse - path $_.FullName }
9597
96- Write-Host " =================================================================================================================================="
97- Write-Host " `n "
98- Write-Host " START - [Creating Sitecore module asset image structure]"
99- Write-Host " `n "
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
102+ Write-Host " `n "
100103
101- $moduleDirectory = $PSScriptRoot + " \Module"
102- $cmContentDirectory = $moduleDirectory + " \cm\content"
103- $dbDirectory = $moduleDirectory + " \db"
104- $solrDirectory = $moduleDirectory + " \solr"
105- $toolsDirectory = $moduleDirectory + " \tools"
104+ Write-Host " =================================================================================================================================="
105+ Write-Host " `n "
106+ Write-Host " START - [Creating Sitecore module asset image structure]"
107+ Write-Host " `n "
106108
107- If (! (Test-Path ($moduleDirectory ))) {
108- New-Item - ItemType Directory - Force - Path $moduleDirectory
109- }
109+ $moduleDirectory = $PSScriptRoot + " \Module"
110+ $cmContentDirectory = $moduleDirectory + " \cm\content"
111+ $dbDirectory = $moduleDirectory + " \db"
112+ $solrDirectory = $moduleDirectory + " \solr"
113+ $toolsDirectory = $moduleDirectory + " \tools"
110114
111- Remove-Item - Path $moduleDirectory - Recurse
115+ If (! (Test-Path ($moduleDirectory ))) {
116+ New-Item - ItemType Directory - Force - Path $moduleDirectory
117+ }
112118
113- If (! (Test-Path ($cmContentDirectory ))) {
114- New-Item - ItemType Directory - Force - Path $cmContentDirectory
115- }
119+ Remove-Item - Path $moduleDirectory - Recurse
116120
117- If (! (Test-Path ($dbDirectory ))) {
118- New-Item - ItemType Directory - Force - Path $dbDirectory
119- }
121+ If (! (Test-Path ($cmContentDirectory ))) {
122+ New-Item - ItemType Directory - Force - Path $cmContentDirectory
123+ }
120124
121- If (! (Test-Path ($solrDirectory ))) {
122- New-Item - ItemType Directory - Force - Path $solrDirectory
123- }
125+ If (! (Test-Path ($dbDirectory ))) {
126+ New-Item - ItemType Directory - Force - Path $dbDirectory
127+ }
128+
129+ If (! (Test-Path ($solrDirectory ))) {
130+ New-Item - ItemType Directory - Force - Path $solrDirectory
131+ }
124132
125- If (! (Test-Path ($toolsDirectory ))) {
126- New-Item - ItemType Directory - Force - Path $toolsDirectory
133+ If (! (Test-Path ($toolsDirectory ))) {
134+ New-Item - ItemType Directory - Force - Path $toolsDirectory
135+ }
136+
137+ Write-Host " =================================================================================================================================="
138+ Write-Host " `n "
127139}
128140
129- Write-Host " =================================================================================================================================="
130- Write-Host " `n "
141+
131142
132143Show-Stop
133144
0 commit comments