Skip to content

Commit 464046d

Browse files
committed
first commit
0 parents  commit 464046d

380 files changed

Lines changed: 42126 additions & 0 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# retain windows line-endings in case checked out on mac or linux
2+
* text eol=crlf
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ignore any temp directory (used in build steps)
2+
temp/
3+
4+
# PSGallery publishing file can contain personal API key and paths and thus we want to ignore it if it exists
5+
.psgallery
6+
7+
# The persistent build environment xml files can contain API keys or other information you may not want to share
8+
*.buildenvironment.xml
9+
*.buildenvironment.json
10+
11+
# Just in case I'm a few screws loose and leave a copy of this in any project directory, ignore it.
12+
psgalleryapi.txt
13+
14+
# Others you probably don't want or need to be public
15+
~$*
16+
*~
17+
*.pfx
18+
19+
#############
20+
## Windows detritus
21+
#############
22+
23+
# Windows image file caches
24+
Thumbs.db
25+
ehthumbs.db
26+
27+
# Folder config file
28+
Desktop.ini
29+
30+
# Recycle Bin used on file shares
31+
$RECYCLE.BIN/
32+
33+
# Mac crap
34+
.DS_Store

.vscode/launch.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
5+
{
6+
"type": "PowerShell",
7+
"request": "launch",
8+
"name": "PowerShell Launch Pester Tests",
9+
"script": "Invoke-Pester",
10+
"args": [],
11+
"cwd": "${workspaceRoot}/test"
12+
},
13+
{
14+
"type": "PowerShell",
15+
"request": "launch",
16+
"name": "PowerShell Launch (current file)",
17+
"program": "${file}",
18+
"args": [],
19+
"cwd": "${file}"
20+
},
21+
{
22+
"type": "PowerShell",
23+
"request": "attach",
24+
"name": "PowerShell Attach to Host Process",
25+
"processId": "${command:PickPSHostProcess}",
26+
"runspaceId": 1
27+
}
28+
]
29+
}

.vscode/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
//-------- Files configuration --------
3+
4+
// When enabled, will trim trailing whitespace when you save a file.
5+
"files.trimTrailingWhitespace": true,
6+
7+
"search.exclude": {
8+
"Release": true
9+
},
10+
11+
//-------- PowerShell Configuration --------
12+
13+
// Use a custom PowerShell Script Analyzer settings file for this workspace.
14+
// Relative paths for this setting are always relative to the workspace root dir.
15+
"powershell.scriptAnalysis.settingsPath": "ScriptAnalyzerSettings.psd1"
16+
}

