Skip to content

Commit 9568aef

Browse files
committed
initial checkin
0 parents  commit 9568aef

File tree

142 files changed

+18871
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+18871
-0
lines changed

.github/workflows/release.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish release
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger on pushes to the main branch
7+
8+
jobs:
9+
publish_release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Create Version
19+
uses: dexwritescode/release-on-merge-action@v1 # Or another suitable action
20+
id: version_tracker
21+
with:
22+
version-increment-strategy: patch
23+
dry-run: true
24+
initial-version: '1.0.0'
25+
26+
- name: Modify the file
27+
run: |
28+
perl -pi -e 's/0\.0\.0/${{ steps.version_tracker.outputs.version }}' DevSetup.psd1
29+
30+
- name: Commit and push changes
31+
uses: stefanzweifel/git-auto-commit-action@v5
32+
with:
33+
commit_message: "Automated Release Tagging for ${{ steps.version_tracker.outputs.version }} in DevSetup.psd1"
34+
branch: main
35+
36+
- name: Create Tagged Release
37+
uses: dexwritescode/release-on-merge-action@v1 # Or another suitable action
38+
with:
39+
version-increment-strategy: patch

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# devsetup
2+
A tool used to setup dev environments

coverage.xml

Lines changed: 3706 additions & 0 deletions
Large diffs are not rendered by default.

devsetup/DevSetup.psd1

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#
2+
# Module manifest for module 'DevSetup'
3+
#
4+
# Generated by: Joshua Wilson
5+
#
6+
# Generated on: 7/31/2025
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'DevSetup.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '0.0.0'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = '316f7319-7063-492b-a5d3-dc32c616f157'
22+
23+
# Author of this module
24+
Author = 'Joshua Wilson'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'PwshDevs'
28+
29+
# Copyright statement for this module
30+
Copyright = '(c) 2025 PwshDevs. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
Description = ''
34+
35+
# Minimum version of the PowerShell engine required by this module
36+
PowerShellVersion = '5.1'
37+
38+
# Name of the PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# ClrVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
RequiredModules = @('powershell-yaml', 'VSSetup', 'PowerShellForGitHub', 'EZlog')
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
# FormatsToProcess = @()
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72+
FunctionsToExport = @(
73+
'Use-DevSetup'
74+
)
75+
76+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
77+
CmdletsToExport = @()
78+
79+
# Variables to export from this module
80+
VariablesToExport = @()
81+
82+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
83+
AliasesToExport = @('devsetup')
84+
85+
# DSC resources to export from this module
86+
# DscResourcesToExport = @()
87+
88+
# List of all modules packaged with this module
89+
# ModuleList = @()
90+
91+
# List of all files packaged with this module
92+
# FileList = @()
93+
94+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
95+
PrivateData = @{
96+
97+
PSData = @{
98+
99+
# Tags applied to this module. These help with module discovery in online galleries.
100+
Tags = @('BuildTools', 'Toolchain', 'Build', 'Automation', 'Package', 'Management', 'CMake', 'MSBuild', 'NMake', 'B2', 'Chocolatey', 'MySQL', 'Development')
101+
102+
# A URL to the license for this module.
103+
# LicenseUri = ''
104+
105+
# A URL to the main website for this project.
106+
ProjectUri = 'https://github.com/pwshdevs/devsetup'
107+
108+
# A URL to the main environments website for this project.
109+
EnvironmentsProjectUri = 'https://github.com/pwshdevs/devsetup.environments'
110+
111+
# A URL to an icon representing this module.
112+
# IconUri = ''
113+
114+
# ReleaseNotes of this module
115+
ReleaseNotes = ''
116+
117+
# Prerelease string of this module
118+
# Prerelease = ''
119+
120+
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
121+
# RequireLicenseAcceptance = $false
122+
123+
# External dependent modules of this module
124+
# ExternalModuleDependencies = @()
125+
126+
} # End of PSData hashtable
127+
128+
} # End of PrivateData hashtable
129+
130+
# HelpInfo URI of this module
131+
# HelpInfoURI = ''
132+
133+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
134+
# DefaultCommandPrefix = ''
135+
136+
}

