Compare commits

..

No commits in common. "master" and "v0.0.2-dev2" have entirely different histories.

33 changed files with 20 additions and 1789 deletions

View File

@ -3,13 +3,4 @@
<!-- insertMark -->
## `v0.0.2`
- (e22fb0a) Fixes external dependencies in updated module manifest files (#7)
- (6a314ee) add platyPS generated docs (#5)
- (10182c5) fix module tags
- (175e770) update meta files (#4)
- (1f86741) adds assets (#3)
- (c2b2dc8) prepare release (#2)
## pre `v0.0.2`
- 🧙 Initial migrated version

View File

@ -37,26 +37,12 @@
The DroneHelper PowerShell module adds several features for `Gitea -> Drone.IO` based build pipelines. It's designed
to perform all needed tasks for PowerShell Module development like:
### Testing
- `Invoke-FileLinter` -> Runs basic FileLinter tests with console and log file output
- `Invoke-Linter` -> Runs PSScriptAnalyzer with embedded to custom profiles.
- `Invoke-UnitTest` -> Runs Pester tests including code coverage report with console and log file output.
### Build Pipeline
- `Send-PRComment` -> Takes all generated reports and reports them back as Pull Request Comment for a simplified overview.
- `Write-FailureStateFile`, `Invoke-Build` -> Marks the current pipeline run / build as failed if the previous steps also raised errors.
### Helper
- `New-Docs`, `Update-Docs` -> Automatically updates the markdown based docs generated form your Comment Based Help blocks in your functions
### Building & Publishing
- `Update-ModuleMeta` -> Updates the `ModuleVersion` + `Prerelease` properties wit the current git tag.
- `Merge-ModuleRoot` -> Takes all single file functions and merges them into a single `*.psm1` file.
- `New-BuildPackage` -> Creates a new build artifact for an alternate publishing target like a Gitea release.
- `FileLinter` -> Runs basic FileLinter tests with console and log file output
- `Linter` -> Runs PSScriptAnalyzer with embedded to custom profiles.
- `UnitTest` -> Runs Pester tests including code coverage report with console and log file output.
- `BuildReport` -> Takes all generated reports and reports them back as Pull Request Comment for a simplified overview.
- `StateReporter` -> Marks the current pipeline run / build as failed if the previous steps also raised errors.
- `DoksUpdater` -> Automatically updates the markdown based docs generated form your Comment Based Help blocks in your functions
To use these features, all you have to do, is follow the `.drone.yml` template:

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Get-RepoPath
## SYNOPSIS
Updates the module manifest file fields to prepare the new build.
## SYNTAX
```
Get-RepoPath [[-SubPath] <String[]>] [<CommonParameters>]
```
## DESCRIPTION
Replaces the version fields in the manifest file.
Uses Drone env vars populated by pushed tags.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Get-RepoPath
```
## PARAMETERS
### -SubPath
An optional string array of sub directories relative to the root.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [DroneHelper.Repo.Path] Returns a folder structured like object with relevant full paths.s
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Install-ModuleDependency
## SYNOPSIS
Install required modules of the module manifest file.
## SYNTAX
```
Install-ModuleDependency [<CommonParameters>]
```
## DESCRIPTION
Use this cmdlet to install required modules of the module manifest file.
## EXAMPLES
### EXAMPLE 1
```
Install-ModuleDependency
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None]
## OUTPUTS
### [None]
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-BuildState
## SYNOPSIS
Sets final Drone pipeline build state.
## SYNTAX
```
Invoke-BuildState [<CommonParameters>]
```
## DESCRIPTION
Marks the pipeline ass succeeded of fail based on the custom state file.
## EXAMPLES
### EXAMPLE 1
```
Invoke-BuildState
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-FileLinter
## SYNOPSIS
Runs the file linter for all src files found in current repository.
## SYNTAX
```
Invoke-FileLinter [-PassThru] [<CommonParameters>]
```
## DESCRIPTION
Invoke-FileLinter runs the basic file tests and generates a report file for furher usage in the
drone pipeline.
## EXAMPLES
### EXAMPLE 1
```
Invoke-FileLinter
```
## PARAMETERS
### -PassThru
{{ Fill PassThru Description }}
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None]
## OUTPUTS
### [DroneHelper.FileLinter.Report]
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-InstallDependency
## SYNOPSIS
Install required modules for executing the DroneHelper pipeline helpers.
## SYNTAX
```
Invoke-InstallDependency [<CommonParameters>]
```
## DESCRIPTION
This can be used in drone.io docker pipeline if the modules are not integrated in the build image.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Invoke-Install-Dependency
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No Input required.
## OUTPUTS
### [None] No Output
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-Linter
## SYNOPSIS
Runs all PSScriptAnalyzer Rules within this repo.
## SYNTAX
```
Invoke-Linter [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used in Drone pipeline to run the PSScriptAnalyzer rules..
## EXAMPLES
### EXAMPLE 1
```
Invoke-Linter
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-Publish
## SYNOPSIS
Publishes powershell module to internal Nexus repository.
## SYNTAX
```
Invoke-Publish [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used to publish the module via Drone pipeline.
## EXAMPLES
### EXAMPLE 1
```
Invoke-Publish
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,124 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Invoke-UnitTest
## SYNOPSIS
Runs all Pester tests within this repo.
## SYNTAX
```
Invoke-UnitTest [[-CoverageFormat] <String>] [[-Verbosity] <String>] [-PassThru] [[-Tag] <String[]>]
[[-ExcludeTag] <String[]>] [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used in Drone pipeline to perform the Pester based unit tests.
## EXAMPLES
### EXAMPLE 1
```
Invoke-UnitTest
```
## PARAMETERS
### -CoverageFormat
Pester provides the formats JaCoCo ans CoverageGutters.
Default is JaCoCo.
These are the known use cases:
- JaCoCo -\> Used as standard coverage report used by sonar
- CoverageGutters -\> Custom Format to show coverage in VSCode.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: JaCoCo
Accept pipeline input: False
Accept wildcard characters: False
```
### -ExcludeTag
Pester build in exclude filter for tests as string array.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -PassThru
Tells Invoke-UnitTest to write back the Pester results into your variable / output.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -Tag
Pester build in tag filter as string array.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Verbosity
This parameter sets the Pester detail level.
Default is 'Normal.' Available values are:
'None', 'Normal', 'Detailed', 'Diagnostic'
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: Normal
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Merge-ModuleRoot
## SYNOPSIS
Merges single ps1 files into one module script file.
## SYNTAX
```
Merge-ModuleRoot [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used in build pipeline to reduce the file load and import performance to the target module.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Merge-ModuleRoot
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,57 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# New-BuildPackage
## SYNOPSIS
Creates a new module package as compressed archive.
## SYNTAX
```
New-BuildPackage [[-AdditionalPath] <String[]>] [<CommonParameters>]
```
## DESCRIPTION
This function is used in build pipeline to create an uploadable module version for the Gitea release page.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; New-BuildPackage
```
## PARAMETERS
### -AdditionalPath
You can provide additional paths to add files or folders in published module.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,44 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# New-Docs
## SYNOPSIS
Creates a ne set of markdown based help in the docs folder.
## SYNTAX
```
New-Docs [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet should be used once locally, or after adding new functions.
The function \`Update-Docs\`
can be used via pipeline to keep the docs up to date.
## EXAMPLES
### EXAMPLE 1
```
New-Docs
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,86 +0,0 @@
---
Module Name: DroneHelper
Module Guid: 4293292f-eac8-42ed-8e9d-437d4f405d2c
Download Help Link: {{ Update Download Link }}
Help Version: {{ Please enter version of help manually (X.X.X.X) format }}
Locale: en-US
---
# DroneHelper Module
## Description
See global [Readme file](../README.md) for usage instructions.
## DroneHelper Cmdlets
### [Get-RepoPath](Get-RepoPath.md)
Updates the module manifest file fields to prepare the new build.
### [Install-ModuleDependency](Install-ModuleDependency.md)
Install required modules of the module manifest file.
### [Invoke-BuildState](Invoke-BuildState.md)
Sets final Drone pipeline build state.
### [Invoke-FileLinter](Invoke-FileLinter.md)
Runs the file linter for all src files found in current repository.
### [Invoke-InstallDependency](Invoke-InstallDependency.md)
Install required modules for executing the DroneHelper pipeline helpers.
### [Invoke-Linter](Invoke-Linter.md)
Runs all PSScriptAnalyzer Rules within this repo.
### [Invoke-Publish](Invoke-Publish.md)
Publishes powershell module to internal Nexus repository.
### [Invoke-UnitTest](Invoke-UnitTest.md)
Runs all Pester tests within this repo.
### [Merge-ModuleRoot](Merge-ModuleRoot.md)
Merges single ps1 files into one module script file.
### [New-BuildPackage](New-BuildPackage.md)
Creates a new module package as compressed archive.
### [New-Docs](New-Docs.md)
Creates a ne set of markdown based help in the docs folder.
### [Send-PRComment](Send-PRComment.md)
Sends build report as Gitea PR comment.
### [Set-EOL](Set-EOL.md)
Helper function to set the EOL sequence to LF or CRLF.
### [Test-FileBOM](Test-FileBOM.md)
Tests given file if native utf8 w/o BOM is used.
Returns false if BOM is present.
### [Test-FileEncoding](Test-FileEncoding.md)
Returns true if the given file is written in a valid encoding
### [Test-FileEOF](Test-FileEOF.md)
Returns false if EOF isn't an empty line.
### [Test-FileEOL](Test-FileEOL.md)
Returns false if EOL isn't CRLF
### [Test-FileTab](Test-FileTab.md)
Returns false if tab char is used in file.
### [Test-FileTailingWhitespace](Test-FileTailingWhitespace.md)
Returns false if there are any tailing whitespace in lines.
### [Update-Changelog](Update-Changelog.md)
Updates the changelog file with recent commits
### [Update-Docs](Update-Docs.md)
Publishes powershell module to internal Nexus repository.
### [Update-ModuleMeta](Update-ModuleMeta.md)
Updates the module manifest file fields to prepare the new build.
### [Write-FailureStateFile](Write-FailureStateFile.md)
Writes the current pipeline step into failure log.
### [Write-ResultFile](Write-ResultFile.md)
Writes the current pipeline step into failure log.

View File

@ -1,79 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Send-PRComment
## SYNOPSIS
Sends build report as Gitea PR comment.
## SYNTAX
```
Send-PRComment [[-Mode] <String>] [[-GiteaUser] <String>] [<CommonParameters>]
```
## DESCRIPTION
Send-PRComment is used to report the build details from drone.io pipeline.
## EXAMPLES
### EXAMPLE 1
```
Send-PRComment
Depends on Drone.IO injected environment vars. Doesn't work locally on dev systems.
```
## PARAMETERS
### -GiteaUser
Gitea user for drone bot
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: Drone-bot
Accept pipeline input: False
Accept wildcard characters: False
```
### -Mode
Sets the report mode.
Default is 'Renew'.
This mode deletes the old pr comments and creates a new onw.
Also available:
- 'Add' -\> simply adds new pr comments.
- 'Edit' -\> Edits the last known pr comment.
Doesn't clean old ones.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: Renew
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None].
## OUTPUTS
### [None]
## NOTES
## RELATED LINKS

View File

@ -1,73 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Set-EOL
## SYNOPSIS
Helper function to set the EOL sequence to LF or CRLF.
## SYNTAX
```
Set-EOL [[-Style] <String>] [-Path] <FileInfo> [<CommonParameters>]
```
## DESCRIPTION
Helper for changing the EOL independent to the current OS defaults.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Set-EOL -Path './Readme.md'
```
## PARAMETERS
### -Path
Mandatory path for target file.
```yaml
Type: FileInfo
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Style
Optional style parameter for \`unix\` or \`win.\`.
Default is \`unix\`.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: Unix
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [DroneHelper.Repo.Path] Returns a folder structured like object with relevant full paths.s
## NOTES
## RELATED LINKS

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileBOM
## SYNOPSIS
Tests given file if native utf8 w/o BOM is used.
Returns false if BOM is present.
## SYNTAX
```
Test-FileBOM [-Path] <String> [<CommonParameters>]
```
## DESCRIPTION
This function is used to test for a valid encoding without BOM.
## EXAMPLES
### EXAMPLE 1
```
Test-FileBOM -Path './Testfile.txt'
```
## PARAMETERS
### -Path
Full or relative path to existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,57 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileEOF
## SYNOPSIS
Returns false if EOF isn't an empty line.
## SYNTAX
```
Test-FileEOF [-Path] <String> [<CommonParameters>]
```
## DESCRIPTION
Test the given file against the EOF standard (final empty/blank line + CRLF) and returns true or false.
## EXAMPLES
### EXAMPLE 1
```
Test-FileEOF -Path './testfile.txt'
```
## PARAMETERS
### -Path
Relative or full path to an existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [none]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileEOL
## SYNOPSIS
Returns false if EOL isn't CRLF
## SYNTAX
```
Test-FileEOL [-Path] <String> [<CommonParameters>]
```
## DESCRIPTION
Tests given file against valid EOL.
Returns true if CRLF is used.
## EXAMPLES
### EXAMPLE 1
```
Test-FileEOL -Path './TestFile.txt'
```
## PARAMETERS
### -Path
Relative or full path to an existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,73 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileEncoding
## SYNOPSIS
Returns true if the given file is written in a valid encoding
## SYNTAX
```
Test-FileEncoding [-Path] <String> [[-Encoding] <String>] [<CommonParameters>]
```
## DESCRIPTION
Test the given file against the encoding regex and returns true or false
## EXAMPLES
### EXAMPLE 1
```
Test-FileEncoding -Path './testfile.txt'
```
## PARAMETERS
### -Encoding
Optional custom encoding regex string.
Default is (utf8|ascii|xml).
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: (utf8|utf-8|ascii|xml)
Accept pipeline input: False
Accept wildcard characters: False
```
### -Path
Relative or full path to an existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [none]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileTab
## SYNOPSIS
Returns false if tab char is used in file.
## SYNTAX
```
Test-FileTab [-Path] <String> [<CommonParameters>]
```
## DESCRIPTION
Test the given file if tabs are used.
Returns false if any tabs were found.
## EXAMPLES
### EXAMPLE 1
```
Test-FileTab -Path './testfile.txt'
```
## PARAMETERS
### -Path
elative or full path to an existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [none]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,58 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Test-FileTailingWhitespace
## SYNOPSIS
Returns false if there are any tailing whitespace in lines.
## SYNTAX
```
Test-FileTailingWhitespace [-Path] <String> [<CommonParameters>]
```
## DESCRIPTION
Tests the given file for tailing whitespace.
Returns true if not found.
## EXAMPLES
### EXAMPLE 1
```
Test-FileTailingWhitespace.ps1 -Path './testfile.txt'
```
## PARAMETERS
### -Path
Relative or full path to an existing file.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [none]
## OUTPUTS
### [bool]
## NOTES
## RELATED LINKS

View File

@ -1,75 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Update-Changelog
## SYNOPSIS
Updates the changelog file with recent commits
## SYNTAX
```
Update-Changelog [-NewVersion] <String> [-SkipCleanup] [<CommonParameters>]
```
## DESCRIPTION
This helper function is used to insert recent changes for an upcoming release.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Update-Changelog -NewVersion '0.0.1-dev5'
```
## PARAMETERS
### -NewVersion
Provide a valid semver based version tag for the upcoming release like:
- \`v0.0.1-dev1\`
- \`v1.0.0\`
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SkipCleanup
You can skip the tag update and additional test.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] no pipeline putput.
## NOTES
## RELATED LINKS

View File

@ -1,42 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Update-Docs
## SYNOPSIS
Publishes powershell module to internal Nexus repository.
## SYNTAX
```
Update-Docs [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used to publish the module via Drone pipeline.
## EXAMPLES
### EXAMPLE 1
```
Update-Docs
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,43 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Update-ModuleMeta
## SYNOPSIS
Updates the module manifest file fields to prepare the new build.
## SYNTAX
```
Update-ModuleMeta [<CommonParameters>]
```
## DESCRIPTION
Replaces the version fields in the manifest file.
Uses Drone env vars populated by pushed tags.
## EXAMPLES
### EXAMPLE 1
```
Import-Module -Name DroneHelper; Update-ModuleMeta
```
## PARAMETERS
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,57 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Write-FailureStateFile
## SYNOPSIS
Writes the current pipeline step into failure log.
## SYNTAX
```
Write-FailureStateFile [-StepName] <String> [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used to mark single steps as failed without stopping the complete pipeline.
## EXAMPLES
### EXAMPLE 1
```
Write-FailureStateFile
```
## PARAMETERS
### -StepName
The current DroneHelper step name which should be added into to the log.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,87 +0,0 @@
---
external help file: ModuleRoot-help.xml
Module Name: DroneHelper
online version:
schema: 2.0.0
---
# Write-ResultFile
## SYNOPSIS
Writes the current pipeline step into failure log.
## SYNTAX
```
Write-ResultFile [-InputObject] <PSObject> [-Path] <String> [-Type] <String> [<CommonParameters>]
```
## DESCRIPTION
This Cmdlet is used to mark single steps as failed without stopping the complete pipeline.
## EXAMPLES
### EXAMPLE 1
```
Write-FailureStateFile
```
## PARAMETERS
### -InputObject
{{ Fill InputObject Description }}
```yaml
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Path
{{ Fill Path Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Type
{{ Fill Type Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### [None] No pipeline input.
## OUTPUTS
### [None] No pipeline output.
## NOTES
## RELATED LINKS

View File

@ -1,141 +0,0 @@
#
# Module manifest for module 'MyModule'
#
# Generated by: OCram85
#
# Generated on: 27.07.2022
#
@{
# Script module or binary module file associated with this manifest.
# RootModule = ''
# Version number of this module.
ModuleVersion = '0.0.1'
# Supported PSEditions
# CompatiblePSEditions = @()
# ID used to uniquely identify this module
GUID = '71364bab-5f39-4c93-a0f6-319d2b6cfc53'
# Author of this module
Author = 'OCram85'
# Company or vendor of this module
CompanyName = 'Unknown'
# Copyright statement for this module
Copyright = '(c) OCram85. All rights reserved.'
# Description of the functionality provided by this module
# Description = ''
# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''
# Name of the PowerShell host required by this module
# PowerShellHostName = ''
# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''
# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''
# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()
# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()
# 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.
FunctionsToExport = @()
# 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.
CmdletsToExport = @()
# Variables to export from this module
VariablesToExport = '*'
# 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.
AliasesToExport = @()
# DSC resources to export from this module
# DscResourcesToExport = @()
# List of all modules packaged with this module
# ModuleList = @()
# List of all files packaged with this module
# FileList = @()
# 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 = @()
# A URL to the license for this module.
# LicenseUri = ''
# A URL to the main website for this project.
# ProjectUri = ''
# A URL to an icon representing this module.
# IconUri = ''
# ReleaseNotes of this module
# ReleaseNotes = ''
# Prerelease string of this module
# Prerelease = ''
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false
# External dependent modules of this module
ExternalModuleDependencies = @(
@{
ModuleName = 'WinSCP'
ModuleVersion = '5.17.8.1'
},
@{
ModuleName = 'DataONTAP'
ModuleVersion = '9.7.1.1'
}
)
} # End of PSData hashtable
} # End of PrivateData hashtable
# HelpInfo URI of this module
# HelpInfoURI = ''
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
}

View File

@ -18,29 +18,4 @@ Describe 'Update-ModuleMeta' {
$foo.Description[0].Text.Length | Should -BeGreaterThan 5
}
}
Context 'Unit Tests' -Tag 'Unit' {
It 'Update test module manifest' {
{
$Env:DRONE = $true
$Env:DRONE_BUILD_EVENT = 'tag'
$Env:DRONE_SEMVER = '9.9.9-dev9'
$Env:DRONE_SEMVER_SHORT = '9.9.9'
$Env:DRONE_SEMVER_PRERELEASE = 'dev9'
Update-ModuleMeta -Path './resources/MyModule.psd1' -Verbose
} | Should -Not -Throw
$data = Import-PowerShellDataFile -Path './resources/MyModule.psd1'
$data.ModuleVersion | Should -Be '9.9.9'
$data.PrivateData.PSData.Prerelease | Should -Be 'dev9'
}
It 'Updated manifest is valid' {
{ Test-ModuleManifest -Path './resources/MyModule.psd1' } | Should -Not -Throw
}
It 'External dependencies prop is untouched' {
$d = Test-ModuleManifest -Path './resources/MyModule.psd1'
$d.PrivateData.PSData.ExternalModuleDependencies.Count | Should -Be '2'
}
}
}

View File

@ -27,31 +27,11 @@ function Update-ModuleMeta {
'',
Justification = 'system state does not change permanent in temp build clients.'
)]
param (
[Parameter(Mandatory = $false)]
[ValidateScript(
{
if (Test-Path -Path $_) {
return $true
}
else {
throw 'Could not find file: {0}' -f $_
}
}
)]
[ValidateNotNullOrEmpty()]
[string]$Path
)
param ()
process {
if (!$Path) {
$Repo = Get-RepoPath
$ManifestFilePath = $Repo.Src.Manifest.Item.FullName
}
else {
$ManifestFilePath = $Path
}
if ($Env:DRONE) {
$Repo = Get-RepoPath
if ($Env:DRONE_BUILD_EVENT -eq 'tag') {
if ($null -ne $Env:DRONE_SEMVER) {
$nVersion = $Env:DRONE_SEMVER_SHORT
@ -59,69 +39,37 @@ function Update-ModuleMeta {
if ($null -ne $Env:DRONE_SEMVER_PRERELEASE) {
$nPreRelease = $Env:DRONE_SEMVER_PRERELEASE
}
$DataParams = @{
Path = $ManifestFilePath
ErrorAction = 'Stop'
$ModManifestParams = @{
Path = $Repo.Src.Manifest.Item.FullName
ModuleVersion = $nVersion
ErrorAction = 'Stop'
}
# Getting the module manifest as imported object
try {
$ModManifestData = Import-PowerShellDataFile @DataParams
}
catch {
$_.Exception.Message | Write-Debug
$ErrorParams = @{
Message = "Could not import the module manifest file."
ErrorAction = 'Stop'
}
Write-Error @ErrorParams
}
# Updating the new module version
$ModManifestData.ModuleVersion = $nVersion
# Updating the prerelease property if there is one
if ($nPreRelease) {
$ModManifestData.PrivateData.PSData.Prerelease = $nPreRelease
$ModManifestParams.PreRelease = $nPreRelease
}
$ManifestData = Test-ModuleManifest -Path $ManifestFilePath
$ManifestData = Test-ModuleManifest -Path $Repo.Src.Manifest.Item.FullName
if (
($nVersion -ne $ManifestData.Version) -or
($nPreRelease -ne $ManifestData.PrivateData.PSData.Prerelease)
($nVersion -ne $ManifestData.PrivateData.PSData.Prerelease)
) {
$OutputFileParams = @{
Path = $ManifestFilePath
#PassThru = $true
Encoding = 'utf8NoBom'
Force = $true
Verbose = $VerbosePreference
}
try {
$ModManifestData | ConvertTo-Psd | Set-Content @OutputFileParams
}
catch {
$_.Exception.Message | Write-Debug
$ErrorParams = @{
Message = "Failed to update the module manifest file"
ErrorAction = 'Stop'
}
Write-Error @ErrorParams
}
Update-ModuleManifest @ModManifestParams
}
else {
Write-Warning -Message 'Identical version given. Skipping update.'
Write-Verbose -Message 'Identical version given. Skipping update.'
}
}
else {
Write-Warning -Message 'Could not read the new Tag / Semver!'
Write-Verbose -Message 'Could not read the new Tag / Semver!'
}
}
else {
Write-Warning -Message 'This pipeline was not triggered by a tag.'
Write-Verbose -Message 'This pipeline was not triggered by a tag.'
}
}
else {
Write-Warning -Message 'Running outside of drone.io pipeline. Skipping module update!'
Write-Verbose -Message 'Running outside of drone.io pipeline. Skipping module update!'
}
}
}

View File

@ -56,19 +56,6 @@ function Invoke-InstallDependency {
ErrorAction = 'Stop'
}
Install-Module @PoshParams
$PsdKitParams = @{
Name = 'PsdKit'
Scope = 'CurrentUser'
RequiredVersion = '0.6.2'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
AllowPrerelease = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PsdKitParams
}
catch {
$ExecParams = @{

View File

@ -68,10 +68,6 @@
@{
ModuleName = 'posh-git'
ModuleVersion = '1.1.0'
},
@{
ModuleName = 'PsdKit'
ModuleVersion = '0.6.2'
}
)

View File

@ -49,20 +49,6 @@ function Invoke-FixDevDependency {
ErrorAction = 'Stop'
}
Install-Module @PoshParams
$PsdKitParams = @{
Name = 'PsdKit'
Scope = 'CurrentUser'
RequiredVersion = '0.6.2'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
AllowPrerelease = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PsdKitParams
}
catch {
$ExecParams = @{