Skip to content

Commit a0d8f79

Browse files
author
FriedrichWeinmann
committed
Working on WIX stuff
Plus general design works
1 parent 089dbea commit a0d8f79

13 files changed

Lines changed: 720 additions & 18 deletions

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ModuleToProcess = 'PSModuleDevelopment.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '1.3.1.17'
7+
ModuleVersion = '1.4.0.27'
88

99
# ID used to uniquely identify this module
1010
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'
@@ -69,7 +69,8 @@
6969
'New-PssModuleProject',
7070
'Remove-ModuleDebug',
7171
'Restart-Shell',
72-
'Set-ModuleDebug'
72+
'Set-ModuleDebug',
73+
'Set-PSMDModulePath'
7374
)
7475

7576
# Cmdlets to export from this module

PSModuleDevelopment/PSModuleDevelopment.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$script:PSModuleDevelopmentModuleRoot = $PSScriptRoot
2+
$script:PSModuleDevelopmentModuleVersion = '1.4.0.27'
23

34
$script:doDotSource = $false
45
if (Get-PSFConfigValue -Name PSModuleDevelopment.Import.DoDotSource) { $script:doDotSource = $true }
@@ -35,7 +36,7 @@ function Import-PSMDFile
3536

3637

3738
# Perform Actions before loading the rest of the content
38-
. Import-PSMDFile -Path "$PSModuleDevelopmentModuleRoot\scripts\preload.ps1"
39+
. Import-PSMDFile -Path "$PSModuleDevelopmentModuleRoot\internal\scripts\preload.ps1"
3940

