Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-563) Merge PowerShell Scripts into shippable Modules on build #565

Merged
merged 6 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ branches:
- /hotfix/.*/

artifacts:
- path: '.\BuildArtifacts\Boxstarter.*.zip'
- path: '.\BuildArtifacts\Boxstarter.*.nupkg'
- path: '.\buildArtifacts\Boxstarter.*.zip'
- path: '.\buildArtifacts\Boxstarter.*.nupkg'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Bootstrapper/*-BoxstarterMessage.ps1
Helpers/*-BoxstarterMessage.ps1
Helpers/*-TimedSection.ps1
Bootstrapper/*-TimedSection.ps1
BuildArtifacts
buildArtifacts
obj
bin
*.user
Expand Down
11 changes: 9 additions & 2 deletions Boxstarter.Azure/Boxstarter.Azure.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'Provides Cmdlets that will install a boxstarter package on a Wind
ModuleToProcess = './Boxstarter.Azure.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e59'
Expand All @@ -31,7 +31,14 @@ NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1','..\Boxstarter.C
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'
CmdletsToExport = @(
'Enable-BoxstarterVM,'
'Get-AzureVMCheckpoint',
'Remove-AzureVMCheckpoint',
'Restore-AzureVMCheckpoint',
'Set-AzureVMCheckpoint',
'Test-VMStarted'
)

# Variables to export from this module
VariablesToExport = '*'
Expand Down
13 changes: 5 additions & 8 deletions Boxstarter.Azure/Boxstarter.Azure.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ if ($PSVersionTable.Platform -eq 'Windows') {

$unNormalized=(Get-Item "$PSScriptRoot\..\Boxstarter.Chocolatey\Boxstarter.Chocolatey.psd1")
Import-Module $unNormalized.FullName -global -DisableNameChecking -Force
Resolve-Path $PSScriptRoot\*-*.ps1 |
% { . $_.ProviderPath }

# Resolve-Path $PSScriptRoot\*-*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during build

# --- INCLUDE *.ps1

#There is a bug where the storage module will not load if loaded after the azure module
try {Get-Module Storage -ListAvailable | Import-Module -global} catch { Log-BoxstarterMessage $_ }

Import-AzureModule

Export-ModuleMember Enable-BoxstarterVM,`
Get-AzureVMCheckpoint,`
Remove-AzureVMCheckpoint,`
Restore-AzureVMCheckpoint,`
Set-AzureVMCheckpoint,`
Test-VMStarted
16 changes: 14 additions & 2 deletions Boxstarter.Bootstrapper/Boxstarter.Bootstrapper.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'Provides an unattended installation environment supporting automa
ModuleToProcess = './Boxstarter.Bootstrapper.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e50'
Expand All @@ -28,7 +28,19 @@ NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1')
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'
CmdletsToExport = @(
'Invoke-Boxstarter',
'Test-PendingReboot',
'Invoke-Reboot',
'Write-BoxstarterMessage',
'Start-TimedSection',
'Stop-TimedSection',
'Out-Boxstarter',
'Enter-BoxstarterLogable',
'Get-BoxstarterTempDir',
'Install-BoxstarterExtenson'
)


# Variables to export from this module
VariablesToExport = '*'
Expand Down
15 changes: 3 additions & 12 deletions Boxstarter.Bootstrapper/Boxstarter.Bootstrapper.psm1
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
Resolve-Path $PSScriptRoot\*.ps1 |
% { . $_.ProviderPath }
# Resolve-Path $PSScriptRoot\*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during build
# --- INCLUDE *.ps1

Import-Module (Join-Path $Boxstarter.BaseDir Boxstarter.WinConfig\Boxstarter.WinConfig.psd1) -global -DisableNameChecking

Export-ModuleMember Invoke-Boxstarter, `
Test-PendingReboot, `
Invoke-Reboot, `
Write-BoxstarterMessage, `
Start-TimedSection, `
Stop-TimedSection, `
Out-Boxstarter, `
Enter-BoxstarterLogable, `
Get-BoxstarterTempDir, `
Install-BoxstarterExtension
26 changes: 22 additions & 4 deletions Boxstarter.Chocolatey/Boxstarter.Chocolatey.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'Provides a robust environment capable of automatic reboots and se
ModuleToProcess = './Boxstarter.Chocolatey.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e51'
Expand All @@ -25,16 +25,34 @@ DotNetFrameworkVersion = '2.0'
NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1')

# Functions to export from this module
FunctionsToExport = '*'

FunctionsToExport = @(
'Get-BoxstarterConfig',
'Get-PackageRoot',
'Enable-BoxstarterClientRemoting',
'Enable-BoxstarterCredSSP',
'Export-BoxstarterVars',
'Install-ChocolateyInstallPackageOverride',
'Invoke-BoxstarterBuild',
'Invoke-BoxstarterFromTask',
'Invoke-Chocolatey',
'Invoke-ChocolateyBoxstarter',
'Install-BoxstarterPackage',
'New-BoxstarterPackage',
'New-PackageFromScript',
'Register-ChocolateyInterception',
'Resolve-VMPlugin',
'Set-BoxstarterConfig',
'Set-BoxstarterShare',
'Write-HostOverride'
)
# Cmdlets to export from this module
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module
AliasesToExport = '*'
AliasesToExport = @('Enable-BoxstarterVM', 'Install-ChocolateyInstallPackage', 'Write-Host')

# List of all modules packaged with this module.
# ModuleList = @()
Expand Down
43 changes: 12 additions & 31 deletions Boxstarter.Chocolatey/Boxstarter.Chocolatey.psm1
Original file line number Diff line number Diff line change
@@ -1,39 +1,20 @@
param(
[parameter(Position=0,Mandatory=$false)][boolean]$ExportCommands=$false
[parameter(Position = 0, Mandatory = $false)][boolean]$ExportCommands = $false
)
if(!$Global:Boxstarter) { $Global:Boxstarter = @{} }
if(!$Boxstarter.ContainsKey('RebootOk')) { $Boxstarter.RebootOk=$true }
if (!$Global:Boxstarter) { $Global:Boxstarter = @{} }
if (!$Boxstarter.ContainsKey('RebootOk')) { $Boxstarter.RebootOk = $true }

$unNormalized=(Get-Item "$PSScriptRoot\..\Boxstarter.Bootstrapper\Boxstarter.Bootstrapper.psd1")
Import-Module $unNormalized.FullName -global -DisableNameChecking
Resolve-Path $PSScriptRoot\*.ps1 |
% { . $_.ProviderPath }
$unNormalized = (Get-Item "$PSScriptRoot\..\Boxstarter.Bootstrapper\Boxstarter.Bootstrapper.psd1")
Import-Module $unNormalized.FullName -Global -DisableNameChecking

if($ExportCommands) {

# Resolve-Path $PSScriptRoot\*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during build

# --- INCLUDE *.ps1

if ($ExportCommands) {
Import-BoxstarterVars
Export-ModuleMember cinst, cup, choco
}

Export-ModuleMember Get-BoxstarterConfig,`
Get-PackageRoot,`
Enable-BoxstarterClientRemoting,`
Enable-BoxstarterCredSSP,`
Export-BoxstarterVars,`
Install-ChocolateyInstallPackageOverride,`
Invoke-BoxstarterBuild,`
Invoke-BoxstarterFromTask,`
Invoke-Chocolatey,`
Invoke-ChocolateyBoxstarter,`
Install-BoxstarterPackage,`
New-BoxstarterPackage,`
New-PackageFromScript,`
Register-ChocolateyInterception,`
Resolve-VMPlugin,`
Set-BoxstarterConfig,`
Set-BoxstarterShare,`
Write-HostOverride

Export-ModuleMember -alias `
Enable-BoxstarterVM,`
Install-ChocolateyInstallPackage,`
Write-Host
6 changes: 3 additions & 3 deletions Boxstarter.ClickOnce/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[assembly: AssemblyProduct("Boxstarter.WebLaunch")]
[assembly: AssemblyCopyright("(c) 2018 - Present Chocolatey Software, Inc, 2012 - 2018 Matt Wrock")]
[assembly: AssemblyTrademark("8459d49a8d5a049d8936519ccf045706c7b3eb23")]
[assembly: AssemblyVersion("2.13.0")]
[assembly: AssemblyFileVersion("2.13.0")]
[assembly: AssemblyInformationalVersion("2.13.0")]
[assembly: AssemblyVersion("3.1.0")]
[assembly: AssemblyFileVersion("3.1.0")]
[assembly: AssemblyInformationalVersion("3.1.0")]
28 changes: 25 additions & 3 deletions Boxstarter.Common/Boxstarter.Common.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'Provides common functionality used by multiple Boxstarter Modules
ModuleToProcess = './Boxstarter.Common.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e51'
Expand All @@ -25,13 +25,35 @@ DotNetFrameworkVersion = '2.0'
# NestedModules = @()

# Functions to export from this module
FunctionsToExport = '*'
FunctionsToExport = @(
'Confirm-Choice',
'Create-BoxstarterTask',
'Enter-BoxstarterLogable',
flcdrg marked this conversation as resolved.
Show resolved Hide resolved
'Enter-DotNet4',
'Get-CurrentUser',
'Get-HttpResource',
'Get-IsMicrosoftUpdateEnabled',
'Get-IsRemote',
'Invoke-FromTask',
'Invoke-RetriableScript',
'Out-BoxstarterLog',
'Log-BoxstarterMessage',
'Remove-BoxstarterError',
'Remove-BoxstarterTask',
'Start-TimedSection',
'Stop-TimedSection',
'Test-Admin',
'Write-BoxstarterLogo',
'Write-BoxstarterMessage',
'Get-BoxstarterTaskContextTempDir'
)


# Cmdlets to export from this module
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = 'Boxstarter'

# Aliases to export from this module
AliasesToExport = '*'
Expand Down
27 changes: 3 additions & 24 deletions Boxstarter.Common/Boxstarter.Common.psm1
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
Resolve-Path $PSScriptRoot\*.ps1 |
% { . $_.ProviderPath }
# Resolve-Path $PSScriptRoot\*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during

Export-ModuleMember Confirm-Choice,`
Create-BoxstarterTask,`
Enter-BoxstarterLogable,`
Enter-DotNet4,`
Get-CurrentUser,`
Get-HttpResource,`
Get-IsMicrosoftUpdateEnabled,`
Get-IsRemote,`
Invoke-FromTask,`
Invoke-RetriableScript,`
Out-BoxstarterLog,`
Log-BoxstarterMessage,`
Remove-BoxstarterError,`
Remove-BoxstarterTask,`
Start-TimedSection,`
Stop-TimedSection,`
Test-Admin,`
Write-BoxstarterLogo,`
Write-BoxstarterMessage,`
Get-BoxstarterTaskContextTempDir

Export-ModuleMember -Variable Boxstarter
# --- INCLUDE *.ps1
4 changes: 2 additions & 2 deletions Boxstarter.HyperV/Boxstarter.HyperV.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'Provides Cmdlets that will install a Boxstarter package on a Hype
ModuleToProcess = './Boxstarter.HyperV.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = 'bbdb3e8b-9daf-4c00-a553-4f3f88fb6e58'
Expand All @@ -28,7 +28,7 @@ NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1','..\Boxstarter.C
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'
CmdletsToExport = @('Enable-BoxstarterVM', 'Enable-BoxstarterVHD')

# Variables to export from this module
VariablesToExport = '*'
Expand Down
6 changes: 3 additions & 3 deletions Boxstarter.HyperV/Boxstarter.HyperV.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$unNormalized=(Get-Item "$PSScriptRoot\..\Boxstarter.Chocolatey\Boxstarter.Chocolatey.psd1")
Import-Module $unNormalized.FullName -global -DisableNameChecking -Force
Resolve-Path $PSScriptRoot\*-*.ps1 |
% { . $_.ProviderPath }
# Resolve-Path $PSScriptRoot\*-*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during build
# --- INCLUDE *.ps1

Export-ModuleMember Enable-BoxstarterVM, Enable-BoxstarterVHD
18 changes: 16 additions & 2 deletions Boxstarter.TestRunner/Boxstarter.TestRunner.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description = 'The Boxstarter Test Runner module makes it easy to automate the t
ModuleToProcess = './Boxstarter.TestRunner.psm1'

# Version number of this module.
ModuleVersion = '2.13.0'
ModuleVersion = '3.1.0'

# ID used to uniquely identify this module
GUID = '087b5fe9-4a6e-40b5-a0fb-e670b86563b3'
Expand All @@ -28,7 +28,21 @@ NestedModules = @('..\Boxstarter.Common\Boxstarter.Common.psd1','..\Boxstarter.C
FunctionsToExport = '*'

# Cmdlets to export from this module
CmdletsToExport = '*'
CmdletsToExport = @(
'Get-BoxstarterDeployOptions',
'Set-BoxstarterDeployOptions',
'Test-BoxstarterPackage',
'Install-BoxstarterScripts',
'Get-BoxstarterPackage',
'Get-BoxstarterPackageNugetFeed',
'Set-BoxstarterPackageNugetFeed',
'Remove-BoxstarterPackageNugetFeed',
'Publish-BoxstarterPackages',
'Set-BoxstarterFeedAPIKey',
'Publish-BoxstarterPackage',
'Select-BoxstarterResultsToPublish',
'Get-BoxstarterFeedAPIKey'
)

# Variables to export from this module
VariablesToExport = '*'
Expand Down
7 changes: 3 additions & 4 deletions Boxstarter.TestRunner/Boxstarter.TestRunner.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Import-Module $unNormalized.FullName -global -DisableNameChecking -Force
$unNormalized=(Get-Item "$PSScriptRoot\..\Boxstarter.Azure\Boxstarter.Azure.psd1")
Import-Module $unNormalized.FullName -global -DisableNameChecking -Force -ErrorAction SilentlyContinue

Resolve-Path $PSScriptRoot\*-*.ps1 |
% { . $_.ProviderPath }

Export-ModuleMember Get-BoxstarterDeployOptions, Set-BoxstarterDeployOptions, Test-BoxstarterPackage, Install-BoxstarterScripts, Get-BoxstarterPackage, Get-BoxstarterPackageNugetFeed, Set-BoxstarterPackageNugetFeed, Remove-BoxstarterPackageNugetFeed, Publish-BoxstarterPackages, Set-BoxstarterFeedAPIKey, Publish-BoxstarterPackage, Select-BoxstarterResultsToPublish, Get-BoxstarterFeedAPIKey
# Resolve-Path $PSScriptRoot\*-*.ps1 | % { . $_.ProviderPath }
# we're not doing dot-sourcing anymore - "INCLUDE" all required files into this module during build
# --- INCLUDE *.ps1
Loading