-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.ps1
51 lines (37 loc) · 1.64 KB
/
create.ps1
1
2
3
4
5
6
7
8
9
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$TargetDirectory = 'C:\testoutput\test'
$templatefolder = "$psscriptroot\TemplateFolders"
$Helpermodulesfolder = "$PSScriptRoot\TemplateFolders\Helpermodules\"
. "$PSScriptRoot\TemplateFiles\Template.BootStrapDependencies.ps1"
Get-DependentModule -modulename 'Plaster' -downloadpath "$PSScriptRoot\TempModuleDownloadFolder"
#### Bootstrap required modules for creating the scaffold
Foreach ($Module in $DependentModules){
If (-not (Get-Module $module -ListAvailable)){
Install-Module -name $Module -Scope CurrentUser -Force
}
Import-Module $module -ErrorAction Stop
}
#removing the .keep files used to store the folder structure in git
$keepfiles = Get-ChildItem $templatefolder -File -Filter '.keep' -Recurse
if ($keepfiles) {
$keepfiles | ForEach-Object{
Remove-Item $_.FullName -Force | Out-Null
}
}
######## Clean the helpermodules folder (will become obsolete once PSDepend is part of build)
if ((Get-ChildItem $Helpermodulesfolder -Recurse)) {
Remove-Item "$Helpermodulesfolder\*" -Recurse -Force | Out-Null
}
#####create scaffold
Invoke-Plaster -TemplatePath . -DestinationPath $TargetDirectory -Verbose
######## Clean the helpermodules folder (will become obsolete once PSDepend is part of build)
if ((Get-ChildItem $Helpermodulesfolder -Recurse)) {
Remove-Item "$Helpermodulesfolder\*" -Recurse -Force | Out-Null
}
# add .keep files again to templatefolderstructure
$templatefolders = Get-ChildItem $templatefolder -Directory -Recurse
if ($templatefolders) {
$templatefolders | ForEach-Object{
# $_.FullName
New-Item -Path $_.FullName -Name '.keep' -ItemType 'file' -Force | Out-Null
}
}