From 65d7afa93e1527a81ab84a75794061bccde97d3d Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 9 Oct 2017 13:55:44 +1000 Subject: [PATCH] Initialization of the repo --- CHANGELOG.md | 10 ++ Examples/ConfigurationSample.Config | 20 +++ Examples/ConfigurationSample.ps1 | 12 ++ PSScriptHelper.Tests.ps1 | 0 PSScriptHelper.psd1 | Bin 0 -> 7876 bytes PSScriptHelper.psm1 | 198 ++++++++++++++++++++++++++++ README.md | 62 ++++++++- 7 files changed, 300 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 Examples/ConfigurationSample.Config create mode 100644 Examples/ConfigurationSample.ps1 create mode 100644 PSScriptHelper.Tests.ps1 create mode 100644 PSScriptHelper.psd1 create mode 100644 PSScriptHelper.psm1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3daaa2e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ + +## 1.0.0-rc (Aug 29, 2017) + + - Initialization of the module + +## Background + +This changelog is inspired by the +[Pester](https://raw.githubusercontent.com/pester/Pester/master/CHANGELOG.md) file which in turn was inspired by the [Vagrant](https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md) file. +Hopefully this will help keep the releases tidy and understandable. \ No newline at end of file diff --git a/Examples/ConfigurationSample.Config b/Examples/ConfigurationSample.Config new file mode 100644 index 0000000..8514984 --- /dev/null +++ b/Examples/ConfigurationSample.Config @@ -0,0 +1,20 @@ + + + + 1 + + + + smtpserver.com + healthcheck@dummy.com + itadmins@dummy.com + True + False + + + + \ No newline at end of file diff --git a/Examples/ConfigurationSample.ps1 b/Examples/ConfigurationSample.ps1 new file mode 100644 index 0000000..992be8e --- /dev/null +++ b/Examples/ConfigurationSample.ps1 @@ -0,0 +1,12 @@ +# +# Sample script of using the PSScriptHelper module +# +# Generated by: Matticusau +# +# Generated on: 29/08/2017 +# + +Import-Module -Name C:\GitHub\PSScriptHelper + +Get-ScriptConfig -ScriptPath . -ScriptName 'ConfigurationSample' -ScriptVersion '1.0' + diff --git a/PSScriptHelper.Tests.ps1 b/PSScriptHelper.Tests.ps1 new file mode 100644 index 0000000..e69de29 diff --git a/PSScriptHelper.psd1 b/PSScriptHelper.psd1 new file mode 100644 index 0000000000000000000000000000000000000000..fcd1a5ed5441a480396b9c4585db93ea40101ec5 GIT binary patch literal 7876 zcmeI1Yi}Dx6o%(B68~YPd`LkgZQ4>O5>lp&Mpl9EN&Ygj0j!-S>E+(OG=c)y#qRE5cED7rxW=nRYzY zXDnK0+Ow-)TX)s!x#+R_Zg?1Ohdbe0{od7eD|}O04TVSHw>aX|%9!D|%$0F^BrG%G zI1$3?jG^9{q`Jbo(CVH>5?2>`It@Q-9lvAEsLOOS;yKXTxn||^|6cP~k*#y{I!bk+ zosdYO@0oZyilc?bh7}}uzFjR}B zMvAblnN!V2USpv|l1=lAz}}C-t?)&ryS=cZaje8_=v4H0#$tcf6$?aXW9^T{vCA-y zl(ms$03T1nt6+4E-@YuUtJM#+@{WEtbbS!+$+9-WeT^`>A?!VU9>lx*8sE~2p=RIF z%%La@mpIfYe%)+kH3oG*3hO5a>a&08(&LYpY*Ljpgf5n}18qXz(sn(l5)+MP~ zc%$z;TW|aM!-;|WHN9M&v)Jt?S-`Ak;r`^Nf{1? z(N228VDG!K6>JoHIo8^FIM*|F?C;XVr{tztBe^bCvo2=gB}g8f;fmIs!OV^UbG!-geZL$ZKqHT@I1yu&?|3H;|s& zM;%G06-RR{Nm&7##tz7L)O=Ja+);~R^VB`?>U9$N!0H#bo{_9~uKDL|WR)n~%!d>;r?IaidcK=^>ydiB+b`WgremD@P#?<$_*rYjv; zM*S4Hn-Mjm&+C4#dQneQu=G37As>Hijip#t z#=lUUohwR~{iscAhl+@FWkgx)U2>k^N}rP@=Ty^Xuet6nVq7*EBs*Ts)_ni#VBU@P zO)rWE{WG}B7_Ni8>PvMWCEB3_I$~mk`3G6U`*7aoRaN;dbu}8L^F%hb-mLRL>#AMl z?X1VFTaHBqvZSM_^57m-?@af#+bCu?ynqPpF{aRc+sEj1#P2kERepAm_k6oCXQsLx z*_ccR;q7Hi#Y*r7YHK{yJMSb@uz8(wS z4Oo$R*}Bdxu&s^k435ru7GuJwqP^GAUOB0_hYOk##+Wh z3KKn*Gak0WsbNoDsr6FC+vc;@6!9HlIh&>3Jg4Q^CcV$mlxvWiBiW7FW1yao`~=U< zD5&hlu|u}((HGa8q`9U*K=0(wo?Xf^``A@N-rbWc$xUbrYbvB0Vh<>-5&+ap`2R*PsBWCI?Z$z%>N0^CkN&=xl9u((?I%VUt*4RYbFWD?AIK7-6DOSUzy+0_m#YUU)RJPyRtuVWwzwUYpyo#@lvPkS9ZWh z5}j9(2S0~Sr(eFpuUBKkYRx)1O+6AqKa;AXq+gwfUo?-(s$Fu{h55X{hLcK?KGS^3 zVl_C-Ht;UcxA*t$DEF2$uY-@6PQ7OtiBlM&5m6`gCiObIO`q-5u(oJA>`L?YtN7fVt+UbD6`;$E(!BWij_bxFt+cqegR^vCUt@6!W{!A?pV})DIDNepp5jWI~mRFWU($PwhB}x^9Vk i!r>=d8(F7Ws5-?v9KTs-oy+ZvoAQdfjNV`VANVI"; + $TmpConfigFile.Settings.ScriptName = "$($ScriptName)"; + $TmpConfigFile.Settings.Version = "$($ScriptVersion)"; + $TmpConfigFile.Save($configFilePath); + } + } + else + { + Write-Error -Message "The Script's Config file could not be found" -Category ObjectNotFound; + #Write-Host "Script is terminating"; + Break; + } + } + + #Create the object to hold the script file + [xml]$Script:Config = Get-Content "$($configFilePath)"; + + #check that this script file is valid + if ($Script:Config.Settings.ScriptName -ne $ScriptName) + { + Write-Error -Message "The Script's config file is invalid. Incorrect script name, expecting '$($ScriptName)'." -Category InvalidData; + Break; + } + if ($Script:Config.Settings.Version -lt $ScriptVersion) + { + Write-Error -Message "The Script's config file is invalid. Config file is for an older version of the script." -Category InvalidData; + Break; + } + + } + catch + { + #Tell the user something went wrong + Write-Error -Message "Could not process the config file, exception was: $($_.Exception.Message)"; + } + finally + { + + } + +} # fn Get-ScriptConfig \ No newline at end of file diff --git a/README.md b/README.md index 35b5959..4488c6e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,60 @@ -# PSScriptHelper -A collections of cmdlets and functions that enhance scripts. +# PowerShell Script Helper (PSScriptHelper) +A collections of cmdlets and functions that enhance scripts. An example is the cmdlets to work with configuration data for a script. + +## System Requirements + +* WMF (PowerShell) 5.0 + +## Required PowerShell Modules +The following PowerShell modules. +* Microsoft.PowerShell.Archive +* ActiveDirectory +* SqlServer + +## Example +The following example demonstrates how to run this tool + +``` +Command goes here +``` + +## Versions +This project uses [SemVer](http://semver.org/) for versioning. While the following is an overview of the offical releases, for the detailed versions available, see the [tags on this repository](https://github.com/your/project/tags). + +### Unreleased + +* None + +### 1.0.0.0 + +* Initial push + +## I found a bug +Create an issue through GitHub and lets work on solving it together :) + +## Contributing +If you are interested in contributing please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). These are the standards I try and adopt for ALL of my work as well. + +### Dev Tools +The following development tools have been used when authoring this project. +* VSCode +* VSCode Extensions - C#, , mssql, PowerShell, vscode-icons +* PowerShell 5.0 +* Git + +### Setting up your Dev environment +The following actions need to be taken if you wish to contribute +1. Install VSCode +2. Install PowerShell 5.0 +3. Install the VSCode Extensions - C#, mssql, PowerShell, vscode-icons +4. Configure the extensions, for example set your icons (File > Preferences) to vscode-icons +6. Clone this repository +7. Create a branch for your work + +## License +This project is released under the [GNU General Public License 3.0](https://github.com/Matticusau/.../blob/master/LICENSE) +This project is released under the [MIT License](https://github.com/Matticusau/.../blob/master/LICENSE) + +## Contributors + +* Matticusau [GitHub](https://github.com/Matticusau) | [twitter](https://twitter.com/matticusau) \ No newline at end of file