Skip to content

Commit 99d221b

Browse files
committed
Initial code of the module
1 parent 999aab1 commit 99d221b

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
<#
3+
.SYNOPSIS
4+
Script to handle the auto creation of a Docker Asset Image for a given Sitecore module
5+
.DESCRIPTION
6+
The purpose of this script is to create a Docker asset image for your Sitecore module
7+
The script is intended to automate some steps that need to be taken in order to create a custom
8+
Docker Asset Image for your Sitecore module
9+
10+
I got the inspiration for this project after reading the following blogposts:
11+
12+
How to create a Docker asset image for your Sitecore Module - Árvai Mihály
13+
https://medium.com/@mitya_1988/how-to-create-a-docker-asset-image-for-your-sitecore-module-58e1f3a47672
14+
15+
Creating a Docker Asset Image for Your Sitecore Module and Adding It To Your Site - Erica Stockwell-Alpert
16+
https://ericastockwellalpert.wordpress.com/2021/02/23/creating-a-docker-asset-image-for-your-sitecore-module-and-adding-it-to-your-site/
17+
.NOTES
18+
Version: 1.0
19+
Author: Robbert Hock - Kayee - Sitecore MVP 2010-2021
20+
Creation Date: June/July 2021
21+
Purpose/Change: Initial script development
22+
#>
23+
24+
using module ".\logo.psm1"
25+
26+
#---------------------------------[Parameters]--------------------------------------------------------
27+
param(
28+
[string] $ModulePackageName = "Gutters.for.Sitecore.Data.Exchange.Framework-Sitecore.10.1.0.for.DEF.5.0.0.zip"
29+
)
30+
31+
#---------------------------------[Read configuration]------------------------------------------------
32+
$configurationPath = "configuration.json"
33+
$jsonConfiguration = Get-Content -Path $configurationPath | ConvertFrom-Json
34+
$satUrl = $jsonConfiguration.Parameters.SitecoreAzureToolkitUrl.DefaultValue
35+
$satPackageName = $jsonConfiguration.Parameters.SitecoreAzureToolkitPackageName.DefaultValue
36+
37+
Show-Start
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 -Path "$satDirecory\$satPackageName") {
47+
Write-Host "SKIPPING - $satDirecory folder already contains the $satPackageName file"
48+
}
49+
else {
50+
Write-Host "START - downloading the $satPackageName file from dev.sitecore.net"
51+
Invoke-WebRequest -Uri $satUrl -OutFile "$satDirecory\$satPackageName"
52+
}
53+
54+
Write-Host "`n"
55+
56+
Write-Host "=================================================================================================================================="
57+
Write-Host "`n"
58+
Write-Host "START - [Sitecore Azure Toolkit extract]"
59+
Write-Host "`n"
60+
61+
62+
63+
if (-not(Test-Path ".\SAT\tools\Sitecore.Cloud.Cmdlets.dll")) {
64+
Expand-Archive -Path "$satDirecory\$satPackageName" -DestinationPath "$satDirecory" -Force
65+
Write-Host "SUCCESS - Extracted $satPackageName to the $satDirecory directory:"
66+
Write-Host "`n"
67+
}
68+
else {
69+
Write-Host "SKIPPING - $satPackageName is already extracted to the $satDirecory directory"
70+
Write-Host "`n"
71+
}
72+
73+
Write-Host "=================================================================================================================================="
74+
Write-Host "`n"
75+
Write-Host "START - [Convert Sitecore Module to .scwdp]"
76+
Write-Host "`n"
77+
78+
$packagePath = $PSScriptRoot + "\Package\$ModulePackageName"
79+
$destinationPath = $PSScriptRoot + "\scwpd"
80+
81+
Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.psm1
82+
Import-Module .\SAT\tools\Sitecore.Cloud.Cmdlets.dll
83+
84+
$scwdpPath = ConvertTo-SCModuleWebDeployPackage -Path $packagePath -Destination $destinationPath -Force
85+
Write-Host "SUCCESS - Your Sitecore Module was converted to a Sitecore WebDeploy package and is located at:"
86+
Write-Host "`n"
87+
Write-Host "$scwdpPath" -ForegroundColor Yellow
88+
Write-Host "`n"
89+
90+
Write-Host "=================================================================================================================================="
91+
Write-Host "`n"
92+
93+
Show-Stop

