Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Add files to DscResource.Template (#388)
Browse files Browse the repository at this point in the history
- Update DscResource.Template
- Update README.md
- Add module manifest (issue #67)
  • Loading branch information
johlju committed Jul 4, 2018
1 parent 9d77268 commit ccbce0f
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 1 deletion.
10 changes: 10 additions & 0 deletions DscResource.Template/.MetaTestOptIn.json
@@ -0,0 +1,10 @@
[
"Common Tests - Validate Markdown Files",
"Common Tests - Validate Example Files",
"Common Tests - Validate Module Files",
"Common Tests - Validate Script Files",
"Common Tests - Required Script Analyzer Rules",
"Common Tests - Flagged Script Analyzer Rules",
"Common Tests - New Error-Level Script Analyzer Rules",
"Common Tests - Custom Script Analyzer Rules"
]
24 changes: 24 additions & 0 deletions DscResource.Template/.codecov.yml
@@ -0,0 +1,24 @@
codecov:
notify:
require_ci_to_pass: no

comment:
layout: "reach, diff"
behavior: default

coverage:
range: 50..80
round: down
precision: 0

status:
project:
default:
# Set the overall project code coverage requirement to 70%
target: 70
patch:
default:
# Set the pull request requirement to not regress overall coverage by more than 5%
# and let codecov.io set the goal for the code changed in the patch.
target: auto
threshold: 5
13 changes: 13 additions & 0 deletions DscResource.Template/.vscode/settings.json
@@ -0,0 +1,13 @@
{
"powershell.codeFormatting.openBraceOnSameLine": false,
"powershell.codeFormatting.newLineAfterOpenBrace": false,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.preset": "Custom",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
}
8 changes: 8 additions & 0 deletions DscResource.Template/CHANGELOG.md
@@ -0,0 +1,8 @@
# Change log for ResourceModuleDsc

## Unreleased

- Changes to ResourceName
- Text describing what was changed and why, and a reference to any issues it
closes ([issue #11111](https://github.com/PowerShell/SqlServerDsc/issues/11111)).
[Name/Alias (@github_account)](https://github.com/github_account)
@@ -0,0 +1,99 @@
<#
.SYNOPSIS
Returns ...
.PARAMETER MandatoryParameter
This ...
#>
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$MandatoryParameter
)

# TODO: Code that returns the current state.

return @{
Ensure = $ensure
MandatoryParameter = $value1
NonMandatoryParameter = $value2
}
}

<#
.SYNOPSIS
Sets ...
.PARAMETER MandatoryParameter
This ...
.PARAMETER NonMandatoryParameter
This ...
#>
function Set-TargetResource
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$MandatoryParameter,

[Parameter()]
[System.String]
$Ensure = 'Present',

[Parameter()]
[System.String]
$NonMandatoryParameter
)

# Code that sets the desired state if evaluated to not in desired state.
}

<#
.SYNOPSIS
Determines if ...
.PARAMETER MandatoryParameter
This ...
.PARAMETER NonMandatoryParameter
This ...
#>
function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$MandatoryParameter,

[Parameter()]
[System.String]
$Ensure = 'Present',

[Parameter()]
[System.String]
$NonMandatoryParameter
)

$testTargetResourceResult = $false

$getTargetResourceParameters = @{
MandatoryParameter = $MandatoryParameter
}

$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters

# Code that tests the desired state.

return $testTargetResourceResult
}
@@ -0,0 +1,7 @@
[ClassVersion("1.0.0.0"), FriendlyName("ResourceName")]
class MSFT_ResourceName : OMI_BaseResource
{
[Key, Description("Descriptive text for this property")] String MandatoryParameter;
[Write, Description("Descriptive text for this property")] String NonMandatoryParameter;
[Write, Description("Specifies if the ... should be present or absent. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
};
@@ -0,0 +1,18 @@
<#
.EXAMPLE
This example shows how to ...
#>

Configuration Example
{
Import-DscResource -ModuleName <ResourceModule>

Node $AllNodes.NodeName
{
ResourceName ShortNameForResource
{
Ensure = 'Present'
MandatoryParameter = 'MyValue'
NonMandatoryParameter = 'OtherValue'
}
}
20 changes: 20 additions & 0 deletions DscResource.Template/README.md
Expand Up @@ -7,6 +7,26 @@
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 [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Branches

### master

[![Build status](https://ci.appveyor.com/api/projects/status/{token}/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/{ModuleName}/branch/master)
[![codecov](https://codecov.io/gh/PowerShell/{ModuleName}/branch/master/graph/badge.svg)](https://codecov.io/gh/PowerShell/{ModuleName}/branch/master)

This is the branch containing the latest release -
no contributions should be made directly to this branch.

### dev

[![Build status](https://ci.appveyor.com/api/projects/status/{token}/branch/dev?svg=true)](https://ci.appveyor.com/project/PowerShell/{ModuleName}/branch/dev)
[![codecov](https://codecov.io/gh/PowerShell/{ModuleName}/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/{ModuleName}/branch/dev)

This is the development branch
to which contributions should be proposed by contributors as pull requests.
This development branch will periodically be merged to the master branch,
and be released to [PowerShell Gallery](https://www.powershellgallery.com/).

## How to Contribute

If you would like to contribute to this repository, please read the DSC Resource Kit [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md).
Expand Down
52 changes: 52 additions & 0 deletions DscResource.Template/ResourceModule.psd1
@@ -0,0 +1,52 @@
@{
# Version number of this module.
moduleVersion = '1.0.0.0'

# ID used to uniquely identify this module.
GUID = '4776d156-201c-4103-a50e-cae240f6b1a1'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = '(c) 2018 Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Description of <ResourceModule>.'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '4.0'

# Minimum version of the common language runtime (CLR) required by this module
CLRVersion = '4.0'

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

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

# 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.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResource')

# A URL to the license for this module.
LicenseUri = 'https://github.com/path_to_repository/blob/master/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/path_to_repository'

# ReleaseNotes of this module
ReleaseNotes = ''

} # End of PSData hashtable

} # End of PrivateData hashtable
}
@@ -0,0 +1,5 @@
<#
.NOTES
Please see the integration test configuration template
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/integration_template.ps1
#>
@@ -0,0 +1,5 @@
<#
.NOTES
Please see the integration test configuration template
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/integration_template.config.ps1
#>
5 changes: 5 additions & 0 deletions DscResource.Template/Tests/Unit/MSFT_ResourceName.Tests.ps1
@@ -0,0 +1,5 @@
<#
.NOTES
Please see the integration test configuration template
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/unit_template.ps1
#>
3 changes: 2 additions & 1 deletion DscResource.Template/appveyor.yml
Expand Up @@ -5,7 +5,8 @@
# This template assumes you have connected your repository to AppVeyor
# (https://ci.appveyor.com).
#
# Before using it in your repository, modify places marked with 'TODO:'.
# Before using it in your repository, modify places marked with 'TODO:', and
# then remove this comment block.
################################################################################

#---------------------------------#
Expand Down

0 comments on commit ccbce0f

Please sign in to comment.