-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from TheJumpCloud/JumpCloudModule_1.18.0
Jump cloud module 1.18.0
- Loading branch information
Showing
21 changed files
with
718 additions
and
1,933 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,44 +1,39 @@ | ||
. ($PSScriptRoot + '/' + 'Get-Config.ps1') | ||
########################################################################### | ||
$CurrentLocation = Get-Location | ||
Set-Location -Path:($StagingDirectory) | ||
Invoke-GitClone -Repo:($GitSourceRepoWiki) | ||
|
||
### Add step check out support wiki | ||
# $PathToSupportWikiRepo = '' | ||
# $SupportRepoDocs = $PSScriptRoot + '/Docs' | ||
# $SupportWiki = $PathToSupportWikiRepo + '/support.wiki' | ||
# $Docs = Get-ChildItem -Path:($SupportRepoDocs + '/*.md') -Recurse | ||
# ForEach ($Doc In $Docs) | ||
# { | ||
# $DocName = $Doc.Name | ||
# $DocFullName = $Doc.FullName | ||
# $SupportWikiDocFullName = $SupportWiki + '/' + $DocName | ||
# $DocContent = Get-Content -Path:($DocFullName) | ||
# If (Test-Path -Path:($SupportWikiDocFullName)) | ||
# { | ||
# $SupportWikiDocContent = Get-Content -Path:($SupportWikiDocFullName) | ||
# $Diffs = Compare-Object -ReferenceObject:($DocContent) -DifferenceObject:($SupportWikiDocContent) | ||
# If ($Diffs) | ||
# { | ||
# Write-Warning -Message:('Diffs found in: ' + $DocName) | ||
# # are you sure you want to continue? | ||
# } | ||
# } | ||
# Else | ||
# { | ||
# Write-Warning -Message:('Creating new file: ' + $DocName) | ||
# } | ||
# $NewDocContent = If (($DocContent | Select-Object -First 1) -eq '---') | ||
# { | ||
# $DocContent | Select-Object -Skip:(7) | ||
# } | ||
# Else | ||
# { | ||
# $DocContent | ||
# } | ||
# Set-Content -Path:($SupportWikiDocFullName) -Value:($NewDocContent) -Force | ||
# } | ||
# ### Add step check in changes to support wiki | ||
|
||
Set-Location -Path:($CurrentLocation) | ||
$SupportRepoDocs = "$FolderPath_Module/Docs" | ||
$SupportWiki = "$ScriptRoot/support.wiki" | ||
If (!(Test-Path -Path:($SupportWiki))) { New-Item -Path:($SupportWiki) -ItemType:('Directory') } | ||
Set-Location -Path:($SupportWiki) | ||
$Docs = Get-ChildItem -Path:($SupportRepoDocs + '/*.md') -Recurse | ||
ForEach ($Doc In $Docs) | ||
{ | ||
$DocName = $Doc.Name | ||
$DocFullName = $Doc.FullName | ||
$SupportWikiDocFullName = $SupportWiki + '/' + $DocName | ||
$DocContent = Get-Content -Path:($DocFullName) | ||
$NewDocContent = If (($DocContent | Select-Object -First 1) -eq '---') | ||
{ | ||
$DocContent | Select-Object -Skip:(7) | ||
} | ||
Else | ||
{ | ||
$DocContent | ||
} | ||
If (Test-Path -Path:($SupportWikiDocFullName)) | ||
{ | ||
$SupportWikiDocContent = Get-Content -Path:($SupportWikiDocFullName) | ||
$Diffs = Compare-Object -ReferenceObject:($NewDocContent) -DifferenceObject:($SupportWikiDocContent) | ||
If (-not [string]::IsNullOrEmpty($Diffs)) | ||
{ | ||
Write-Warning -Message:('Diffs found in: ' + $DocName) | ||
} | ||
} | ||
Else | ||
{ | ||
Write-Warning -Message:('Creating new file: ' + $DocName) | ||
} | ||
Set-Content -Path:($SupportWikiDocFullName) -Value:($NewDocContent) -Force | ||
} | ||
# Check in changes to support wiki | ||
Invoke-GitCommit -BranchName:($GitSourceRepoWiki) |
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,162 @@ | ||
. ($PSScriptRoot + '/' + 'Get-Config.ps1') | ||
$nuspecFiles = @{ src = 'en-Us/**;Private/**;Public/**;JumpCloud.psd1;JumpCloud.psm1;LICENSE'; } | ||
# Addapted from PowerShell Get | ||
# https://github.com/PowerShell/PowerShellGetv2/blob/7de99ee0c38611556e5c583ffaca98bb1922a0d4/src/PowerShellGet/private/functions/New-NuspecFile.ps1 | ||
function New-NuspecFile | ||
{ | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$OutputPath, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Id, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Version, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Description, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string[]]$Authors, | ||
|
||
[Parameter()] | ||
[string[]]$Owners, | ||
|
||
[Parameter()] | ||
[string]$ReleaseNotes, | ||
|
||
[Parameter()] | ||
[bool]$RequireLicenseAcceptance, | ||
|
||
[Parameter()] | ||
[string]$Copyright, | ||
|
||
[Parameter()] | ||
[string[]]$Tags, | ||
|
||
[Parameter()] | ||
[string]$LicenseUrl, | ||
|
||
[Parameter()] | ||
[string]$ProjectUrl, | ||
|
||
[Parameter()] | ||
[string]$IconUrl, | ||
|
||
[Parameter()] | ||
[PSObject[]]$Dependencies, | ||
|
||
[Parameter()] | ||
[PSObject[]]$Files | ||
|
||
) | ||
Set-StrictMode -Off | ||
|
||
Write-Verbose "Calling New-NuspecFile" | ||
|
||
$nameSpaceUri = "http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd" | ||
[xml]$xml = New-Object System.Xml.XmlDocument | ||
|
||
$xmlDeclaration = $xml.CreateXmlDeclaration("1.0", "utf-8", $null) | ||
$xml.AppendChild($xmlDeclaration) | Out-Null | ||
|
||
#create top-level elements | ||
$packageElement = $xml.CreateElement("package", $nameSpaceUri) | ||
$metaDataElement = $xml.CreateElement("metadata", $nameSpaceUri) | ||
|
||
# warn we're over 4000 characters for standard nuget servers | ||
$tagsString = $Tags -Join " " | ||
if ($tagsString.Length -gt 4000) | ||
{ | ||
Write-Warning -Message "Tag list exceeded 4000 characters and may not be accepted by some Nuget feeds." | ||
} | ||
|
||
$metaDataElementsHash = [ordered]@{ | ||
id = $Id | ||
version = $Version | ||
description = $Description | ||
authors = $Authors -Join "," | ||
owners = $Owners -Join "," | ||
releaseNotes = $ReleaseNotes | ||
requireLicenseAcceptance = $RequireLicenseAcceptance.ToString().ToLower() | ||
copyright = $Copyright | ||
tags = $tagsString | ||
} | ||
|
||
if ($LicenseUrl) { $metaDataElementsHash.Add("licenseUrl", $LicenseUrl) } | ||
if ($ProjectUrl) { $metaDataElementsHash.Add("projectUrl", $ProjectUrl) } | ||
if ($IconUrl) { $metaDataElementsHash.Add("iconUrl", $IconUrl) } | ||
|
||
foreach ($key in $metaDataElementsHash.Keys) | ||
{ | ||
$element = $xml.CreateElement($key, $nameSpaceUri) | ||
$elementInnerText = $metaDataElementsHash.item($key) | ||
$element.InnerText = $elementInnerText | ||
|
||
$metaDataElement.AppendChild($element) | Out-Null | ||
} | ||
|
||
|
||
if ($Dependencies) | ||
{ | ||
$dependenciesElement = $xml.CreateElement("dependencies", $nameSpaceUri) | ||
|
||
foreach ($dependency in $Dependencies) | ||
{ | ||
$element = $xml.CreateElement("dependency", $nameSpaceUri) | ||
# $element. | ||
$element.SetAttribute("id", $dependency) | ||
if ($dependency.version) { $element.SetAttribute("version", $dependency.version) } | ||
|
||
$dependenciesElement.AppendChild($element) | Out-Null | ||
} | ||
$metaDataElement.AppendChild($dependenciesElement) | Out-Null | ||
} | ||
|
||
if ($Files) | ||
{ | ||
$filesElement = $xml.CreateElement("files", $nameSpaceUri) | ||
|
||
foreach ($file in $Files) | ||
{ | ||
$element = $xml.CreateElement("file", $nameSpaceUri) | ||
$element.SetAttribute("src", $file.src) | ||
if ($file.target) { $element.SetAttribute("target", $file.target) } | ||
if ($file.exclude) { $element.SetAttribute("exclude", $file.exclude) } | ||
|
||
$filesElement.AppendChild($element) | Out-Null | ||
} | ||
} | ||
|
||
$packageElement.AppendChild($metaDataElement) | Out-Null | ||
if ($filesElement) { $packageElement.AppendChild($filesElement) | Out-Null } | ||
|
||
$xml.AppendChild($packageElement) | Out-Null | ||
|
||
$nuspecFullName = Join-Path -Path $OutputPath -ChildPath "$Id.nuspec" | ||
$xml.save($nuspecFullName) | ||
|
||
Write-Output $nuspecFullName | ||
} | ||
# Set Variables for New-NuspecFile | ||
$Psd1 = Import-PowerShellDataFile -Path:($FilePath_psd1) | ||
$params = @{ | ||
OutputPath = $FolderPath_Module | ||
Id = $(Get-Item ($FilePath_psd1)).BaseName | ||
Version = $Psd1.ModuleVersion | ||
Authors = $Psd1.Author | ||
Owners = $Psd1.CompanyName | ||
Description = $Psd1.Description | ||
ReleaseNotes = $Psd1.PrivateData.PSData.ReleaseNotes | ||
# RequireLicenseAcceptance = ($requireLicenseAcceptance -eq $true) | ||
Copyright = $Psd1.Copyright | ||
Tags = $Psd1.PrivateData.PSData.Tags | ||
LicenseUrl = $Psd1.PrivateData.PSData.LicenseUri | ||
ProjectUrl = $Psd1.PrivateData.PSData.ProjectUri | ||
IconUrl = $Psd1.PrivateData.PSData.IconUri | ||
Dependencies = $Psd1.RequiredModules | ||
Files = $nuspecFiles | ||
} | ||
New-NuspecFile @params |
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
Oops, something went wrong.