configuration.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Parameters": {
3+
"SitecoreAzureToolkitUrl": {
4+
"Type": "string",
5+
"Description": "The Url of the Sitecore Azure Toolkit",
6+
"DefaultValue": "https://sitecoredev.azureedge.net/~/media/75A6FF723F0C48E991D7BB656DFA6FEF.ashx"
7+
},
8+
"SitecoreAzureToolkitPackageName": {
9+
"Type": "string",
10+
"Description": "The name of Sitecore Azure Toolkit package",
11+
"DefaultValue": "Sitecore Azure Toolkit 2.6.1-r02533.1198.zip"
12+
}
13+
}
14+
}

logo.psm1

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
function Show-Start {
2+
param(
3+
[Parameter()]
4+
[string] $Color = "Green"
5+
)
6+
7+
$logo = @'
8+
==================================================================================================================================
9+
welcome to the
10+
_______. __ .___________. _______ ______ ______ .______ _______ .___ ___. ______ _______ __ __ __ _______
11+
/ || | | || ____| / | / __ \ | _ \ | ____| | \/ | / __ \ | \ | | | | | | | ____|
12+
| (----`| | `---| |----`| |__ | ,----'| | | | | |_) | | |__ | \ / | | | | | | .--. || | | | | | | |__
13+
\ \ | | | | | __| | | | | | | | / | __| | |\/| | | | | | | | | || | | | | | | __|
14+
.----) | | | | | | |____ | `----.| `--' | | |\ \----.| |____ | | | | | `--' | | '--' || `--' | | `----.| |____
15+
|_______/ |__| |__| |_______| \______| \______/ | _| `._____||_______| |__| |__| \______/ |_______/ \______/ |_______||_______|
16+
17+
_______ ______ ______ __ ___ _______ .______ ___ _______. _______. _______ .___________.
18+
| \ / __ \ / || |/ / | ____|| _ \ / \ / | / || ____|| |
19+
| .--. | | | | | ,----'| ' / | |__ | |_) | / ^ \ | (----` | (----`| |__ `---| |----`
20+
| | | | | | | | | | < | __| | / / /_\ \ \ \ \ \ | __| | |
21+
| '--' | `--' | | `----.| . \ | |____ | |\ \----. / _____ \ .----) | .----) | | |____ | |
22+
|_______/ \______/ \______||__|\__\ |_______|| _| `._____| /__/ \__\ |_______/ |_______/ |_______| |__|
23+
24+
__ .___ ___. ___ _______ _______ ______ .______ _______ ___ .___________. ______ .______
25+
| | | \/ | / \ / _____|| ____| / || _ \ | ____| / \ | | / __ \ | _ \
26+
| | | \ / | / ^ \ | | __ | |__ | ,----'| |_) | | |__ / ^ \ `---| |----`| | | | | |_) |
27+
| | | |\/| | / /_\ \ | | |_ | | __| | | | / | __| / /_\ \ | | | | | | | /
28+
| | | | | | / _____ \ | |__| | | |____ | `----.| |\ \----.| |____ / _____ \ | | | `--' | | |\ \----.
29+
|__| |__| |__| /__/ \__\ \______| |_______| \______|| _| `._____||_______/__/ \__\ |__| \______/ | _| `._____|
30+
31+
==================================================================================================================================
32+
'@
33+
34+
Write-Host $logo -ForegroundColor $Color
35+
}
36+
37+
38+
function Show-Stop {
39+
param(
40+
[Parameter()]
41+
[string] $Color = "Green"
42+
)
43+
44+
$logo = @'
45+
===========================================================================================================================
46+
thanks ;-)
47+
____ ____ __ .______ .______ _______ _______ __ ___ ___ ____ ____ _______ _______ __
48+
\ \ / / | | | _ \ | _ \ | ____|| ____| | |/ / / \ \ \ / / | ____|| ____|| |
49+
\ \/ / | | | |_) | | |_) | | |__ | |__ ______ | ' / / ^ \ \ \/ / | |__ | |__ | |
50+
\_ _/ | | | ___/ | ___/ | __| | __| |______|| < / /_\ \ \_ _/ | __| | __| | |
51+
| | | | | | | | | |____ | |____ | . \ / _____ \ | | | |____ | |____ |__|
52+
|__| |__| | _| | _| |_______||_______| |__|\__\ /__/ \__\ |__| |_______||_______|(__)
53+
54+
===========================================================================================================================
55+
'@
56+
57+
Write-Host $logo -ForegroundColor $Color
58+
}
59+
60+
61+
Export-ModuleMember -Function *

0 commit comments

Comments
 (0)