.vscode/tasks.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Available variables which can be used inside of strings.
2+
// ${workspaceRoot}: the root folder of the team
3+
// ${file}: the current opened file
4+
// ${relativeFile}: the current opened file relative to workspaceRoot
5+
// ${fileBasename}: the current opened file's basename
6+
// ${fileDirname}: the current opened file's dirname
7+
// ${fileExtname}: the current opened file's extension
8+
// ${cwd}: the current working directory of the spawned process
9+
{
10+
// See https://go.microsoft.com/fwlink/?LinkId=733558
11+
// for the documentation about the tasks.json format
12+
"version": "2.0.0",
13+
14+
// Start PowerShell
15+
"windows": {
16+
"command": "powershell.exe",
17+
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ]
18+
},
19+
"linux": {
20+
"command": "/usr/bin/powershell",
21+
"args": [ "-NoProfile" ]
22+
},
23+
"osx": {
24+
"command": "/usr/local/bin/powershell",
25+
"args": [ "-NoProfile" ]
26+
},
27+
28+
// Show the output window always
29+
"showOutput": "always",
30+
31+
"tasks": [
32+
{
33+
"taskName": "Build",
34+
"suppressTaskName": true,
35+
"isBuildCommand": true,
36+
"args": [
37+
"${workspaceRoot}\\Build.ps1"
38+
]
39+
},
40+
{
41+
"taskName": "PublishPSGallery",
42+
"suppressTaskName": true,
43+
"args": [
44+
"Invoke-Build -Task PublishPSGallery"
45+
]
46+
},
47+
{
48+
"taskName": "Analyze",
49+
"suppressTaskName": true,
50+
"args": [
51+
"Invoke-Build -Task AnalyzePublic"
52+
]
53+
},
54+
{
55+
"taskName": "InsertMissingCBH",
56+
"suppressTaskName": true,
57+
"args": [
58+
"Invoke-Build InsertMissingCBH"
59+
]
60+
},
61+
{
62+
"taskName": "Test",
63+
"suppressTaskName": true,
64+
"isTestCommand": true,
65+
"showOutput": "always",
66+
"args": [
67+
"Write-Host 'Invoking Pester'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};",
68+
"Invoke-Command { Write-Host 'Completed Test task in task runner.' }"
69+
],
70+
"problemMatcher": [
71+
{
72+
"owner": "powershell",
73+
"fileLocation": ["absolute"],
74+
"severity": "error",
75+
"pattern": [
76+
{
77+
"regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$",
78+
"message": 1
79+
},
80+
{
81+
"regexp": "^\\s+at\\s+[^,]+,\\s*(.*?):\\s+line\\s+(\\d+)$",
82+
"file": 1,
83+
"line": 2
84+
}
85+
]
86+
}
87+
]
88+
}
89+
]
90+
}

Build.ps1

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#Requires -Version 5
2+
[CmdletBinding(DefaultParameterSetName = 'Build')]
3+
param (
4+
[parameter(Position = 0, ParameterSetName = 'Build')]
5+
[switch]$BuildModule,
6+
[parameter(Position = 1, ParameterSetName = 'Build')]
7+
[switch]$UpdateRelease,
8+
[parameter(Position = 2, ParameterSetName = 'Build')]
9+
[switch]$UploadPSGallery,
10+
[parameter(Position = 3, ParameterSetName = 'Build')]
11+
[switch]$GitCheckin,
12+
[parameter(Position = 4, ParameterSetName = 'Build')]
13+
[switch]$GitPush,
14+
[parameter(Position = 5, ParameterSetName = 'Build')]
15+
[switch]$InstallAndTestModule,
16+
[parameter(Position = 6, ParameterSetName = 'Build')]
17+
[version]$NewVersion,
18+
[parameter(Position = 7, ParameterSetName = 'Build')]
19+
[string]$ReleaseNotes,
20+
[parameter(Position = 8, ParameterSetName = 'CBH')]
21+
[switch]$InsertCBH
22+
)
23+
24+
function PrerequisitesLoaded {
25+
# Install required modules if missing
26+
try {
27+
if ((get-module InvokeBuild -ListAvailable) -eq $null) {
28+
Write-Output "Attempting to install the InvokeBuild module..."
29+
$null = Install-Module InvokeBuild -Scope:CurrentUser
30+
}
31+
if (get-module InvokeBuild -ListAvailable) {
32+
Write-Output -NoNewLine "Importing InvokeBuild module"
33+
Import-Module InvokeBuild -Force
34+
Write-Output '...Loaded!'
35+
return $true
36+
}
37+
else {
38+
return $false
39+
}
40+
}
41+
catch {
42+
return $false
43+
}
44+
}
45+
46+
function CleanUp {
47+
try {
48+
Write-Output ''
49+
Write-Output 'Attempting to clean up the session (loaded modules and such)...'
50+
Invoke-Build -Task BuildSessionCleanup
51+
Remove-Module InvokeBuild
52+
}
53+
catch {}
54+
}
55+
56+
if (-not (PrerequisitesLoaded)) {
57+
throw 'Unable to load InvokeBuild!'
58+
}
59+
60+
switch ($psCmdlet.ParameterSetName) {
61+
'CBH' {
62+
if ($InsertCBH) {
63+
try {
64+
Invoke-Build -Task InsertMissingCBH
65+
}
66+
catch {
67+
throw
68+
}
69+
}
70+
71+
CleanUp
72+
}
73+
'Build' {
74+
if ($NewVersion -ne $null) {
75+
try {
76+
Invoke-Build -Task NewVersion -NewVersion $NewVersion
77+
}
78+
catch {
79+
throw $_
80+
}
81+
}
82+
# Update your release version?
83+
if ($UpdateRelease) {
84+
try {
85+
Invoke-Build -Task UpdateRelease -ReleaseNotes $ReleaseNotes
86+
}
87+
catch {
88+
throw $_
89+
}
90+
}
91+
92+
# If no parameters were specified or the build action was manually specified then kick off a standard build
93+
if (($psboundparameters.count -eq 0) -or ($BuildModule)) {
94+
try {
95+
Invoke-Build
96+
}
97+
catch {
98+
Write-Output 'Build Failed with the following error:'
99+
Write-Output $_
100+
}
101+
}
102+
103+
# Install and test the module?
104+
if ($InstallAndTestModule) {
105+
try {
106+
Invoke-Build -Task InstallAndTestModule
107+
}
108+
catch {
109+
Write-Output 'Install and test of module failed:'
110+
Write-Output $_
111+
}
112+
}
113+
114+
# Upload to gallery?
115+
if ($UploadPSGallery) {
116+
try {
117+
Invoke-Build -Task PublishPSGallery
118+
}
119+
catch {
120+
throw 'Unable to upload project to the PowerShell Gallery!'
121+
}
122+
}
123+
124+
# Not implemented yet
125+
if ($GitCheckin) {
126+
# Finish me
127+
}
128+
129+
# Not implemented yet
130+
if ($GitPush) {
131+
# Finish me
132+
}
133+
134+
CleanUp
135+
}
136+
}

