-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 936eb67
Showing
63 changed files
with
6,273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Needed for publishing of examples, build worker defaults to core.autocrlf=input. | ||
* text eol=crlf | ||
|
||
# Ensure any exe files are treated as binary | ||
*.exe binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
output/* | ||
modules/* | ||
.kitchen/* | ||
**.bak | ||
.kitchen.local.yml | ||
|
||
!**/README.md | ||
DscResource.tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"default": true, | ||
"MD029": { | ||
"style": "one" | ||
}, | ||
"MD013": true, | ||
"MD024": false, | ||
"MD034": false, | ||
"no-hard-tabs": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
- For new features. | ||
|
||
### Changed | ||
- For changes in existing functionality. | ||
|
||
### Deprecated | ||
- For soon-to-be removed features. | ||
|
||
### Removed | ||
- For now removed features. | ||
|
||
### Fixed | ||
- For any bug fix. | ||
|
||
### Security | ||
- In case of vulnerabilities. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Code of conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) | ||
or contact [[email protected]](mailto:[email protected]) with any additional | ||
questions or comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# Contributing | ||
|
||
Thank you for considering contributing to this resource module. Every little | ||
change helps make the DSC resources even better for everyone to use. | ||
|
||
## Common contribution guidelines | ||
|
||
This resource module follow all of the common contribution guidelines for | ||
DSC resource modules [outlined in DscResources repository](https://github.com/PowerShell/DscResources/blob/master/CONTRIBUTING.md), | ||
so please review these as a baseline for contributing. | ||
|
||
## Specific guidelines for this resource module | ||
|
||
### Automatic formatting with VS Code | ||
|
||
There is a VS Code workspace settings file within this project with formatting | ||
settings matching the style guideline. That will make it possible inside VS Code | ||
to press SHIFT+ALT+F, or press F1 and choose 'Format document' in the list. The | ||
PowerShell code will then be formatted according to the Style Guideline | ||
(although maybe not complete, but would help a long way). | ||
|
||
### Naming convention | ||
|
||
#### mof-based resource | ||
|
||
All mof-based resource (with Get/Set/Test-TargetResource) should be prefixed | ||
with 'MSFT'. I.e. MSFT\_Folder. | ||
|
||
>**Note:** If the resource module is not part of the DSC Resource Kit the | ||
>prefix can be any abbreviation, for example your name or company name. | ||
>For the example below, the 'MSFT' prefix is used. | ||
##### Folder and file structure | ||
|
||
```Text | ||
DSCResources/MSFT_Folder/MSFT_Folder.psm1 | ||
DSCResources/MSFT_Folder/MSFT_Folder.schema.mof | ||
DSCResources/MSFT_Folder/en-US/MSFT_Folder.strings.psd1 | ||
Tests/Unit/MSFT_Folder.Tests.ps1 | ||
Examples/Resources/Folder/1-AddConfigurationOption.ps1 | ||
Examples/Resources/Folder/2-RemoveConfigurationOption.ps1 | ||
``` | ||
|
||
>**Note:** For the examples folder we don't use the 'MSFT\_' prefix on the | ||
>resource folders. This is to make those folders resemble the name the user | ||
>would use in the configuration file. | ||
##### Schema mof file | ||
|
||
Please note that the `FriendlyName` in the schema mof file should not | ||
contain the prefix `MSFT\_`. | ||
|
||
```powershell | ||
[ClassVersion("1.0.0.0"), FriendlyName("Folder")] | ||
class MSFT_Folder : OMI_BaseResource | ||
{ | ||
# Properties removed for readability. | ||
}; | ||
``` | ||
|
||
#### Composite or class-based resource | ||
|
||
Any composite (with a Configuration) or class-based resources should be | ||
prefixed with just 'Sql' | ||
|
||
### Helper functions | ||
|
||
Helper functions that are only used by one resource | ||
so preferably be put in the same script file as the resource. | ||
Helper function that can used by more than one resource can preferably | ||
be placed in the resource module file [DscResource.Common](/Modules/DscResource.Common/DscResource.Common.psm1). | ||
|
||
### Localization | ||
|
||
Please see the localization section in the [style guideline](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#localization). | ||
The helper functions is found in the module [DscResource.LocalizationHelper](/Modules/DscResource.LocalizationHelper/DscResource.LocalizationHelper.psm1). | ||
|
||
### Unit tests | ||
|
||
For a review of a Pull Request (PR) to start, all tests must pass without error. | ||
If you need help to figure why some test don't pass, just write a comment in the | ||
Pull Request (PR), or submit an issue, and somebody will come along and assist. | ||
|
||
To run all tests manually run the following. | ||
|
||
```powershell | ||
Install-Module Pester | ||
cd '<path to cloned repository>\Tests\Unit' | ||
Invoke-Pester | ||
``` | ||
|
||
#### Unit tests for style check of Markdown files | ||
|
||
When sending in a Pull Request (PR) a style check will be performed on all Markdown | ||
files, and if the tests find any error the build will fail. | ||
See the section [Documentation with Markdown](#documentation-with-markdown) how | ||
these errors can be found before sending in the PR. | ||
|
||
The Markdown tests can be run locally if the packet manager 'npm' is available. | ||
To have npm available you need to install [node.js](https://nodejs.org/en/download/). | ||
If 'npm' is not available, a warning text will print and the rest of the tests | ||
will continue run. | ||
|
||
>**Note:* To run the common tests, at least one unit tests must have be run for | ||
>the common test framework to have been cloned locally. | ||
```powershell | ||
cd '<path to cloned repository>' | ||
Invoke-Pester .\DSCResource.Tests\Meta.Tests.ps1 | ||
``` | ||
|
||
#### Unit tests for examples files | ||
|
||
When sending in a Pull Request (PR) all example files will be tested so they can | ||
be compiled to a .mof file. If the tests find any errors the build will fail. | ||
Before the test runs in AppVeyor the module will be copied to a path of | ||
`$env:PSModulePath`. | ||
To run this test locally, make sure you have the resource module | ||
deployed to a path where it can be used. | ||
See `$env:PSModulePath` to view the existing paths. | ||
|
||
>**Note:* To run the common tests, at least one unit tests must have be run for | ||
>the common test framework to have been cloned locally. | ||
```powershell | ||
cd '<path to cloned repository>' | ||
Invoke-Pester .\DSCResource.Tests\Meta.Tests.ps1 | ||
``` | ||
|
||
### Integration tests | ||
|
||
Integration tests should be written for resources so they can be validated by | ||
the automated test framework which is run in AppVeyor when commits are pushed | ||
to a Pull Request (PR). | ||
Please see the [Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md) | ||
for common DSC Resource Kit testing guidelines. | ||
There are also configurations made by existing integration tests that can be reused | ||
to write integration tests for other resources. This is documented in the | ||
[Integration tests README](/Tests/Integration/README.md). | ||
|
||
#### AppVeyor | ||
|
||
AppVeyor is the platform where the tests is run when sending in a Pull Request (PR). | ||
All tests are run on a clean AppVeyor build worker for each push to the Pull | ||
Request (PR). | ||
The tests that are run on the build worker are common tests, unit tests and | ||
integration tests (with some limitations). | ||
|
||
### Documentation with Markdown | ||
|
||
If using Visual Studio Code to edit Markdown files it can be a good idea to install | ||
the markdownlint extension. It will help to find lint errors and style checking. | ||
The file [.markdownlint.json](/.markdownlint.json) is prepared with a default set | ||
of rules which will automatically be used by the extension. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if ( | ||
$Env:ProjectName -and $Env:ProjectName.Count -eq 1 -and | ||
$Env:BuildSystem -ne 'unknown' | ||
) { | ||
if ($Env:BranchName -eq 'master') { | ||
Deploy Module { | ||
by PSGalleryModule { | ||
FromSource $(Get-Item ".\BuildOutput\$Env:ProjectName") | ||
To $Env:ModuleRepositoryToDeployTo | ||
WithOptions @{ | ||
ApiKey = $Env:NugetApiKey | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
Write-Warning "Condition to Deploy not met" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
mode: ContinuousDelivery | ||
next-version: 0.90 | ||
major-version-bump-message: '\s?(breaking|major|breaking\schange)' | ||
minor-version-bump-message: '\s?(add|feature|minor)' | ||
patch-version-bump-message: '\s?(fix|patch)' | ||
no-bump-message: '\+semver:\s?(none|skip)' | ||
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}' | ||
branches: | ||
master: | ||
tag: preview | ||
pull-request: | ||
tag: PR | ||
feature: | ||
tag: useBranchName | ||
increment: Minor | ||
regex: f(eature(s)?)?[/-] | ||
source-branches: ['master'] | ||
hotfix: | ||
tag: fix | ||
increment: Patch | ||
regex: (hot)?fix(es)?[/-] | ||
source-branches: ['master'] | ||
|
||
ignore: | ||
sha: [] | ||
merge-message-formats: {} | ||
|
||
|
||
# feature: | ||
# tag: useBranchName | ||
# increment: Minor | ||
# regex: f(eature(s)?)?[/-] | ||
# source-branches: ['master'] | ||
# hotfix: | ||
# tag: fix | ||
# increment: Patch | ||
# regex: (hot)?fix(es)?[/-] | ||
# source-branches: ['master'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# DscResource.AnalyzerRules | ||
|
||
PS Script Analyzer Custom Rules for the DSC Community standards | ||
|
||
## Make it yours | ||
|
||
--- | ||
Generated with Plaster and the SampleModule template | ||
|
||
|
||
This is a sample Readme | ||
|
||
## Make it yours |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@{ | ||
# Set up a mini virtual environment... | ||
PSDependOptions = @{ | ||
AddToPath = $True | ||
Target = 'output\RequiredModules' | ||
Parameters = @{ | ||
} | ||
} | ||
|
||
invokeBuild = 'latest' | ||
PSScriptAnalyzer = 'latest' | ||
pester = 'latest' | ||
Plaster = 'latest' | ||
ModuleBuilder = 'latest' | ||
ChangelogManagement = 'latest' | ||
Sampler = 'latest' | ||
|
||
#required for DSC authoring | ||
# xDscResourceDesigner = 'latest' | ||
} |
Oops, something went wrong.