devsetup/DevSetup.psm1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# DevSetup PowerShell Module
2+
3+
# Get the current module path
4+
$ModulePath = $PSScriptRoot
5+
6+
# Get all function files from both Private and Public directories, excluding test files
7+
$PrivateFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
8+
$PrivateUtilsFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private\Utils") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
9+
$PrivateProvidersFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private\Providers") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
10+
$PrivateCommandsFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private\Commands") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
11+
$Private3rdpartyFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private\3rdparty") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
12+
$PrivateEnumsFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Private\Enums") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
13+
$PublicFunctions = Get-ChildItem -Path (Join-Path $ModulePath "Public") -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike "*Tests.ps1" }
14+
15+
# Combine all function files
16+
$AllFunctions = @()
17+
if ($PrivateFunctions) { $AllFunctions += $PrivateFunctions }
18+
if ($PrivateUtilsFunctions) { $AllFunctions += $PrivateUtilsFunctions }
19+
if ($PrivateProvidersFunctions) { $AllFunctions += $PrivateProvidersFunctions }
20+
if ($PrivateCommandsFunctions) { $AllFunctions += $PrivateCommandsFunctions }
21+
if ($Private3rdpartyFunctions) { $AllFunctions += $Private3rdpartyFunctions }
22+
if ($PrivateEnumsFunctions) { $AllFunctions += $PrivateEnumsFunctions }
23+
if ($PublicFunctions) { $AllFunctions += $PublicFunctions }
24+
25+
# Import all functions
26+
foreach ($FunctionFile in $AllFunctions) {
27+
try {
28+
. $FunctionFile.FullName
29+
Write-Verbose "Imported function from: $($FunctionFile.Name)"
30+
}
31+
catch {
32+
Write-Error "Failed to import function from $($FunctionFile.Name): $_"
33+
}
34+
}
35+
36+
# Initialize global variables
37+
if (-not $global:InstalledPackages) {
38+
$global:InstalledPackages = @()
39+
}
40+
41+
if (-not $global:InstalledPackagesFile) {
42+
$global:InstalledPackagesFile = $null
43+
}
44+
45+
New-Alias -Name devsetup -Value Use-DevSetup
46+
47+
# Export module members (functions will be exported via the manifest)
48+
Write-Verbose "DevSetup module loaded successfully. $($AllFunctions.Count) functions imported ($($PrivateFunctions.Count) private, $($PrivateUtilsFunctions.Count) utils, $($PrivateProvidersFunctions.Count) providers, $($PrivateCommandsFunctions.Count) commands, $($Private3rdpartyFunctions.Count) 3rdparty, $($PublicFunctions.Count) public)."
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
BeforeAll {
2+
. $PSScriptRoot\ConvertFrom-3rdPartyInstall.ps1
3+
. $PSScriptRoot\..\..\..\DevSetup\Private\3rdParty\VisualStudio\ConvertFrom-VisualStudioInstall.ps1
4+
. $PSScriptRoot\..\..\..\DevSetup\Private\3rdParty\VisualStudioCode\ConvertFrom-VisualStudioCodeInstall.ps1
5+
Mock Write-Host { }
6+
Mock Write-Warning { }
7+
Mock ConvertFrom-VisualStudioInstall { $true }
8+
Mock ConvertFrom-VisualStudioCodeInstall { $true }
9+
}
10+
11+
Describe "ConvertFrom-3rdPartyInstall" {
12+
13+
Context "When both conversions succeed" {
14+
It "Should not write any warnings" {
15+
$result = ConvertFrom-3rdPartyInstall -Config "test"
16+
Assert-MockCalled Write-Warning -Exactly 0 -Scope It
17+
Assert-MockCalled Write-Host -Exactly 2 -Scope It
18+
}
19+
}
20+
21+
Context "When Visual Studio conversion fails" {
22+
It "Should write a warning for Visual Studio" {
23+
Mock ConvertFrom-VisualStudioInstall { $false }
24+
Mock ConvertFrom-VisualStudioCodeInstall { $true }
25+
$result = ConvertFrom-3rdPartyInstall -Config "test"
26+
Assert-MockCalled Write-Warning -Exactly 1 -Scope It -ParameterFilter { $Message -match "Visual Studio installations" }
27+
Assert-MockCalled Write-Host -Exactly 2 -Scope It
28+
}
29+
}
30+
31+
Context "When Visual Studio Code conversion fails" {
32+
It "Should write a warning for Visual Studio Code" {
33+
Mock ConvertFrom-VisualStudioInstall { $true }
34+
Mock ConvertFrom-VisualStudioCodeInstall { $false }
35+
$result = ConvertFrom-3rdPartyInstall -Config "test"
36+
Assert-MockCalled Write-Warning -Exactly 1 -Scope It -ParameterFilter { $Message -match "Visual Studio Code installation" }
37+
Assert-MockCalled Write-Host -Exactly 2 -Scope It
38+
}
39+
}
40+
41+
Context "When both conversions fail" {
42+
It "Should write warnings for both" {
43+
Mock ConvertFrom-VisualStudioInstall { $false }
44+
Mock ConvertFrom-VisualStudioCodeInstall { $false }
45+
$result = ConvertFrom-3rdPartyInstall -Config "test"
46+
Assert-MockCalled Write-Warning -Exactly 2 -Scope It
47+
Assert-MockCalled Write-Host -Exactly 2 -Scope It
48+
}
49+
}
50+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Function ConvertFrom-3rdPartyInstall {
2+
Param(
3+
[string]$Config
4+
)
5+
6+
# Convert from Visual Studio installations
7+
Write-Host "`nScanning Visual Studio installations..." -ForegroundColor Cyan
8+
if (-not (ConvertFrom-VisualStudioInstall -Config $Config)) {
9+
Write-Warning "Failed to convert Visual Studio installations, but continuing..."
10+
}
11+
12+
# Convert from Visual Studio Code installations
13+
Write-Host "`nScanning Visual Studio Code installation..." -ForegroundColor Cyan
14+
if (-not (ConvertFrom-VisualStudioCodeInstall -Config $Config)) {
15+
Write-Warning "Failed to convert Visual Studio Code installation, but continuing..."
16+
}
17+
}

0 commit comments

Comments
 (0)