Skip to content

Commit

Permalink
Overhaul 2017.03.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick-2CA committed Jul 25, 2017
1 parent d9518d9 commit a03e8a5
Show file tree
Hide file tree
Showing 26 changed files with 259 additions and 312 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ServiceNow-Module.Pester.Defaults.json
*.zip
PSServiceNow.Pester.Defaults.json
PoshServiceNow.Pester.Defaults.json
24 changes: 13 additions & 11 deletions MAKE.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ function New-MakePackage{
[string]$PackageName,
[string]$ModuleName
)
@($FilePatternExclusions | %{"MAKE.zip" -match $_}).contains($true)
@($FilePatternExclusions | ForEach-Object{"MAKE.zip" -match $_}).contains($true)

$FilesToInclude = Get-ChildItem -Path $here | ?{
$FilesToInclude = Get-ChildItem -Path $here -Recurse | Where-Object {
$File=$_;
!$_.PSIsContainer -and
!($PackageFilePatternExclusions | %{$File.Name -match $_}).contains($true)
!($PackageFilePatternExclusions | ForEach-Object{$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}
$FilesToInclude | ForEach-Object {Copy-Item -Path $_.FullName -Destination $here\$ModuleName\$_ -Force}

# Create a zip based on that folder (overwriting it if it already exists)
$ZipFile = "$here\$PackageName"
Expand All @@ -38,7 +38,7 @@ Function Update-CodeCoveragePercent{
[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)"}
$ReadmeContent = $ReadmeContent | ForEach-Object {$_-replace "!\[Test Coverage\].+\)", "![Test Coverage](https://img.shields.io/badge/coverage-$CodeCoverage%25-yellowgreen.svg)"}
Set-Content -Path $TextFilePath -Value $ReadmeContent
}

Expand All @@ -50,7 +50,7 @@ Function UpdateManifest{

Write-Verbose "Updating $ManifestPath to version $Version"
$ManifestContent = Get-Content $ManifestPath
$ManifestContent = $ManifestContent | %{$_ -replace "ModuleVersion = '(\d|\.)+'", "ModuleVersion = '$Version'"}
$ManifestContent = $ManifestContent | ForEach-Object{$_ -replace "ModuleVersion = '(\d|\.)+'", "ModuleVersion = '$Version'"}
Set-Content -path $ManifestPath -Value $ManifestContent
}

Expand All @@ -65,19 +65,21 @@ $PackageFilePatternExclusions = @(
)

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$Here = 'C:\Users\1113193\OneDrive\GitHub\servicenow-powershell'

$Version = "0.1.13"
$ModuleName = "PSServiceNow"
$PackageName = "$ModuleName-v$($version).zip";
$Version = "0.1.12"
$ModuleName = "PoshServiceNow"
$PackageName = "$ModuleName-v$($version).zip"

# Perform Pester tests
$TestResult = Invoke-Pester -CodeCoverage '*.psm1' -PassThru
$CodeCoverage = Join-Path $Here (Join-Path $ModuleName "$($ModuleName).psm1")
$TestResult = Invoke-Pester -Path $Here -CodeCoverage $CodeCoverage -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
UpdateManifest -ManifestPath "$here\$ModuleName\$ModuleName.psd1" -Version $Version
}

82 changes: 0 additions & 82 deletions PSServiceNow-ConfigurationManagement.psm1

This file was deleted.

188 changes: 0 additions & 188 deletions PSServiceNow-Users.psm1

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<Configuration>
<ViewDefinitions>
<View>
<Name>PSServiceNow.ChangeRequest</Name>
<Name>PoshServiceNow.ChangeRequest</Name>
<ViewSelectedBy>
<TypeName>PSServiceNow.ChangeRequest</TypeName>
<TypeName>PoshServiceNow.ChangeRequest</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
Expand Down
Loading

0 comments on commit a03e8a5

Please sign in to comment.