-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed module to PSServiceNow from ServiceNow-Module
- Loading branch information
1 parent
3096b09
commit ddc1cf0
Showing
11 changed files
with
185 additions
and
8 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
ServiceNow-Module.Pester.Defaults.json | ||
*.zip | ||
PSServiceNow.Pester.Defaults.json |
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,83 @@ | ||
function ZipFiles | ||
{ | ||
param( $zipfilename, $sourcedir ) | ||
Add-Type -Assembly System.IO.Compression.FileSystem | ||
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, | ||
$zipfilename, $compressionLevel, $true) | ||
} | ||
|
||
function New-MakePackage{ | ||
param( | ||
[string[]]$PackageFilePatternExclusions, | ||
[string]$PackageName, | ||
[string]$ModuleName | ||
) | ||
($FilePatternExclusions | %{"MAKE.zip" -match $_}).contains($true) | ||
|
||
$FilesToInclude = Get-ChildItem -Path $here | ?{ | ||
$File=$_; | ||
!$_.PSIsContainer -and | ||
!($PackageFilePatternExclusions | %{$File.Name -match $_}).contains($true) | ||
} | ||
|
||
# Create temporary folder and copy the files we want into it | ||
New-Item $here\$ModuleName -ItemType Container -Force | Out-Null | ||
$FilesToInclude | %{Copy-Item -Path $_.FullName -Destination $here\$ModuleName\$_ -Force} | ||
|
||
# Create a zip based on that folder (overwriting it if it already exists) | ||
$ZipFile = "$here\$PackageName" | ||
Remove-Item $ZipFile -Force -ErrorAction SilentlyContinue | Out-Null | ||
ZipFiles $ZipFile $here\$ModuleName | ||
Remove-Item $here\$ModuleName -Recurse| Out-Null | ||
} | ||
|
||
Function Update-CodeCoveragePercent{ | ||
param( | ||
[int]$CodeCoverage=0, | ||
[string]$TextFilePath="$here\Readme.md" | ||
) | ||
$ReadmeContent = Get-Content $TextFilePath | ||
$ReadmeContent = $ReadmeContent | %{$_-replace "!\[Test Coverage\].+\)", "![Test Coverage](https://img.shields.io/badge/coverage-$CodeCoverage%25-yellowgreen.svg)"} | ||
Set-Content -Path $TextFilePath -Value $ReadmeContent | ||
} | ||
|
||
Function UpdateManifest{ | ||
param( | ||
[string]$ManifestPath, | ||
[string]$Version | ||
) | ||
|
||
Write-Verbose "Updating $ManifestPath to version $Version" | ||
$ManifestContent = Get-Content $ManifestPath | ||
$ManifestContent = $ManifestContent | %{$_ -replace "ModuleVersion = '(\d|\.)+'", "ModuleVersion = '$Version'"} | ||
Set-Content -path $ManifestPath -Value $ManifestContent | ||
} | ||
|
||
$PackageFilePatternExclusions = @( | ||
"MAKE\.ps1", | ||
".+\.zip", | ||
".+\.md" | ||
".+\.Tests\.ps1", | ||
"\.gitignore", | ||
"LICENSE", | ||
".+\.Pester.Defaults.json" | ||
) | ||
|
||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
|
||
$Version = "0.1.1" | ||
$ModuleName = "PSServiceNow" | ||
$PackageName = "$ModuleName-v$($version).zip"; | ||
|
||
# Perform Pester tests | ||
$TestResult = Invoke-Pester -CodeCoverage '*.psm1' -PassThru | ||
$CoveragePercent = 100-(($testResult.CodeCoverage.NumberOfCommandsMissed/$testResult.CodeCoverage.NumberOfCommandsAnalyzed)*100) | ||
|
||
# Update/Create the package and | ||
if($TestResult.FailedCount -eq 0){ | ||
New-MakePackage -PackageFilePatternExclusions $PackageFilePatternExclusions -PackageName $PackageName -ModuleName $ModuleName | ||
Update-CodeCoveragePercent -CodeCoverage $CoveragePercent | ||
UpdateManifest -ManifestPath "$here\$ModuleName.psd1" -Version $Version | ||
} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,92 @@ | ||
# | ||
# Module manifest for module 'PSServiceNow' | ||
# | ||
# Generated by: Sam Martin | ||
# | ||
# Generated on: 03/05/2015 | ||
# | ||
|
||
@{ | ||
|
||
# Script module or binary module file associated with this manifest. | ||
RootModule = 'PSServiceNow.psm1' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '0.1.1' | ||
|
||
# ID used to uniquely identify this module | ||
GUID = 'b90d67da-f8d0-4406-ad74-89d169cd0633' | ||
|
||
# Author of this module | ||
Author = 'Sam Martin' | ||
|
||
# Company or vendor of this module | ||
CompanyName = 'None' | ||
|
||
# Copyright statement for this module | ||
Copyright = '(c) 2015 Sam. All rights reserved.' | ||
|
||
# Description of the functionality provided by this module | ||
# Description = 'This module provides cmdlets allowing you to retrieve information from your ServiceNow instance`s rest API' | ||
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
# PowerShellVersion = '3.0' | ||
|
||
# Name of the Windows PowerShell host required by this module | ||
# PowerShellHostName = '' | ||
|
||
# Minimum version of the Windows PowerShell host required by this module | ||
# PowerShellHostVersion = '' | ||
|
||
# Minimum version of Microsoft .NET Framework required by this module | ||
# DotNetFrameworkVersion = '' | ||
|
||
# Minimum version of the common language runtime (CLR) required by this module | ||
# CLRVersion = '' | ||
|
||
# Processor architecture (None, X86, Amd64) required by this module | ||
# ProcessorArchitecture = 'None' | ||
|
||
# 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 = @( | ||
'PSServiceNow-Tables.psm1', | ||
'PSServiceNow-Incidents.psm1', | ||
'PSServiceNow-Users.psm1', | ||
'PSServiceNow-ConfigurationManagement.psm1' | ||
) | ||
|
||
# Functions to export from this module | ||
FunctionsToExport = '*' | ||
|
||
# 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 | ||
# PrivateData = '' | ||
|
||
# HelpInfo URI of this module | ||
# HelpInfoURI = 'https://github.com/Toukakoukan/servicenow-powershell' | ||
|
||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
# DefaultCommandPrefix = '' | ||
|
||
} | ||
|
File renamed without changes.
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
Binary file not shown.