Install.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Run this in an administrative PowerShell prompt to install the ModuleBuild PowerShell module:
2+
#
3+
# iex (New-Object Net.WebClient).DownloadString("https://github.com/zloeber/ModuleBuild/raw/master/Install.ps1")
4+
5+
# Some general variables
6+
$ModuleName = 'ModuleBuild'
7+
$DownloadURL = 'https://github.com/zloeber/ModuleBuild/raw/master/release/ModuleBuild-current.zip'
8+
9+
# Download and install the module
10+
$webclient = New-Object System.Net.WebClient
11+
$file = "$($env:TEMP)\$($ModuleName).zip"
12+
13+
Write-Host "Downloading latest version of $ModuleName from $DownloadURL" -ForegroundColor Cyan
14+
$webclient.DownloadFile($DownloadURL,$file)
15+
Write-Host "File saved to $file" -ForegroundColor Green
16+
$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules\$($ModuleName)"
17+
$null = New-Item -ItemType Directory -Force -Path $targetondisk
18+
$shell_app=new-object -com shell.application
19+
$zip_file = $shell_app.namespace($file)
20+
Write-Host "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cyan
21+
$destination = $shell_app.namespace($targetondisk)
22+
$destination.Copyhere($zip_file.items(), 0x10)
23+
24+
Write-Host "Module has been installed!" -ForegroundColor Green
25+
Write-Host "You can now import the module with: Import-Module -Name $ModuleName"

License.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<p><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>, please attribute to Zachary Loeber.</p>
2+
3+
<h6><a id="user-content-you-are-free-to" class="anchor" href="#you-are-free-to" aria-hidden="true"><span class="octicon octicon-link"></span></a>You are free to:</h6>
4+
5+
<p><strong>Share</strong> — copy and redistribute the material in any medium or format</p>
6+
7+
<p><strong>Adapt</strong> — remix, transform, and build upon the material </p>
8+
9+
<p>The authors encourage you to redistribute this content as widely as possible, but require that you give credit to the primary authors above, and that you notify us on github of any improvements you make.</p>

0 commit comments

Comments
 (0)