4041
#region Load functions
4142
foreach ($function in (Get-ChildItem "$PSModuleDevelopmentModuleRoot\functions" -Recurse -File -Filter "*.ps1"))
@@ -45,4 +46,4 @@ foreach ($function in (Get-ChildItem "$PSModuleDevelopmentModuleRoot\functions"
4546
#endregion Load functions
4647

4748
# Perform Actions after loading the module contents
48-
. Import-PSMDFile -Path "$PSModuleDevelopmentModuleRoot\scripts\postload.ps1"
49+
. Import-PSMDFile -Path "$PSModuleDevelopmentModuleRoot\internal\scripts\postload.ps1"

PSModuleDevelopment/PSModuleDevelopment.psproj

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
<Folders>
66
<Folder>en-us</Folder>
77
<Folder>functions</Folder>
8-
<Folder>scripts</Folder>
8+
<Folder>internal\scripts</Folder>
99
<Folder>xml</Folder>
1010
<Folder>functions\utility</Folder>
1111
<Folder>functions\moduledebug</Folder>
1212
<Folder>functions\performance</Folder>
1313
<Folder>functions\help</Folder>
1414
<Folder>snippets</Folder>
15+
<Folder>functions\wix</Folder>
16+
<Folder>internal</Folder>
17+
<Folder>internal\configurations</Folder>
1518
</Folders>
1619
<Files>
1720
<File Build="2">PSModuleDevelopment.psd1</File>
1821
<File Build="0">PSModuleDevelopment.psm1</File>
19-
<File Build="2" Shared="True" ReferenceFunction="Invoke-preload_ps1">scripts\preload.ps1</File>
20-
<File Build="2" Shared="True" ReferenceFunction="Invoke-postload_ps1">scripts\postload.ps1</File>
22+
<File Build="2" Shared="True" ReferenceFunction="Invoke-preload_ps1">internal\scripts\preload.ps1</File>
23+
<File Build="2" Shared="True" ReferenceFunction="Invoke-postload_ps1">internal\scripts\postload.ps1</File>
2124
<File Build="2" Shared="True" ReferenceFunction="Invoke-Restart-Shell_ps1">functions\utility\Restart-Shell.ps1</File>
2225
<File Build="2" Shared="True" ReferenceFunction="Invoke-Set-ModuleDebug_ps1">functions\moduledebug\Set-ModuleDebug.ps1</File>
2326
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-ModuleDebug_ps1">functions\moduledebug\Get-ModuleDebug.ps1</File>
@@ -28,6 +31,13 @@
2831
<File Build="2" Shared="False" ReferenceFunction="Invoke-New-PssModuleProject_ps1">functions\utility\New-PssModuleProject.ps1</File>
2932
<File Build="2">en-us\about_psmoduledevelopment.help.txt</File>
3033
<File Build="2" Shared="False" ReferenceFunction="Invoke-Set-PSMDModulePath_ps1">functions\utility\Set-PSMDModulePath.ps1</File>
34+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-PSMDWixConfig_ps1">functions\wix\Get-PSMDWixConfig.ps1</File>
35+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Set-PSMDWixConfig_ps1">functions\wix\Set-PSMDWixConfig.ps1</File>
36+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Invoke-PSMDWixBuild_ps1">functions\wix\Invoke-PSMDWixBuild.ps1</File>
37+
<File Build="2" Shared="False" ReferenceFunction="Invoke-Invoke-PSMDWixBuild2_ps1">functions\wix\Invoke-PSMDWixBuild2.ps1</File>
38+
<File Build="2" Shared="False" ReferenceFunction="Invoke-wix_ps1">internal\configurations\wix.ps1</File>
39+
<File Build="2" Shared="False" ReferenceFunction="Invoke-debug_ps1">internal\configurations\debug.ps1</File>
40+
<File Build="2" Shared="False" ReferenceFunction="Invoke-license_ps1">internal\scripts\license.ps1</File>
3141
</Files>
3242
<StartupScript>F:\Synchronized Data\Scripte\Powershell Studio\Projects\PSModuleDevelopment\Test-Module.ps1</StartupScript>
3343
</Project>
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Function Get-PSMDWixConfig
2+
{
3+
[Cmdletbinding()]
4+
Param (
5+
[Parameter(Mandatory = $false)]
6+
[string]
7+
$Path = (Get-Location).Path,
8+
9+
[Parameter(Mandatory = $false)]
10+
[switch]
11+
$ProductShortName,
12+
13+
[Parameter(Mandatory = $false)]
14+
[switch]
15+
$ProductName,
16+
17+
[Parameter(Mandatory = $false)]
18+
[switch]
19+
$ProductVersion,
20+
21+
[Parameter(Mandatory = $false)]
22+
[switch]
23+
$Manufacturer,
24+
25+
[Parameter(Mandatory = $false)]
26+
[switch]
27+
$HelpLink,
28+
29+
[Parameter(Mandatory = $false)]
30+
[switch]
31+
$AboutLink,
32+
33+
[Parameter(Mandatory = $false)]
34+
[switch]
35+
$UpgradeCodeX86,
36+
37+
[Parameter(Mandatory = $false)]
38+
[switch]
39+
$UpgradeCodeX64
40+
)
41+
42+
$file = Get-WixAbsolutePath((Join-Path $Path '.wix.json'))
43+
$leaf = Split-Path $Path -Leaf
44+
$defaults = @{
45+
'ProductShortName' = $leaf;
46+
'ProductName' = $leaf;
47+
'ProductVersion' = '1.0.0';
48+
'Manufacturer' = $leaf;
49+
'HelpLink' = "http://www.google.com/q=${leaf}";
50+
'AboutLink' = "http://www.google.com/q=${leaf}";
51+
'UpgradeCodeX86' = ([System.Guid]::NewGuid().ToString().ToUpper());
52+
'UpgradeCodeX64' = ([System.Guid]::NewGuid().ToString().ToUpper())
53+
}
54+
$settings = New-Object -TypeName PSCustomObject
55+
$readSettings = New-Object -TypeName PSCustomObject
56+
$params = $PSBoundParameters.GetEnumerator() | Where-Object { ($_.Key -ne 'Path') }
57+
58+
# Make sure we have persistent upgrade codes
59+
if (Test-Path $file)
60+
{
61+
try
62+
{
63+
$readSettings = Get-Content -Raw $file | ConvertFrom-Json
64+
}
65+
catch { }
66+
}
67+
If (!$readSettings.UpgradeCodeX86 -or !$readSettings.UpgradeCodeX64)
68+
{
69+
If (!$readSettings.UpgradeCodeX86)
70+
{
71+
Add-Member -InputObject $readSettings -MemberType NoteProperty -Name UpgradeCodeX86 -Value ([System.Guid]::NewGuid().ToString().ToUpper())
72+
}
73+
If (!$readSettings.UpgradeCode64)
74+
{
75+
Add-Member -InputObject $readSettings -MemberType NoteProperty -Name UpgradeCodeX64 -Value ([System.Guid]::NewGuid().ToString().ToUpper())
76+
}
77+
#$readsettings
78+
$null = (New-Item -ItemType Directory -Force -Path (Split-Path $file))
79+
$readSettings | ConvertTo-JSON | Out-File -Encoding utf8 $file
80+
}
81+
82+
if (Test-Path $file)
83+
{
84+
try
85+
{
86+
$readSettings = Get-Content -Raw $file | ConvertFrom-Json
87+
}
88+
catch { }
89+
}
90+
foreach ($parameter in $params)
91+
{
92+
$setting = $parameter.Key.ToLower()
93+
$value = $parameter.Value
94+
if ($value)
95+
{
96+
if ($readSettings.$setting)
97+
{
98+
Add-Member -InputObject $settings -MemberType NoteProperty -Name $setting -Value $readSettings.$setting
99+
}
100+
elseif ($defaults.$setting)
101+
{
102+
Add-Member -InputObject $settings -MemberType NoteProperty -Name $setting -Value $defaults.$setting
103+
}
104+
else
105+
{
106+
Add-Member -InputObject $settings -MemberType NoteProperty -Name $setting -Value (Read-Host "$setting")
107+
}
108+
}
109+
}
110+
if ($params.count -eq 0)
111+
{
112+
foreach ($default in $defaults.GetEnumerator())
113+
{
114+
$setting = $default.Name
115+
$value = $default.Value
116+
Add-Member -InputObject $settings -MemberType NoteProperty -Name $setting -Value $value -Force
117+
}
118+
$readSettings.PSObject.Properties | foreach-object {
119+
$setting = $_.Name
120+
$value = $_.Value
121+
Add-Member -InputObject $settings -MemberType NoteProperty -Name $setting -Value $value -Force
122+
}
123+
}
124+
Return $settings
125+
}

0 commit comments

Comments
 (0)