From ed7513e37f3a05d04a2c1e1652e3ca28ded60347 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Sat, 24 Jun 2017 15:07:29 +0200 Subject: [PATCH 1/2] Rename module to new name `JiraPS` is part of #143 --- .github/CONTRIBUTING.md | 14 +- .github/ISSUE_TEMPLATE.md | 2 +- .vscode/tasks.cmd | 4 +- .../Internal/ConvertFrom-Json2.ps1 | 264 ++++++++--------- .../Internal/ConvertTo-JiraComment.ps1 | 2 +- .../Internal/ConvertTo-JiraComponent.ps1 | 2 +- .../ConvertTo-JiraCreateMetaField.ps1 | 4 +- .../Internal/ConvertTo-JiraEditMetaField.ps1 | 198 ++++++------- .../Internal/ConvertTo-JiraField.ps1 | 4 +- .../Internal/ConvertTo-JiraFilter.ps1 | 2 +- .../Internal/ConvertTo-JiraGroup.ps1 | 2 +- .../Internal/ConvertTo-JiraIssue.ps1 | 4 +- .../Internal/ConvertTo-JiraIssueType.ps1 | 4 +- .../Internal/ConvertTo-JiraPriority.ps1 | 4 +- .../Internal/ConvertTo-JiraProject.ps1 | 2 +- .../Internal/ConvertTo-JiraSession.ps1 | 2 +- .../Internal/ConvertTo-JiraStatus.ps1 | 2 +- .../Internal/ConvertTo-JiraTransition.ps1 | 2 +- .../Internal/ConvertTo-JiraUser.ps1 | 2 +- .../Internal/Invoke-JiraMethod.ps1 | 0 .../Internal/Resolve-JiraError.ps1 | 4 +- .../JiraPS.format.ps1xml | 14 +- PSJira/PSJira.psd1 => JiraPS/JiraPS.psd1 | 270 +++++++++--------- PSJira/PSJira.psm1 => JiraPS/JiraPS.psm1 | 4 +- .../Public/Add-JiraGroupMember.ps1 | 2 +- .../Public/Add-JiraIssueComment.ps1 | 8 +- {PSJira => JiraPS}/Public/Format-Jira.ps1 | 0 .../Public/Get-JiraComponent.ps1 | 4 +- .../Public/Get-JiraConfigServer.ps1 | 4 +- {PSJira => JiraPS}/Public/Get-JiraField.ps1 | 4 +- {PSJira => JiraPS}/Public/Get-JiraFilter.ps1 | 8 +- {PSJira => JiraPS}/Public/Get-JiraGroup.ps1 | 10 +- .../Public/Get-JiraGroupMember.ps1 | 6 +- {PSJira => JiraPS}/Public/Get-JiraIssue.ps1 | 10 +- .../Public/Get-JiraIssueComment.ps1 | 6 +- .../Public/Get-JiraIssueCreateMetadata.ps1 | 2 +- .../Public/Get-JiraIssueEditMetadata.ps1 | 192 ++++++------- .../Public/Get-JiraIssueType.ps1 | 0 .../Public/Get-JiraPriority.ps1 | 0 {PSJira => JiraPS}/Public/Get-JiraProject.ps1 | 2 +- {PSJira => JiraPS}/Public/Get-JiraSession.ps1 | 2 +- {PSJira => JiraPS}/Public/Get-JiraUser.ps1 | 8 +- .../Public/Invoke-JiraIssueTransition.ps1 | 8 +- {PSJira => JiraPS}/Public/New-JiraGroup.ps1 | 2 +- {PSJira => JiraPS}/Public/New-JiraIssue.ps1 | 4 +- {PSJira => JiraPS}/Public/New-JiraSession.ps1 | 6 +- {PSJira => JiraPS}/Public/New-JiraUser.ps1 | 2 +- .../Public/Remove-JiraGroup.ps1 | 2 +- .../Public/Remove-JiraGroupMember.ps1 | 2 +- .../Public/Remove-JiraSession.ps1 | 14 +- {PSJira => JiraPS}/Public/Remove-JiraUser.ps1 | 2 +- .../Public/Set-JiraConfigServer.ps1 | 4 +- {PSJira => JiraPS}/Public/Set-JiraIssue.ps1 | 4 +- .../Public/Set-JiraIssueLabel.ps1 | 4 +- {PSJira => JiraPS}/Public/Set-JiraUser.ps1 | 2 +- README.md | 29 +- Tests/Add-JiraGroupMember.Tests.ps1 | 18 +- Tests/Add-JiraIssueComment.Tests.ps1 | 10 +- Tests/ConvertTo-JiraComment.Tests.ps1 | 4 +- Tests/ConvertTo-JiraComponent.Tests.ps1 | 10 +- Tests/ConvertTo-JiraCreateMetaField.Tests.ps1 | 4 +- Tests/ConvertTo-JiraEditMetaField.Tests.ps1 | 4 +- Tests/ConvertTo-JiraField.Tests.ps1 | 4 +- Tests/ConvertTo-JiraFilter.Tests.ps1 | 4 +- Tests/ConvertTo-JiraGroup.Tests.ps1 | 4 +- Tests/ConvertTo-JiraIssue.Tests.ps1 | 22 +- Tests/ConvertTo-JiraIssueType.Tests.ps1 | 4 +- Tests/ConvertTo-JiraPriority.Tests.ps1 | 4 +- Tests/ConvertTo-JiraProject.Tests.ps1 | 4 +- Tests/ConvertTo-JiraSession.Tests.ps1 | 4 +- Tests/ConvertTo-JiraStatus.Tests.ps1 | 4 +- Tests/ConvertTo-JiraTransition.Tests.ps1 | 6 +- Tests/ConvertTo-JiraUser.Tests.ps1 | 4 +- Tests/Format-Jira.Tests.ps1 | 2 +- Tests/Get-JiraComponent.Tests.ps1 | 8 +- Tests/Get-JiraConfigServer.Tests.ps1 | 2 +- Tests/Get-JiraField.Tests.ps1 | 8 +- Tests/Get-JiraFilter.Tests.ps1 | 26 +- Tests/Get-JiraGroup.Tests.ps1 | 8 +- Tests/Get-JiraGroupMember.Tests.ps1 | 22 +- Tests/Get-JiraIssue.Tests.ps1 | 18 +- Tests/Get-JiraIssueComment.Tests.ps1 | 18 +- Tests/Get-JiraIssueCreateMetadata.Tests.ps1 | 18 +- Tests/Get-JiraIssueEditMetadata.Tests.ps1 | 16 +- Tests/Get-JiraIssueType.Tests.ps1 | 10 +- Tests/Get-JiraPriority.Tests.ps1 | 14 +- Tests/Get-JiraProject.Tests.ps1 | 14 +- Tests/Get-JiraSession.Tests.ps1 | 4 +- Tests/Get-JiraUser.Tests.ps1 | 12 +- Tests/Invoke-JiraIssueTransition.Tests.ps1 | 26 +- Tests/Invoke-JiraMethod.Tests.ps1 | 4 +- Tests/{PSJira.Tests.ps1 => JiraPS.Tests.ps1} | 10 +- Tests/New-JiraGroup.Tests.ps1 | 12 +- Tests/New-JiraIssue.Tests.ps1 | 4 +- Tests/New-JiraSession.Tests.ps1 | 4 +- Tests/New-JiraUser.Tests.ps1 | 8 +- Tests/Remove-JiraGroup.Tests.ps1 | 14 +- Tests/Remove-JiraGroupMember.Tests.ps1 | 18 +- Tests/Remove-JiraSession.Tests.ps1 | 6 +- Tests/Remove-JiraUser.Tests.ps1 | 14 +- Tests/Resolve-JiraError.Tests.ps1 | 2 +- Tests/Set-JiraConfigServer.Tests.ps1 | 2 +- Tests/Set-JiraIssue.Tests.ps1 | 34 +-- Tests/Set-JiraIssueLabel.Tests.ps1 | 22 +- Tests/Set-JiraUser.Tests.ps1 | 14 +- Tests/Shared.ps1 | 4 +- Tools/Appveyor.ps1 | 6 +- Tools/Deploy.ps1 | 4 +- Tools/Pre-Push.ps1 | 4 +- Tools/psake.ps1 | 8 +- appveyor.yml | 4 +- docs/Makefile | 4 +- docs/authentication.rst | 8 +- docs/conf.py | 22 +- docs/contributing.rst | 20 +- docs/creating_issues.rst | 6 +- docs/custom_fields.rst | 6 +- docs/getting_started.rst | 16 +- docs/index.rst | 16 +- docs/make.bat | 2 +- 120 files changed, 902 insertions(+), 901 deletions(-) rename {PSJira => JiraPS}/Internal/ConvertFrom-Json2.ps1 (96%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraComment.ps1 (97%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraComponent.ps1 (95%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraCreateMetaField.ps1 (96%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraEditMetaField.ps1 (94%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraField.ps1 (95%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraFilter.ps1 (97%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraGroup.ps1 (96%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraIssue.ps1 (97%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraIssueType.ps1 (94%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraPriority.ps1 (94%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraProject.ps1 (96%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraSession.ps1 (95%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraStatus.ps1 (94%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraTransition.ps1 (95%) rename {PSJira => JiraPS}/Internal/ConvertTo-JiraUser.ps1 (96%) rename {PSJira => JiraPS}/Internal/Invoke-JiraMethod.ps1 (100%) rename {PSJira => JiraPS}/Internal/Resolve-JiraError.ps1 (94%) rename PSJira/PSJira.format.ps1xml => JiraPS/JiraPS.format.ps1xml (93%) rename PSJira/PSJira.psd1 => JiraPS/JiraPS.psd1 (92%) rename PSJira/PSJira.psm1 => JiraPS/JiraPS.psm1 (90%) rename {PSJira => JiraPS}/Public/Add-JiraGroupMember.ps1 (98%) rename {PSJira => JiraPS}/Public/Add-JiraIssueComment.ps1 (95%) rename {PSJira => JiraPS}/Public/Format-Jira.ps1 (100%) rename {PSJira => JiraPS}/Public/Get-JiraComponent.ps1 (98%) rename {PSJira => JiraPS}/Public/Get-JiraConfigServer.ps1 (97%) rename {PSJira => JiraPS}/Public/Get-JiraField.ps1 (96%) rename {PSJira => JiraPS}/Public/Get-JiraFilter.ps1 (94%) rename {PSJira => JiraPS}/Public/Get-JiraGroup.ps1 (95%) rename {PSJira => JiraPS}/Public/Get-JiraGroupMember.ps1 (97%) rename {PSJira => JiraPS}/Public/Get-JiraIssue.ps1 (96%) rename {PSJira => JiraPS}/Public/Get-JiraIssueComment.ps1 (92%) rename {PSJira => JiraPS}/Public/Get-JiraIssueCreateMetadata.ps1 (98%) rename {PSJira => JiraPS}/Public/Get-JiraIssueEditMetadata.ps1 (96%) rename {PSJira => JiraPS}/Public/Get-JiraIssueType.ps1 (100%) rename {PSJira => JiraPS}/Public/Get-JiraPriority.ps1 (100%) rename {PSJira => JiraPS}/Public/Get-JiraProject.ps1 (99%) rename {PSJira => JiraPS}/Public/Get-JiraSession.ps1 (95%) rename {PSJira => JiraPS}/Public/Get-JiraUser.ps1 (96%) rename {PSJira => JiraPS}/Public/Invoke-JiraIssueTransition.ps1 (95%) rename {PSJira => JiraPS}/Public/New-JiraGroup.ps1 (97%) rename {PSJira => JiraPS}/Public/New-JiraIssue.ps1 (98%) rename {PSJira => JiraPS}/Public/New-JiraSession.ps1 (96%) rename {PSJira => JiraPS}/Public/New-JiraUser.ps1 (98%) rename {PSJira => JiraPS}/Public/Remove-JiraGroup.ps1 (98%) rename {PSJira => JiraPS}/Public/Remove-JiraGroupMember.ps1 (98%) rename {PSJira => JiraPS}/Public/Remove-JiraSession.ps1 (93%) rename {PSJira => JiraPS}/Public/Remove-JiraUser.ps1 (98%) rename {PSJira => JiraPS}/Public/Set-JiraConfigServer.ps1 (97%) rename {PSJira => JiraPS}/Public/Set-JiraIssue.ps1 (98%) rename {PSJira => JiraPS}/Public/Set-JiraIssueLabel.ps1 (98%) rename {PSJira => JiraPS}/Public/Set-JiraUser.ps1 (98%) rename Tests/{PSJira.Tests.ps1 => JiraPS.Tests.ps1} (97%) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c15d28b7..d0fe5109 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,8 +1,8 @@ -# Contributing to PSJira +# Contributing to JiraPS ----------- We welcome and appreciate contributions from the community. -There are many ways to become involved with PSJira: +There are many ways to become involved with JiraPS: * including filing issues, * joining in design conversations, * writing and improving documentation, @@ -35,14 +35,14 @@ _not yet defined_ ### Building and testing -#### Testing PSJira +#### Testing JiraPS Please see PowerShell [Testing Guidelines - Running Tests Outside of CI][running-tests-outside-of-ci] on how to test you build locally. ### Finding or creating an issue 1. Follow the instructions in [Contributing to Issues][contribute-issues] to find or open an issue. -2. Mention in the issue that you are working on the issue and ask `@PSJira/moderators` for an assignment. +2. Mention in the issue that you are working on the issue and ask `@AtlassianPS/moderators` for an assignment. ### Forks and Pull Requests @@ -142,9 +142,9 @@ See [Contributing to documentation related to PowerShell](#contributing-to-docum * An Author is encouraged to choose Reviewer(s) and an Assignee for the PR. If no Assignee is chosen, one of the Maintainers shall be assigned to it. If no Reviewer is chosen, the Assignee shall choose Reviewer(s) as appropriate. - * If an Author is a [PSJira Team](https://github.com/orgs/PSJira/people) member, + * If an Author is a [AtlassianPS Team](https://github.com/orgs/AtlassianPS/people) member, then the Author **is required** to choose Reviewer(s) and an Assignee for the PR. - * For a PR to be merged, it must be approved by at least one PSJira Team member or Collaborator, + * For a PR to be merged, it must be approved by at least one JiraPS Team member or Collaborator, so additional Reviewer(s) may be added by the Assignee as appropriate. The Assignee may also be re-assigned by Maintainers. @@ -238,7 +238,7 @@ is also appropriate, as is using Markdown syntax. and John Gruber's [Markdown syntax](https://daringfireball.net/projects/markdown/syntax). * Don't commit code that you didn't write. - If you find code that you think is a good fit to add to PSJira, + If you find code that you think is a good fit to add to JiraPS, file an issue and start a discussion before proceeding. * Create and/or update tests when making code changes. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 7752cb3b..08a4bc29 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -27,6 +27,6 @@ > ```posh -> Get-Module PSJira -ListAvailable | select version +> Get-Module JiraPS -ListAvailable | select version > $PSVersionTable > ``` diff --git a/.vscode/tasks.cmd b/.vscode/tasks.cmd index 6bbe21f1..f5ab7182 100644 --- a/.vscode/tasks.cmd +++ b/.vscode/tasks.cmd @@ -2,8 +2,8 @@ @echo off if "%1" == "!" goto start chcp 65001 > nul -PowerShell.exe -NoProfile -ExecutionPolicy Bypass "& 'D:\Documents\Projects\PSJira\Build\Invoke-Build.ps1' -File 'D:\Documents\Projects\PSJira\Build\PSJira.build.ps1' %1" +PowerShell.exe -NoProfile -ExecutionPolicy Bypass "& 'D:\Documents\Projects\JiraPS\Build\Invoke-Build.ps1' -File 'D:\Documents\Projects\JiraPS\Build\JiraPS.build.ps1' %1" exit :start shift -start PowerShell.exe -NoExit -NoProfile -ExecutionPolicy Bypass "& 'D:\Documents\Projects\PSJira\Build\Invoke-Build.ps1' -File 'D:\Documents\Projects\PSJira\Build\PSJira.build.ps1' %1" +start PowerShell.exe -NoExit -NoProfile -ExecutionPolicy Bypass "& 'D:\Documents\Projects\JiraPS\Build\Invoke-Build.ps1' -File 'D:\Documents\Projects\JiraPS\Build\JiraPS.build.ps1' %1" diff --git a/PSJira/Internal/ConvertFrom-Json2.ps1 b/JiraPS/Internal/ConvertFrom-Json2.ps1 similarity index 96% rename from PSJira/Internal/ConvertFrom-Json2.ps1 rename to JiraPS/Internal/ConvertFrom-Json2.ps1 index 5fac46ba..1b6669ad 100644 --- a/PSJira/Internal/ConvertFrom-Json2.ps1 +++ b/JiraPS/Internal/ConvertFrom-Json2.ps1 @@ -1,132 +1,132 @@ -function ConvertFrom-Json2 -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, - ValueFromPipeline = $true, - Position = 0)] - [Object[]] $InputObject, - - [Parameter()] - [int] $MaxJsonLength = [int]::MaxValue - ) - - begin { - function PopulateJsonFrom-Dictionary - { - param - ( - [System.Collections.Generic.IDictionary`2[String,Object]]$InputObject - ) - - process - { - $returnObject = New-Object PSObject - - foreach($key in $InputObject.Keys) - { - $pairObjectValue = $InputObject[$key] - - if ($pairObjectValue -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) - { - $pairObjectValue = PopulateJsonFrom-Dictionary $pairObjectValue - } - elseif ($pairObjectValue -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) - { - $pairObjectValue = PopulateJsonFrom-Collection $pairObjectValue - } - - $returnObject | Add-Member Noteproperty $key $pairObjectValue - } - - return $returnObject - } - } - - function PopulateJsonFrom-Collection - { - param - ( - [System.Collections.Generic.ICollection`1[Object]]$InputObject - ) - - process - { - $returnList = New-Object ([System.Collections.Generic.List`1].MakeGenericType([Object])) - foreach($jsonObject in $InputObject) - { - $jsonObjectValue = $jsonObject - - if ($jsonObjectValue -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) - { - $jsonObjectValue = PopulateJsonFrom-Dictionary $jsonObjectValue - } - elseif ($jsonObjectValue -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) - { - $jsonObjectValue = PopulateJsonFrom-Collection $jsonObjectValue - } - - $returnList.Add($jsonObjectValue) | Out-Null - } - - return $returnList.ToArray() - } - } - - $scriptAssembly = [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") - - $typeResolver = @" -public class JsonObjectTypeResolver : System.Web.Script.Serialization.JavaScriptTypeResolver -{ - public override System.Type ResolveType(string id) - { - return typeof (System.Collections.Generic.Dictionary); - } - - public override string ResolveTypeId(System.Type type) - { - return string.Empty; - } -} -"@ - - try { - Add-Type -TypeDefinition $typeResolver -ReferencedAssemblies $scriptAssembly.FullName - } - catch { - # This is a relatively common error that's harmless unless changing the actual C# - # code, so it can be ignored. Unfortunately, it's just a plain old System.Exception, - # so we can't try to catch a specific error type. - if (-not $_.ToString() -like "*The type name 'JsonObjectTypeResolver' already exists*") - { - throw $_ - } - } - - $jsonserial = New-Object System.Web.Script.Serialization.JavaScriptSerializer(New-Object JsonObjectTypeResolver) - $jsonserial.MaxJsonLength = $MaxJsonLength - } - - process - { - foreach ($i in $InputObject) - { - $s = $i.ToString() - if ($s) { - $jsonTree = $jsonserial.DeserializeObject($s) - - if ($jsonTree -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) - { - $jsonTree = PopulateJsonFrom-Dictionary $jsonTree - } - elseif ($jsonTree -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) - { - $jsonTree = PopulateJsonFrom-Collection $jsonTree - } - - Write-Output $jsonTree - } - } - } -} +function ConvertFrom-Json2 +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true, + ValueFromPipeline = $true, + Position = 0)] + [Object[]] $InputObject, + + [Parameter()] + [int] $MaxJsonLength = [int]::MaxValue + ) + + begin { + function PopulateJsonFrom-Dictionary + { + param + ( + [System.Collections.Generic.IDictionary`2[String,Object]]$InputObject + ) + + process + { + $returnObject = New-Object PSObject + + foreach($key in $InputObject.Keys) + { + $pairObjectValue = $InputObject[$key] + + if ($pairObjectValue -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) + { + $pairObjectValue = PopulateJsonFrom-Dictionary $pairObjectValue + } + elseif ($pairObjectValue -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) + { + $pairObjectValue = PopulateJsonFrom-Collection $pairObjectValue + } + + $returnObject | Add-Member Noteproperty $key $pairObjectValue + } + + return $returnObject + } + } + + function PopulateJsonFrom-Collection + { + param + ( + [System.Collections.Generic.ICollection`1[Object]]$InputObject + ) + + process + { + $returnList = New-Object ([System.Collections.Generic.List`1].MakeGenericType([Object])) + foreach($jsonObject in $InputObject) + { + $jsonObjectValue = $jsonObject + + if ($jsonObjectValue -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) + { + $jsonObjectValue = PopulateJsonFrom-Dictionary $jsonObjectValue + } + elseif ($jsonObjectValue -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) + { + $jsonObjectValue = PopulateJsonFrom-Collection $jsonObjectValue + } + + $returnList.Add($jsonObjectValue) | Out-Null + } + + return $returnList.ToArray() + } + } + + $scriptAssembly = [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") + + $typeResolver = @" +public class JsonObjectTypeResolver : System.Web.Script.Serialization.JavaScriptTypeResolver +{ + public override System.Type ResolveType(string id) + { + return typeof (System.Collections.Generic.Dictionary); + } + + public override string ResolveTypeId(System.Type type) + { + return string.Empty; + } +} +"@ + + try { + Add-Type -TypeDefinition $typeResolver -ReferencedAssemblies $scriptAssembly.FullName + } + catch { + # This is a relatively common error that's harmless unless changing the actual C# + # code, so it can be ignored. Unfortunately, it's just a plain old System.Exception, + # so we can't try to catch a specific error type. + if (-not $_.ToString() -like "*The type name 'JsonObjectTypeResolver' already exists*") + { + throw $_ + } + } + + $jsonserial = New-Object System.Web.Script.Serialization.JavaScriptSerializer(New-Object JsonObjectTypeResolver) + $jsonserial.MaxJsonLength = $MaxJsonLength + } + + process + { + foreach ($i in $InputObject) + { + $s = $i.ToString() + if ($s) { + $jsonTree = $jsonserial.DeserializeObject($s) + + if ($jsonTree -is [System.Collections.Generic.IDictionary`2].MakeGenericType([String],[Object])) + { + $jsonTree = PopulateJsonFrom-Dictionary $jsonTree + } + elseif ($jsonTree -is [System.Collections.Generic.ICollection`1].MakeGenericType([Object])) + { + $jsonTree = PopulateJsonFrom-Collection $jsonTree + } + + Write-Output $jsonTree + } + } + } +} diff --git a/PSJira/Internal/ConvertTo-JiraComment.ps1 b/JiraPS/Internal/ConvertTo-JiraComment.ps1 similarity index 97% rename from PSJira/Internal/ConvertTo-JiraComment.ps1 rename to JiraPS/Internal/ConvertTo-JiraComment.ps1 index 223788e4..a449da40 100644 --- a/PSJira/Internal/ConvertTo-JiraComment.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraComment.ps1 @@ -53,7 +53,7 @@ function ConvertTo-JiraComment $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraComment] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Comment') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Comment') # Write-Debug "[ConvertTo-JiraComment] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraComponent.ps1 b/JiraPS/Internal/ConvertTo-JiraComponent.ps1 similarity index 95% rename from PSJira/Internal/ConvertTo-JiraComponent.ps1 rename to JiraPS/Internal/ConvertTo-JiraComponent.ps1 index ed793e0d..d2844f5f 100644 --- a/PSJira/Internal/ConvertTo-JiraComponent.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraComponent.ps1 @@ -37,7 +37,7 @@ function ConvertTo-JiraComponent $result = New-Object -TypeName PSObject -Property $props # Write-Debug "Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Component') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Component') # Write-Debug "[ConvertTo-JiraComponent] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraCreateMetaField.ps1 b/JiraPS/Internal/ConvertTo-JiraCreateMetaField.ps1 similarity index 96% rename from PSJira/Internal/ConvertTo-JiraCreateMetaField.ps1 rename to JiraPS/Internal/ConvertTo-JiraCreateMetaField.ps1 index f7139356..fb5f06d3 100644 --- a/PSJira/Internal/ConvertTo-JiraCreateMetaField.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraCreateMetaField.ps1 @@ -28,7 +28,7 @@ function ConvertTo-JiraCreateMetaField } $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') Write-Output $result } @@ -76,7 +76,7 @@ function ConvertTo-JiraCreateMetaField $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraCreateMetaField] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.CreateMetaField') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.CreateMetaField') # Write-Debug "[ConvertTo-JiraCreateMetaField] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraEditMetaField.ps1 b/JiraPS/Internal/ConvertTo-JiraEditMetaField.ps1 similarity index 94% rename from PSJira/Internal/ConvertTo-JiraEditMetaField.ps1 rename to JiraPS/Internal/ConvertTo-JiraEditMetaField.ps1 index 958a2ef0..337af2a4 100644 --- a/PSJira/Internal/ConvertTo-JiraEditMetaField.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraEditMetaField.ps1 @@ -1,99 +1,99 @@ -function ConvertTo-JiraEditMetaField -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $true, - Position = 0, - ValueFromPipeline = $true)] - [PSObject[]] $InputObject, - - [Switch] $ReturnError - ) - - process - { - foreach ($i in $InputObject) - { - Write-Debug "[ConvertTo-JiraEditMetaField] Processing object: '$i'" - - if ($i.errorMessages) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Detected an errorMessages property. This is an error result." - - if ($ReturnError) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Outputting details about error message" - $props = @{ - 'ErrorMessages' = $i.errorMessages; - } - - $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') - - Write-Output $result - } - } else { - $fields = $i.fields - $fieldNames = (Get-Member -InputObject $fields -MemberType '*Property').Name - foreach ($f in $fieldNames) - { - Write-Debug "[ConvertTo-JiraEditMetaField] Processing field [$f]" - $item = $fields.$f - - $props = @{ - 'Id' = $f; - 'Name' = $item.name; - 'HasDefaultValue' = [System.Convert]::ToBoolean($item.hasDefaultValue); - 'Required' = [System.Convert]::ToBoolean($item.required); - 'Schema' = $item.schema; - 'Operations' = $item.operations; - } - - if ($item.allowedValues) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Adding AllowedValues" - $props.AllowedValues = $item.allowedValues - } - - if ($item.autoCompleteUrl) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Adding AutoCompleteURL" - $props.AutoCompleteUrl = $item.autoCompleteUrl - } - -# Write-Debug "[ConvertTo-JiraEditMetaField] Checking for any additional properties" - foreach ($extraProperty in (Get-Member -InputObject $item -MemberType NoteProperty).Name) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Checking property $extraProperty" - if ($props.$extraProperty -eq $null) - { -# Write-Debug "[ConvertTo-JiraEditMetaField] - Adding property [$extraProperty]" - $props.$extraProperty = $item.$extraProperty - } - } - -# Write-Debug "[ConvertTo-JiraEditMetaField] Creating PSObject out of properties" - $result = New-Object -TypeName PSObject -Property $props - -# Write-Debug "[ConvertTo-JiraEditMetaField] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.EditMetaField') - -# Write-Debug "[ConvertTo-JiraEditMetaField] Inserting custom toString() method" - $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { - Write-Output "$($this.Name)" - } - -# Write-Debug "[ConvertTo-JiraEditMetaField] Outputting object" - Write-Output $result - } - } - } - } - - end - { -# Write-Debug "[ConvertTo-JiraEditMetaField] Complete" - } -} - - +function ConvertTo-JiraEditMetaField +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, + Position = 0, + ValueFromPipeline = $true)] + [PSObject[]] $InputObject, + + [Switch] $ReturnError + ) + + process + { + foreach ($i in $InputObject) + { + Write-Debug "[ConvertTo-JiraEditMetaField] Processing object: '$i'" + + if ($i.errorMessages) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Detected an errorMessages property. This is an error result." + + if ($ReturnError) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Outputting details about error message" + $props = @{ + 'ErrorMessages' = $i.errorMessages; + } + + $result = New-Object -TypeName PSObject -Property $props + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') + + Write-Output $result + } + } else { + $fields = $i.fields + $fieldNames = (Get-Member -InputObject $fields -MemberType '*Property').Name + foreach ($f in $fieldNames) + { + Write-Debug "[ConvertTo-JiraEditMetaField] Processing field [$f]" + $item = $fields.$f + + $props = @{ + 'Id' = $f; + 'Name' = $item.name; + 'HasDefaultValue' = [System.Convert]::ToBoolean($item.hasDefaultValue); + 'Required' = [System.Convert]::ToBoolean($item.required); + 'Schema' = $item.schema; + 'Operations' = $item.operations; + } + + if ($item.allowedValues) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Adding AllowedValues" + $props.AllowedValues = $item.allowedValues + } + + if ($item.autoCompleteUrl) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Adding AutoCompleteURL" + $props.AutoCompleteUrl = $item.autoCompleteUrl + } + +# Write-Debug "[ConvertTo-JiraEditMetaField] Checking for any additional properties" + foreach ($extraProperty in (Get-Member -InputObject $item -MemberType NoteProperty).Name) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Checking property $extraProperty" + if ($props.$extraProperty -eq $null) + { +# Write-Debug "[ConvertTo-JiraEditMetaField] - Adding property [$extraProperty]" + $props.$extraProperty = $item.$extraProperty + } + } + +# Write-Debug "[ConvertTo-JiraEditMetaField] Creating PSObject out of properties" + $result = New-Object -TypeName PSObject -Property $props + +# Write-Debug "[ConvertTo-JiraEditMetaField] Inserting type name information" + $result.PSObject.TypeNames.Insert(0, 'JiraPS.EditMetaField') + +# Write-Debug "[ConvertTo-JiraEditMetaField] Inserting custom toString() method" + $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { + Write-Output "$($this.Name)" + } + +# Write-Debug "[ConvertTo-JiraEditMetaField] Outputting object" + Write-Output $result + } + } + } + } + + end + { +# Write-Debug "[ConvertTo-JiraEditMetaField] Complete" + } +} + + diff --git a/PSJira/Internal/ConvertTo-JiraField.ps1 b/JiraPS/Internal/ConvertTo-JiraField.ps1 similarity index 95% rename from PSJira/Internal/ConvertTo-JiraField.ps1 rename to JiraPS/Internal/ConvertTo-JiraField.ps1 index 57a44ded..8cace0f6 100644 --- a/PSJira/Internal/ConvertTo-JiraField.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraField.ps1 @@ -31,7 +31,7 @@ function ConvertTo-JiraField } $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') Write-Output $result } @@ -55,7 +55,7 @@ function ConvertTo-JiraField $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraField] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Field') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Field') # Write-Debug "[ConvertTo-JiraField] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraFilter.ps1 b/JiraPS/Internal/ConvertTo-JiraFilter.ps1 similarity index 97% rename from PSJira/Internal/ConvertTo-JiraFilter.ps1 rename to JiraPS/Internal/ConvertTo-JiraFilter.ps1 index 0f36435f..7fba8bf8 100644 --- a/PSJira/Internal/ConvertTo-JiraFilter.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraFilter.ps1 @@ -45,7 +45,7 @@ function ConvertTo-JiraFilter $result = New-Object -TypeName PSObject -Property $props # Write-Debug '[ConvertTo-JiraFilter] Inserting type name information' - $result.PSObject.TypeNames.Insert(0, 'PSJira.Filter') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Filter') # Write-Debug '[ConvertTo-JiraFilter] Inserting custom toString() method' $result | Add-Member -MemberType ScriptMethod -Name 'ToString' -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraGroup.ps1 b/JiraPS/Internal/ConvertTo-JiraGroup.ps1 similarity index 96% rename from PSJira/Internal/ConvertTo-JiraGroup.ps1 rename to JiraPS/Internal/ConvertTo-JiraGroup.ps1 index 0b79b077..bb3441c0 100644 --- a/PSJira/Internal/ConvertTo-JiraGroup.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraGroup.ps1 @@ -42,7 +42,7 @@ function ConvertTo-JiraGroup $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraGroup] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Group') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Group') # Write-Debug "[ConvertTo-JiraGroup] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraIssue.ps1 b/JiraPS/Internal/ConvertTo-JiraIssue.ps1 similarity index 97% rename from PSJira/Internal/ConvertTo-JiraIssue.ps1 rename to JiraPS/Internal/ConvertTo-JiraIssue.ps1 index 02a56b11..4d1c9176 100644 --- a/PSJira/Internal/ConvertTo-JiraIssue.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraIssue.ps1 @@ -42,7 +42,7 @@ function ConvertTo-JiraIssue } $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') Write-Output $result } @@ -133,7 +133,7 @@ function ConvertTo-JiraIssue $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraIssue] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Issue') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Issue') # Write-Debug "[ConvertTo-JiraProject] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraIssueType.ps1 b/JiraPS/Internal/ConvertTo-JiraIssueType.ps1 similarity index 94% rename from PSJira/Internal/ConvertTo-JiraIssueType.ps1 rename to JiraPS/Internal/ConvertTo-JiraIssueType.ps1 index 1bfbff4c..282d2894 100644 --- a/PSJira/Internal/ConvertTo-JiraIssueType.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraIssueType.ps1 @@ -31,7 +31,7 @@ function ConvertTo-JiraIssueType } $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') Write-Output $result } @@ -53,7 +53,7 @@ function ConvertTo-JiraIssueType $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraIssueType] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.IssueType') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.IssueType') # Write-Debug "[ConvertTo-JiraIssueType] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraPriority.ps1 b/JiraPS/Internal/ConvertTo-JiraPriority.ps1 similarity index 94% rename from PSJira/Internal/ConvertTo-JiraPriority.ps1 rename to JiraPS/Internal/ConvertTo-JiraPriority.ps1 index 596a0bea..1af53d13 100644 --- a/PSJira/Internal/ConvertTo-JiraPriority.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraPriority.ps1 @@ -31,7 +31,7 @@ function ConvertTo-JiraPriority } $result = New-Object -TypeName PSObject -Property $props - $result.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Error') Write-Output $result } @@ -53,7 +53,7 @@ function ConvertTo-JiraPriority $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraPriority] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Priority') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Priority') # Write-Debug "[ConvertTo-JiraPriority] Outputting object" Write-Output $result diff --git a/PSJira/Internal/ConvertTo-JiraProject.ps1 b/JiraPS/Internal/ConvertTo-JiraProject.ps1 similarity index 96% rename from PSJira/Internal/ConvertTo-JiraProject.ps1 rename to JiraPS/Internal/ConvertTo-JiraProject.ps1 index 361c54c1..836286a7 100644 --- a/PSJira/Internal/ConvertTo-JiraProject.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraProject.ps1 @@ -40,7 +40,7 @@ function ConvertTo-JiraProject $result = New-Object -TypeName PSObject -Property $props # Write-Debug "Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Project') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Project') # Write-Debug "[ConvertTo-JiraProject] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraSession.ps1 b/JiraPS/Internal/ConvertTo-JiraSession.ps1 similarity index 95% rename from PSJira/Internal/ConvertTo-JiraSession.ps1 rename to JiraPS/Internal/ConvertTo-JiraSession.ps1 index ec1ed758..91fcfa99 100644 --- a/PSJira/Internal/ConvertTo-JiraSession.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraSession.ps1 @@ -33,7 +33,7 @@ function ConvertTo-JiraSession $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraSession] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Session') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Session') # Write-Debug "[ConvertTo-JiraSession] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraStatus.ps1 b/JiraPS/Internal/ConvertTo-JiraStatus.ps1 similarity index 94% rename from PSJira/Internal/ConvertTo-JiraStatus.ps1 rename to JiraPS/Internal/ConvertTo-JiraStatus.ps1 index de20a043..4f4f43e7 100644 --- a/PSJira/Internal/ConvertTo-JiraStatus.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraStatus.ps1 @@ -31,7 +31,7 @@ function ConvertTo-JiraStatus $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraStatus] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Status') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Status') # Write-Debug "[ConvertTo-JiraStatus] Outputting object" Write-Output $result diff --git a/PSJira/Internal/ConvertTo-JiraTransition.ps1 b/JiraPS/Internal/ConvertTo-JiraTransition.ps1 similarity index 95% rename from PSJira/Internal/ConvertTo-JiraTransition.ps1 rename to JiraPS/Internal/ConvertTo-JiraTransition.ps1 index e82ba9d5..c163312f 100644 --- a/PSJira/Internal/ConvertTo-JiraTransition.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraTransition.ps1 @@ -26,7 +26,7 @@ function ConvertTo-JiraTransition $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraTransition] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.Transition') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.Transition') # Write-Debug "[ConvertTo-JiraProject] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/ConvertTo-JiraUser.ps1 b/JiraPS/Internal/ConvertTo-JiraUser.ps1 similarity index 96% rename from PSJira/Internal/ConvertTo-JiraUser.ps1 rename to JiraPS/Internal/ConvertTo-JiraUser.ps1 index 711de446..45c10aa6 100644 --- a/PSJira/Internal/ConvertTo-JiraUser.ps1 +++ b/JiraPS/Internal/ConvertTo-JiraUser.ps1 @@ -35,7 +35,7 @@ function ConvertTo-JiraUser $result = New-Object -TypeName PSObject -Property $props # Write-Debug "[ConvertTo-JiraUser] Inserting type name information" - $result.PSObject.TypeNames.Insert(0, 'PSJira.User') + $result.PSObject.TypeNames.Insert(0, 'JiraPS.User') # Write-Debug "[ConvertTo-JiraUser] Inserting custom toString() method" $result | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { diff --git a/PSJira/Internal/Invoke-JiraMethod.ps1 b/JiraPS/Internal/Invoke-JiraMethod.ps1 similarity index 100% rename from PSJira/Internal/Invoke-JiraMethod.ps1 rename to JiraPS/Internal/Invoke-JiraMethod.ps1 diff --git a/PSJira/Internal/Resolve-JiraError.ps1 b/JiraPS/Internal/Resolve-JiraError.ps1 similarity index 94% rename from PSJira/Internal/Resolve-JiraError.ps1 rename to JiraPS/Internal/Resolve-JiraError.ps1 index 85c67a99..5f88094d 100644 --- a/PSJira/Internal/Resolve-JiraError.ps1 +++ b/JiraPS/Internal/Resolve-JiraError.ps1 @@ -29,7 +29,7 @@ 'Message' = $e; } - $obj.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $obj.PSObject.TypeNames.Insert(0, 'JiraPS.Error') $obj | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { Write-Output "Jira error [$($this.Message)" } @@ -51,7 +51,7 @@ 'Message' = $i.errors.$k; } - $obj.PSObject.TypeNames.Insert(0, 'PSJira.Error') + $obj.PSObject.TypeNames.Insert(0, 'JiraPS.Error') $obj | Add-Member -MemberType ScriptMethod -Name "ToString" -Force -Value { Write-Output "Jira error [$($this.ID)]: $($this.Message)" } diff --git a/PSJira/PSJira.format.ps1xml b/JiraPS/JiraPS.format.ps1xml similarity index 93% rename from PSJira/PSJira.format.ps1xml rename to JiraPS/JiraPS.format.ps1xml index 58fad9c2..32e8192c 100644 --- a/PSJira/PSJira.format.ps1xml +++ b/JiraPS/JiraPS.format.ps1xml @@ -2,9 +2,9 @@ - PSJira-Issue-TableView + JiraPS-Issue-TableView - PSJira.Issue + JiraPS.Issue @@ -49,9 +49,9 @@ - PSJira-User-TableView + JiraPS-User-TableView - PSJira.User + JiraPS.User @@ -90,9 +90,9 @@ - \ No newline at end of file + diff --git a/PSJira/PSJira.psd1 b/JiraPS/JiraPS.psd1 similarity index 92% rename from PSJira/PSJira.psd1 rename to JiraPS/JiraPS.psd1 index 6263c01d..dbf9d240 100644 --- a/PSJira/PSJira.psd1 +++ b/JiraPS/JiraPS.psd1 @@ -1,135 +1,135 @@ -# -# Module manifest for module 'PSGet_PSJira' -# -# Generated by: Joshua T -# -# Generated on: 8/21/2016 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'PSJira.psm1' - -# Version number of this module. -ModuleVersion = '1.2.5' - -# Supported PSEditions -# CompatiblePSEditions = @() - -# ID used to uniquely identify this module -GUID = '4bf3eb15-037e-43b7-9e47-20a30436324f' - -# Author of this module -Author = 'Joshua T' - -# Company or vendor of this module -CompanyName = 'Unknown' - -# Copyright statement for this module -Copyright = '(c) 2015 Joshua T. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Windows PowerShell module to interact with Atlassian JIRA' - -# 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. 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 = 'System.Web' - -# 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 = 'PSJira.format.ps1xml' - -# 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 = 'Add-JiraGroupMember', 'Add-JiraIssueComment', 'Get-JiraComponent', 'Format-Jira', - 'Get-JiraConfigServer', 'Get-JiraField', 'Get-JiraFilter', - 'Get-JiraGroup', 'Get-JiraGroupMember', 'Get-JiraIssue', - 'Get-JiraIssueComment', 'Get-JiraIssueCreateMetadata', 'Get-JiraIssueEditMetadata', - 'Get-JiraIssueType', 'Get-JiraPriority', 'Get-JiraProject', - 'Get-JiraSession', 'Get-JiraUser', 'Invoke-JiraIssueTransition', - 'New-JiraGroup', 'New-JiraIssue', 'New-JiraSession', 'New-JiraUser', - 'Remove-JiraGroup', 'Remove-JiraGroupMember', 'Remove-JiraSession', - 'Remove-JiraUser', 'Set-JiraConfigServer', 'Set-JiraIssue', - 'Set-JiraIssueLabel', 'Set-JiraUser' - -# 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 = 'JIRA' - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PSJira/PSJira/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PSJira/PSJira' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - # External dependent modules of this module - # ExternalModuleDependencies = '' - - } # 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 = '' - -} - +# +# Module manifest for module 'PSGet_JiraPS' +# +# Generated by: Joshua T +# +# Generated on: 8/21/2016 +# + +@{ + +# Script module or binary module file associated with this manifest. +RootModule = 'JiraPS.psm1' + +# Version number of this module. +ModuleVersion = '1.2.5' + +# Supported PSEditions +# CompatiblePSEditions = @() + +# ID used to uniquely identify this module +GUID = '4bf3eb15-037e-43b7-9e47-20a30436324f' + +# Author of this module +Author = 'Joshua T' + +# Company or vendor of this module +CompanyName = 'Unknown' + +# Copyright statement for this module +Copyright = '(c) 2015 Joshua T. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Windows PowerShell module to interact with Atlassian JIRA' + +# 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. 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 = 'System.Web' + +# 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 = 'JiraPS.format.ps1xml' + +# 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 = 'Add-JiraGroupMember', 'Add-JiraIssueComment', 'Get-JiraComponent', 'Format-Jira', + 'Get-JiraConfigServer', 'Get-JiraField', 'Get-JiraFilter', + 'Get-JiraGroup', 'Get-JiraGroupMember', 'Get-JiraIssue', + 'Get-JiraIssueComment', 'Get-JiraIssueCreateMetadata', 'Get-JiraIssueEditMetadata', + 'Get-JiraIssueType', 'Get-JiraPriority', 'Get-JiraProject', + 'Get-JiraSession', 'Get-JiraUser', 'Invoke-JiraIssueTransition', + 'New-JiraGroup', 'New-JiraIssue', 'New-JiraSession', 'New-JiraUser', + 'Remove-JiraGroup', 'Remove-JiraGroupMember', 'Remove-JiraSession', + 'Remove-JiraUser', 'Set-JiraConfigServer', 'Set-JiraIssue', + 'Set-JiraIssueLabel', 'Set-JiraUser' + +# 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 = 'JIRA' + + # A URL to the license for this module. + LicenseUri = 'https://github.com/AtlassianPS/JiraPS/blob/master/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/AtlassianPS/JiraPS' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # External dependent modules of this module + # ExternalModuleDependencies = '' + + } # 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 = '' + +} + diff --git a/PSJira/PSJira.psm1 b/JiraPS/JiraPS.psm1 similarity index 90% rename from PSJira/PSJira.psm1 rename to JiraPS/JiraPS.psm1 index 123211a7..af23b61b 100644 --- a/PSJira/PSJira.psm1 +++ b/JiraPS/JiraPS.psm1 @@ -21,6 +21,6 @@ foreach ($i in $items) # Apparently, PowerShell only automatically loads format files from modules within PSModulePath. # This line forces the current PowerShell session to load the module format file, even if the module is saved in an unusual location. # If this module lives somewhere in your PSModulePath, this line is unnecessary (but it doesn't do any harm either). -$formatFile = Join-Path -Path $moduleRoot -ChildPath 'PSJira.format.ps1xml' +$formatFile = Join-Path -Path $moduleRoot -ChildPath 'JiraPS.format.ps1xml' Write-Verbose "Updating format data with file '$formatFile'" -Update-FormatData -AppendPath $formatFile -ErrorAction Continue \ No newline at end of file +Update-FormatData -AppendPath $formatFile -ErrorAction Continue diff --git a/PSJira/Public/Add-JiraGroupMember.ps1 b/JiraPS/Public/Add-JiraGroupMember.ps1 similarity index 98% rename from PSJira/Public/Add-JiraGroupMember.ps1 rename to JiraPS/Public/Add-JiraGroupMember.ps1 index c6dbb985..34b9d2a7 100644 --- a/PSJira/Public/Add-JiraGroupMember.ps1 +++ b/JiraPS/Public/Add-JiraGroupMember.ps1 @@ -13,7 +13,7 @@ function Add-JiraGroupMember This example illustrates the use of the pipeline to add jsmith to the "Project Admins" group in JIRA. .INPUTS - [PSJira.Group[]] Group(s) to which users should be added + [JiraPS.Group[]] Group(s) to which users should be added .OUTPUTS If the -PassThru parameter is provided, this function will provide a reference to the JIRA group modified. Otherwise, this function does not diff --git a/PSJira/Public/Add-JiraIssueComment.ps1 b/JiraPS/Public/Add-JiraIssueComment.ps1 similarity index 95% rename from PSJira/Public/Add-JiraIssueComment.ps1 rename to JiraPS/Public/Add-JiraIssueComment.ps1 index efb36f23..1093f252 100644 --- a/PSJira/Public/Add-JiraIssueComment.ps1 +++ b/JiraPS/Public/Add-JiraIssueComment.ps1 @@ -19,9 +19,9 @@ function Add-JiraIssueComment Add-JiraIssueComment $c -Issue TEST-003 This example illustrates adding a comment based on other logic to a JIRA issue. Note the use of Format-Jira to convert the output of Get-Process into a format that is easily read by users. .INPUTS - This function can accept PSJira.Issue objects via pipeline. + This function can accept JiraPS.Issue objects via pipeline. .OUTPUTS - This function outputs the PSJira.Comment object created. + This function outputs the JiraPS.Comment object created. .NOTES This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. #> @@ -58,9 +58,9 @@ function Add-JiraIssueComment process { # Write-Debug "[Add-JiraIssueComment] Checking Issue parameter" -# if ($Issue.PSObject.TypeNames[0] -eq 'PSJira.Issue') +# if ($Issue.PSObject.TypeNames[0] -eq 'JiraPS.Issue') # { -# Write-Debug "[Add-JiraIssueComment] Issue parameter is a PSJira.Issue object" +# Write-Debug "[Add-JiraIssueComment] Issue parameter is a JiraPS.Issue object" # $issueObj = $Issue # } else { # $issueKey = $Issue.ToString() diff --git a/PSJira/Public/Format-Jira.ps1 b/JiraPS/Public/Format-Jira.ps1 similarity index 100% rename from PSJira/Public/Format-Jira.ps1 rename to JiraPS/Public/Format-Jira.ps1 diff --git a/PSJira/Public/Get-JiraComponent.ps1 b/JiraPS/Public/Get-JiraComponent.ps1 similarity index 98% rename from PSJira/Public/Get-JiraComponent.ps1 rename to JiraPS/Public/Get-JiraComponent.ps1 index bbdc8485..40a68f72 100644 --- a/PSJira/Public/Get-JiraComponent.ps1 +++ b/JiraPS/Public/Get-JiraComponent.ps1 @@ -21,7 +21,7 @@ function Get-JiraComponent [String[]] Component ID [PSCredential] Credentials to use to connect to Jira .OUTPUTS - [PSJira.Component] + [JiraPS.Component] #> [CmdletBinding()] param( @@ -59,7 +59,7 @@ function Get-JiraComponent process { - if ($InputObject -and ($InputObject.PSObject.TypeNames[0] -eq 'PSJira.Project')) { + if ($InputObject -and ($InputObject.PSObject.TypeNames[0] -eq 'JiraPS.Project')) { $Id = @($InputObject.Components | select -ExpandProperty id) } if ($Id) diff --git a/PSJira/Public/Get-JiraConfigServer.ps1 b/JiraPS/Public/Get-JiraConfigServer.ps1 similarity index 97% rename from PSJira/Public/Get-JiraConfigServer.ps1 rename to JiraPS/Public/Get-JiraConfigServer.ps1 index 1818de67..5a81e0c1 100644 --- a/PSJira/Public/Get-JiraConfigServer.ps1 +++ b/JiraPS/Public/Get-JiraConfigServer.ps1 @@ -4,10 +4,10 @@ function Get-JiraConfigServer .Synopsis Obtains the configured URL for the JIRA server .DESCRIPTION - This function returns the configured URL for the JIRA server that PSJira should manipulate. By default, this is stored in a config.xml file at the module's root path. + This function returns the configured URL for the JIRA server that JiraPS should manipulate. By default, this is stored in a config.xml file at the module's root path. .EXAMPLE Get-JiraConfigServer - Returns the server URL of the JIRA server configured in the PSJira config file. + Returns the server URL of the JIRA server configured in the JiraPS config file. .EXAMPLE Get-JiraConfigServer -ConfigFile C:\jiraconfig.xml Returns the server URL of the JIRA server configured at C:\jiraconfig.xml. diff --git a/PSJira/Public/Get-JiraField.ps1 b/JiraPS/Public/Get-JiraField.ps1 similarity index 96% rename from PSJira/Public/Get-JiraField.ps1 rename to JiraPS/Public/Get-JiraField.ps1 index 475b2e5a..6f092ce7 100644 --- a/PSJira/Public/Get-JiraField.ps1 +++ b/JiraPS/Public/Get-JiraField.ps1 @@ -9,14 +9,14 @@ Typically, this information is only needed when identifying what fields are necessary to create or edit issues. See Get-JiraIssueCreateMetadata for more details. .EXAMPLE Get-JiraField - This example returns information about all JIRA fields visible to the current user (or using anonymous access if a PSJira session has not been defined). + This example returns information about all JIRA fields visible to the current user (or using anonymous access if a JiraPS session has not been defined). .EXAMPLE Get-JiraField IssueKey This example returns information about the IssueKey field. .INPUTS This function does not accept pipeline input. .OUTPUTS - This function outputs the PSJira.Field object(s) that represent the JIRA field(s). + This function outputs the JiraPS.Field object(s) that represent the JIRA field(s). .NOTES This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. #> diff --git a/PSJira/Public/Get-JiraFilter.ps1 b/JiraPS/Public/Get-JiraFilter.ps1 similarity index 94% rename from PSJira/Public/Get-JiraFilter.ps1 rename to JiraPS/Public/Get-JiraFilter.ps1 index d2fe0af8..1725a42b 100644 --- a/PSJira/Public/Get-JiraFilter.ps1 +++ b/JiraPS/Public/Get-JiraFilter.ps1 @@ -11,9 +11,9 @@ Get-JiraFilter -Id 12345 Gets a reference to filter ID 12345 from JIRA .INPUTS - [Object[]] The filter to look up in JIRA. This can be a String (filter ID) or a PSJira.Filter object. + [Object[]] The filter to look up in JIRA. This can be a String (filter ID) or a JiraPS.Filter object. .OUTPUTS - [PSJira.Filter[]] Filter objects + [JiraPS.Filter[]] Filter objects #> [CmdletBinding(DefaultParameterSetName = 'ByFilterID')] param( @@ -76,9 +76,9 @@ foreach ($i in $InputObject) { Write-Debug "[Get-JiraFilter] Processing InputObject [$i]" - if ((Get-Member -InputObject $i).TypeName -eq 'PSJira.Filter') + if ((Get-Member -InputObject $i).TypeName -eq 'JiraPS.Filter') { - Write-Debug "[Get-JiraFilter] User parameter is a PSJira.Filter object" + Write-Debug "[Get-JiraFilter] User parameter is a JiraPS.Filter object" $thisId = $i.ID } else { $thisId = $i.ToString() diff --git a/PSJira/Public/Get-JiraGroup.ps1 b/JiraPS/Public/Get-JiraGroup.ps1 similarity index 95% rename from PSJira/Public/Get-JiraGroup.ps1 rename to JiraPS/Public/Get-JiraGroup.ps1 index ad18f478..012967e2 100644 --- a/PSJira/Public/Get-JiraGroup.ps1 +++ b/JiraPS/Public/Get-JiraGroup.ps1 @@ -16,9 +16,9 @@ function Get-JiraGroup This example searches Active Directory for the username of John W. Smith, John H. Smith, and any other John Smiths, then obtains their JIRA user accounts. .INPUTS - [Object[]] The group to look up in JIRA. This can be a String or a PSJira.Group object. + [Object[]] The group to look up in JIRA. This can be a String or a JiraPS.Group object. .OUTPUTS - [PSJira.Group] + [JiraPS.Group] #> [CmdletBinding(DefaultParameterSetName = 'ByGroupName')] param( @@ -70,7 +70,7 @@ function Get-JiraGroup if ($result) { - Write-Debug "[Get-JiraGroup] Converting results to PSJira.Group" + Write-Debug "[Get-JiraGroup] Converting results to JiraPS.Group" $obj = ConvertTo-JiraGroup -InputObject $result Write-Debug "[Get-JiraGroup] Outputting results" @@ -84,9 +84,9 @@ function Get-JiraGroup foreach ($i in $InputObject) { Write-Debug "[Get-JiraGroup] Processing InputObject [$i]" - if ((Get-Member -InputObject $i).TypeName -eq 'PSJira.Group') + if ((Get-Member -InputObject $i).TypeName -eq 'JiraPS.Group') { - Write-Debug "[Get-JiraGroup] User parameter is a PSJira.Group object" + Write-Debug "[Get-JiraGroup] User parameter is a JiraPS.Group object" $thisGroupName = $i.Name } else { $thisGroupName = $i.ToString() diff --git a/PSJira/Public/Get-JiraGroupMember.ps1 b/JiraPS/Public/Get-JiraGroupMember.ps1 similarity index 97% rename from PSJira/Public/Get-JiraGroupMember.ps1 rename to JiraPS/Public/Get-JiraGroupMember.ps1 index 6f9b780e..a719683a 100644 --- a/PSJira/Public/Get-JiraGroupMember.ps1 +++ b/JiraPS/Public/Get-JiraGroupMember.ps1 @@ -13,9 +13,9 @@ function Get-JiraGroupMember This example illustrates the use of the pipeline to return members of the Developers group in JIRA. .INPUTS - [PSJira.Group] The group to query for members + [JiraPS.Group] The group to query for members .OUTPUTS - [PSJira.User[]] Members of the provided group + [JiraPS.User[]] Members of the provided group .NOTES By default, this will return all active users who are members of the given group. For large groups, this can take quite some time. @@ -126,7 +126,7 @@ function Get-JiraGroupMember # users (group members) to user objects if the members # are returned from JIRA. - Write-Debug "[Get-JiraGroupMember] Converting results to PSJira.Group and PSJira.User objects" + Write-Debug "[Get-JiraGroupMember] Converting results to JiraPS.Group and JiraPS.User objects" $groupObjResult = ConvertTo-JiraGroup -InputObject $groupResult Write-Debug "[Get-JiraGroupMember] Outputting group members" diff --git a/PSJira/Public/Get-JiraIssue.ps1 b/JiraPS/Public/Get-JiraIssue.ps1 similarity index 96% rename from PSJira/Public/Get-JiraIssue.ps1 rename to JiraPS/Public/Get-JiraIssue.ps1 index 76a14087..8dbcbe3b 100644 --- a/PSJira/Public/Get-JiraIssue.ps1 +++ b/JiraPS/Public/Get-JiraIssue.ps1 @@ -21,13 +21,13 @@ function Get-JiraIssue Get-JiraIssue -Query 'project = "TEST" AND created >= -5d' This example illustrates using the Query parameter and JQL syntax to query Jira for matching issues. .INPUTS - This function can accept PSJira.Issue objects, Strings, or Objects via the pipeline. + This function can accept JiraPS.Issue objects, Strings, or Objects via the pipeline. - * If a PSJira.Issue object is passed, this function returns a new reference to the same issue. + * If a JiraPS.Issue object is passed, this function returns a new reference to the same issue. * If a String is passed, this function searches for an issue with that issue key or internal ID. * If an Object is passed, this function invokes its ToString() method and treats it as a String. .OUTPUTS - This function outputs the PSJira.Issue object retrieved. + This function outputs the JiraPS.Issue object retrieved. .NOTES This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. #> @@ -119,9 +119,9 @@ function Get-JiraIssue foreach ($i in $InputObject) { Write-Debug "[Get-JiraIssue] Processing InputObject [$i]" - if ((Get-Member -InputObject $i).TypeName -eq 'PSJira.Issue') + if ((Get-Member -InputObject $i).TypeName -eq 'JiraPS.Issue') { - Write-Debug "[Get-JiraIssue] Issue parameter is a PSJira.Issue object" + Write-Debug "[Get-JiraIssue] Issue parameter is a JiraPS.Issue object" $issueKey = $i.Key } else { $issueKey = $i.ToString() diff --git a/PSJira/Public/Get-JiraIssueComment.ps1 b/JiraPS/Public/Get-JiraIssueComment.ps1 similarity index 92% rename from PSJira/Public/Get-JiraIssueComment.ps1 rename to JiraPS/Public/Get-JiraIssueComment.ps1 index 56a84980..0c86a12f 100644 --- a/PSJira/Public/Get-JiraIssueComment.ps1 +++ b/JiraPS/Public/Get-JiraIssueComment.ps1 @@ -12,15 +12,15 @@ function Get-JiraIssueComment Get-JiraIssue TEST-002 | Get-JiraIssueComment This example illustrates use of the pipeline to return all comments on issue TEST-002. .INPUTS - This function can accept PSJira.Issue objects, Strings, or Objects via the pipeline. It uses Get-JiraIssue to identify the issue parameter; see its Inputs section for details on how this function handles inputs. + This function can accept JiraPS.Issue objects, Strings, or Objects via the pipeline. It uses Get-JiraIssue to identify the issue parameter; see its Inputs section for details on how this function handles inputs. .OUTPUTS - This function outputs all PSJira.Comment issues associated with the provided issue. + This function outputs all JiraPS.Comment issues associated with the provided issue. .NOTES This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. #> [CmdletBinding()] param( - # JIRA issue to check for comments. Can be a PSJira.Issue object, issue key, or internal issue ID. + # JIRA issue to check for comments. Can be a JiraPS.Issue object, issue key, or internal issue ID. [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, diff --git a/PSJira/Public/Get-JiraIssueCreateMetadata.ps1 b/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 similarity index 98% rename from PSJira/Public/Get-JiraIssueCreateMetadata.ps1 rename to JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 index 4725a2f7..24534215 100644 --- a/PSJira/Public/Get-JiraIssueCreateMetadata.ps1 +++ b/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 @@ -16,7 +16,7 @@ function Get-JiraIssueCreateMetadata .INPUTS This function does not accept pipeline input. .OUTPUTS - This function outputs the PSJira.Field objects that represent JIRA's create metadata. + This function outputs the JiraPS.Field objects that represent JIRA's create metadata. .NOTES This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. #> diff --git a/PSJira/Public/Get-JiraIssueEditMetadata.ps1 b/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 similarity index 96% rename from PSJira/Public/Get-JiraIssueEditMetadata.ps1 rename to JiraPS/Public/Get-JiraIssueEditMetadata.ps1 index 74d5d53b..bb1e8cb8 100644 --- a/PSJira/Public/Get-JiraIssueEditMetadata.ps1 +++ b/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 @@ -1,96 +1,96 @@ -function Get-JiraIssueEditMetadata -{ - <# - .Synopsis - Returns metadata required to create an issue in JIRA - .DESCRIPTION - This function returns metadata required to create an issue in JIRA - the fields that can be defined in the process of creating an issue. This can be used to identify custom fields in order to pass them to New-JiraIssue. - - This function is particularly useful when your JIRA instance includes custom fields that are marked as mandatory. The required fields can be identified from this See the examples for more details on this approach. - .EXAMPLE - Get-JiraIssueEditMetadata -Project 'TEST' -IssueType 'Bug' - This example returns the fields available when creating an issue of type Bug under project TEST. - .EXAMPLE - Get-JiraIssueEditMetadata -Project 'JIRA' -IssueType 'Bug' | ? {$_.Required -eq $true} - This example returns fields available when creating an issue of type Bug under the project Jira. It then uses Where-Object (aliased by the question mark) to filter only the fields that are required. - .INPUTS - This function does not accept pipeline input. - .OUTPUTS - This function outputs the PSJira.Field objects that represent JIRA's create metadata. - .NOTES - This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. - #> - [CmdletBinding()] - param( - # Issue id or key - [Parameter(Mandatory = $true, - Position = 0)] - [String] $Issue, - - [String] $ConfigFile, - - # Credentials to use to connect to Jira - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] $Credential - ) - - begin - { - Write-Debug "[Get-JiraIssueEditMetadata] Reading server from config file" - try - { - $server = Get-JiraConfigServer -ConfigFile $ConfigFile -ErrorAction Stop - } catch { - $err = $_ - Write-Debug "[Get-JiraIssueEditMetadata] Encountered an error reading the Jira server." - throw $err - } - - Write-Debug "[Get-JiraIssueEditMetadata] Building URI for REST call based on parameters" - $uri = "$server/rest/api/latest/issue/$Issue/editmeta" - } - - process - { - Write-Debug "[Get-JiraIssueEditMetadata] Preparing for blastoff!" - $jiraResult = Invoke-JiraMethod -Method Get -URI $uri -Credential $Credential - - if ($jiraResult) - { - if (@($jiraResult.projects).Count -eq 0) - { - Write-Debug "[Get-JiraIssueEditMetadata] No project results were found. Throwing exception." - throw "No projects were found for the given project [$Project]. Use Get-JiraProject for more details." - } elseif (@($jiraResult.projects).Count -gt 1) { - Write-Debug "[Get-JiraIssueEditMetadata] Multiple project results were found. Throwing exception." - throw "Multiple projects were found for the given project [$Project]. Refine the parameters to return only one project." - } - - $projectId = $jiraResult.projects.id - $projectKey = $jiraResult.projects.key - - Write-Debug "[Get-JiraIssueEditMetadata] Identified project key: [$Project]" - - if (@($jiraResult.projects.issuetypes) -eq 0) - { - Write-Debug "[Get-JiraIssueEditMetadata] No issue type results were found. Throwing exception." - throw "No issue types were found for the given issue type [$IssueType]. Use Get-JiraIssueType for more details." - } elseif (@($jiraResult.projects.issuetypes).Count -gt 1) { - Write-Debug "[Get-JiraIssueEditMetadata] Multiple issue type results were found. Throwing exception." - throw "Multiple issue types were found for the given issue type [$IssueType]. Refine the parameters to return only one issue type." - } - - Write-Debug "[Get-JiraIssueEditMetadata] Converting results to custom object" - $obj = ConvertTo-JiraEditMetaField -InputObject $jiraResult - - Write-Debug "Outputting results" - Write-Output $obj - -# Write-Output $jiraResult - } else { - Write-Debug "[Get-JiraIssueEditMetadata] No results were returned from JIRA." - } - } -} - - +function Get-JiraIssueEditMetadata +{ + <# + .Synopsis + Returns metadata required to create an issue in JIRA + .DESCRIPTION + This function returns metadata required to create an issue in JIRA - the fields that can be defined in the process of creating an issue. This can be used to identify custom fields in order to pass them to New-JiraIssue. + + This function is particularly useful when your JIRA instance includes custom fields that are marked as mandatory. The required fields can be identified from this See the examples for more details on this approach. + .EXAMPLE + Get-JiraIssueEditMetadata -Project 'TEST' -IssueType 'Bug' + This example returns the fields available when creating an issue of type Bug under project TEST. + .EXAMPLE + Get-JiraIssueEditMetadata -Project 'JIRA' -IssueType 'Bug' | ? {$_.Required -eq $true} + This example returns fields available when creating an issue of type Bug under the project Jira. It then uses Where-Object (aliased by the question mark) to filter only the fields that are required. + .INPUTS + This function does not accept pipeline input. + .OUTPUTS + This function outputs the JiraPS.Field objects that represent JIRA's create metadata. + .NOTES + This function requires either the -Credential parameter to be passed or a persistent JIRA session. See New-JiraSession for more details. If neither are supplied, this function will run with anonymous access to JIRA. + #> + [CmdletBinding()] + param( + # Issue id or key + [Parameter(Mandatory = $true, + Position = 0)] + [String] $Issue, + + [String] $ConfigFile, + + # Credentials to use to connect to Jira + [Parameter(Mandatory = $false)] + [System.Management.Automation.PSCredential] $Credential + ) + + begin + { + Write-Debug "[Get-JiraIssueEditMetadata] Reading server from config file" + try + { + $server = Get-JiraConfigServer -ConfigFile $ConfigFile -ErrorAction Stop + } catch { + $err = $_ + Write-Debug "[Get-JiraIssueEditMetadata] Encountered an error reading the Jira server." + throw $err + } + + Write-Debug "[Get-JiraIssueEditMetadata] Building URI for REST call based on parameters" + $uri = "$server/rest/api/latest/issue/$Issue/editmeta" + } + + process + { + Write-Debug "[Get-JiraIssueEditMetadata] Preparing for blastoff!" + $jiraResult = Invoke-JiraMethod -Method Get -URI $uri -Credential $Credential + + if ($jiraResult) + { + if (@($jiraResult.projects).Count -eq 0) + { + Write-Debug "[Get-JiraIssueEditMetadata] No project results were found. Throwing exception." + throw "No projects were found for the given project [$Project]. Use Get-JiraProject for more details." + } elseif (@($jiraResult.projects).Count -gt 1) { + Write-Debug "[Get-JiraIssueEditMetadata] Multiple project results were found. Throwing exception." + throw "Multiple projects were found for the given project [$Project]. Refine the parameters to return only one project." + } + + $projectId = $jiraResult.projects.id + $projectKey = $jiraResult.projects.key + + Write-Debug "[Get-JiraIssueEditMetadata] Identified project key: [$Project]" + + if (@($jiraResult.projects.issuetypes) -eq 0) + { + Write-Debug "[Get-JiraIssueEditMetadata] No issue type results were found. Throwing exception." + throw "No issue types were found for the given issue type [$IssueType]. Use Get-JiraIssueType for more details." + } elseif (@($jiraResult.projects.issuetypes).Count -gt 1) { + Write-Debug "[Get-JiraIssueEditMetadata] Multiple issue type results were found. Throwing exception." + throw "Multiple issue types were found for the given issue type [$IssueType]. Refine the parameters to return only one issue type." + } + + Write-Debug "[Get-JiraIssueEditMetadata] Converting results to custom object" + $obj = ConvertTo-JiraEditMetaField -InputObject $jiraResult + + Write-Debug "Outputting results" + Write-Output $obj + +# Write-Output $jiraResult + } else { + Write-Debug "[Get-JiraIssueEditMetadata] No results were returned from JIRA." + } + } +} + + diff --git a/PSJira/Public/Get-JiraIssueType.ps1 b/JiraPS/Public/Get-JiraIssueType.ps1 similarity index 100% rename from PSJira/Public/Get-JiraIssueType.ps1 rename to JiraPS/Public/Get-JiraIssueType.ps1 diff --git a/PSJira/Public/Get-JiraPriority.ps1 b/JiraPS/Public/Get-JiraPriority.ps1 similarity index 100% rename from PSJira/Public/Get-JiraPriority.ps1 rename to JiraPS/Public/Get-JiraPriority.ps1 diff --git a/PSJira/Public/Get-JiraProject.ps1 b/JiraPS/Public/Get-JiraProject.ps1 similarity index 99% rename from PSJira/Public/Get-JiraProject.ps1 rename to JiraPS/Public/Get-JiraProject.ps1 index 7f2453fc..7133d983 100644 --- a/PSJira/Public/Get-JiraProject.ps1 +++ b/JiraPS/Public/Get-JiraProject.ps1 @@ -22,7 +22,7 @@ function Get-JiraProject [String[]] Project ID or project key [PSCredential] Credentials to use to connect to Jira .OUTPUTS - [PSJira.Project] + [JiraPS.Project] #> [CmdletBinding(DefaultParameterSetName = 'AllProjects')] param( diff --git a/PSJira/Public/Get-JiraSession.ps1 b/JiraPS/Public/Get-JiraSession.ps1 similarity index 95% rename from PSJira/Public/Get-JiraSession.ps1 rename to JiraPS/Public/Get-JiraSession.ps1 index 8b45f889..d1a25453 100644 --- a/PSJira/Public/Get-JiraSession.ps1 +++ b/JiraPS/Public/Get-JiraSession.ps1 @@ -13,7 +13,7 @@ function Get-JiraSession .INPUTS None .OUTPUTS - [PSJira.Session] An object representing the Jira session + [JiraPS.Session] An object representing the Jira session #> [CmdletBinding()] param() diff --git a/PSJira/Public/Get-JiraUser.ps1 b/JiraPS/Public/Get-JiraUser.ps1 similarity index 96% rename from PSJira/Public/Get-JiraUser.ps1 rename to JiraPS/Public/Get-JiraUser.ps1 index cc7f0052..9959bcd4 100644 --- a/PSJira/Public/Get-JiraUser.ps1 +++ b/JiraPS/Public/Get-JiraUser.ps1 @@ -16,7 +16,7 @@ function Get-JiraUser [String[]] Username [PSCredential] Credentials to use to connect to Jira .OUTPUTS - [PSJira.User] + [JiraPS.User] #> [CmdletBinding(DefaultParameterSetName = 'ByUserName')] param( @@ -83,7 +83,7 @@ function Get-JiraUser if ($thisUserResult) { - Write-Debug "[Get-JiraUser] Converting result to PSJira.User object" + Write-Debug "[Get-JiraUser] Converting result to JiraPS.User object" $thisUserObject = ConvertTo-JiraUser -InputObject $thisUserResult Write-Output $thisUserObject } else { @@ -99,9 +99,9 @@ function Get-JiraUser foreach ($i in $InputObject) { Write-Debug "[Get-JiraUser] Processing InputObject [$i]" - if ((Get-Member -InputObject $i).TypeName -eq 'PSJira.User') + if ((Get-Member -InputObject $i).TypeName -eq 'JiraPS.User') { - Write-Debug "[Get-JiraUser] User parameter is a PSJira.User object" + Write-Debug "[Get-JiraUser] User parameter is a JiraPS.User object" $thisUserName = $i.Name } else { $thisUserName = $i.ToString() diff --git a/PSJira/Public/Invoke-JiraIssueTransition.ps1 b/JiraPS/Public/Invoke-JiraIssueTransition.ps1 similarity index 95% rename from PSJira/Public/Invoke-JiraIssueTransition.ps1 rename to JiraPS/Public/Invoke-JiraIssueTransition.ps1 index 34480ae5..14ccbc45 100644 --- a/PSJira/Public/Invoke-JiraIssueTransition.ps1 +++ b/JiraPS/Public/Invoke-JiraIssueTransition.ps1 @@ -22,8 +22,8 @@ function Invoke-JiraIssueTransition This example identifies the correct transition based on the result status of "In Progress," and invokes that transition on issue TEST-01. .INPUTS - [PSJira.Issue] Issue (can also be provided as a String) - [PSJira.Transition] Transition to perform (can also be provided as an int ID) + [JiraPS.Issue] Issue (can also be provided as a String) + [JiraPS.Transition] Transition to perform (can also be provided as an int ID) .OUTPUTS This function does not provide output. #> @@ -62,9 +62,9 @@ function Invoke-JiraIssueTransition } Write-Debug "[Invoke-JiraIssueTransition] Checking Transition parameter" - if ($Transition.PSObject.TypeNames[0] -eq 'PSJira.Transition') + if ($Transition.PSObject.TypeNames[0] -eq 'JiraPS.Transition') { - Write-Debug "[Invoke-JiraIssueTransition] Transition parameter is a PSJira.Transition object" + Write-Debug "[Invoke-JiraIssueTransition] Transition parameter is a JiraPS.Transition object" $transitionId = $Transition.ID } else { Write-Debug "[Invoke-JiraIssueTransition] Attempting to cast Transition parameter [$Transition] as int for transition ID" diff --git a/PSJira/Public/New-JiraGroup.ps1 b/JiraPS/Public/New-JiraGroup.ps1 similarity index 97% rename from PSJira/Public/New-JiraGroup.ps1 rename to JiraPS/Public/New-JiraGroup.ps1 index d6f308af..e7c70a40 100644 --- a/PSJira/Public/New-JiraGroup.ps1 +++ b/JiraPS/Public/New-JiraGroup.ps1 @@ -11,7 +11,7 @@ .INPUTS This function does not accept pipeline input. .OUTPUTS - [PSJira.Group] The user object created + [JiraPS.Group] The user object created #> [CmdletBinding()] param( diff --git a/PSJira/Public/New-JiraIssue.ps1 b/JiraPS/Public/New-JiraIssue.ps1 similarity index 98% rename from PSJira/Public/New-JiraIssue.ps1 rename to JiraPS/Public/New-JiraIssue.ps1 index 29f7cdc3..1a8a2fb1 100644 --- a/PSJira/Public/New-JiraIssue.ps1 +++ b/JiraPS/Public/New-JiraIssue.ps1 @@ -18,14 +18,14 @@ function New-JiraIssue creating an issue. .EXAMPLE Get-JiraIssueCreateMetadata -Project TEST -IssueType Bug | ? {$_.Required -eq $true} - New-JiraIssue -Project TEST -IssueType Bug -Priority 1 -Summary 'Test issue from PowerShell' -Description 'This is a test issue created from the PSJira module in PowerShell.' -Fields {'Custom Field Name 1'='foo';'customfield_10001'='bar';} + New-JiraIssue -Project TEST -IssueType Bug -Priority 1 -Summary 'Test issue from PowerShell' -Description 'This is a test issue created from the JiraPS module in PowerShell.' -Fields {'Custom Field Name 1'='foo';'customfield_10001'='bar';} This example uses Get-JiraIssueCreateMetadata to identify fields required to create an issue in JIRA. It then creates an issue with the Fields parameter providing a field name and a field ID. .INPUTS This function does not accept pipeline input. .OUTPUTS - [PSJira.Issue] The issue created in JIRA. + [JiraPS.Issue] The issue created in JIRA. #> [CmdletBinding()] param( diff --git a/PSJira/Public/New-JiraSession.ps1 b/JiraPS/Public/New-JiraSession.ps1 similarity index 96% rename from PSJira/Public/New-JiraSession.ps1 rename to JiraPS/Public/New-JiraSession.ps1 index fa7dbd4a..0bf0a192 100644 --- a/PSJira/Public/New-JiraSession.ps1 +++ b/JiraPS/Public/New-JiraSession.ps1 @@ -2,10 +2,10 @@ function New-JiraSession { <# .Synopsis - Creates a persistent JIRA authenticated session which can be used by other PSJira functions + Creates a persistent JIRA authenticated session which can be used by other JiraPS functions .DESCRIPTION This function creates a persistent, authenticated session in to JIRA which can be used by all other - PSJira functions instead of explicitly passing parameters. This removes the need to use the + JiraPS functions instead of explicitly passing parameters. This removes the need to use the -Credential parameter constantly for each function call. This is the equivalent of a browser cookie saving login information. @@ -20,7 +20,7 @@ function New-JiraSession .INPUTS [PSCredential] The credentials to use to create the Jira session .OUTPUTS - [PSJira.Session] An object representing the Jira session + [JiraPS.Session] An object representing the Jira session #> [CmdletBinding()] param( diff --git a/PSJira/Public/New-JiraUser.ps1 b/JiraPS/Public/New-JiraUser.ps1 similarity index 98% rename from PSJira/Public/New-JiraUser.ps1 rename to JiraPS/Public/New-JiraUser.ps1 index 17b7605c..c92e7bc3 100644 --- a/PSJira/Public/New-JiraUser.ps1 +++ b/JiraPS/Public/New-JiraUser.ps1 @@ -20,7 +20,7 @@ function New-JiraUser .INPUTS This function does not accept pipeline input. .OUTPUTS - [PSJira.User] The user object created + [JiraPS.User] The user object created #> [CmdletBinding()] param( diff --git a/PSJira/Public/Remove-JiraGroup.ps1 b/JiraPS/Public/Remove-JiraGroup.ps1 similarity index 98% rename from PSJira/Public/Remove-JiraGroup.ps1 rename to JiraPS/Public/Remove-JiraGroup.ps1 index 5f14ed3b..c366fe4d 100644 --- a/PSJira/Public/Remove-JiraGroup.ps1 +++ b/JiraPS/Public/Remove-JiraGroup.ps1 @@ -11,7 +11,7 @@ Remove-JiraGroup -GroupName testGroup Removes the JIRA group testGroup .INPUTS - [PSJira.Group[]] The JIRA groups to delete + [JiraPS.Group[]] The JIRA groups to delete .OUTPUTS This function returns no output. #> diff --git a/PSJira/Public/Remove-JiraGroupMember.ps1 b/JiraPS/Public/Remove-JiraGroupMember.ps1 similarity index 98% rename from PSJira/Public/Remove-JiraGroupMember.ps1 rename to JiraPS/Public/Remove-JiraGroupMember.ps1 index 00637509..f55b127b 100644 --- a/PSJira/Public/Remove-JiraGroupMember.ps1 +++ b/JiraPS/Public/Remove-JiraGroupMember.ps1 @@ -13,7 +13,7 @@ function Remove-JiraGroupMember This example illustrates the use of the pipeline to remove jsmith from the "Project Admins" group in JIRA. .INPUTS - [PSJira.Group[]] Group(s) from which users should be removed + [JiraPS.Group[]] Group(s) from which users should be removed .OUTPUTS If the -PassThru parameter is provided, this function will provide a reference to the JIRA group modified. Otherwise, this function does not diff --git a/PSJira/Public/Remove-JiraSession.ps1 b/JiraPS/Public/Remove-JiraSession.ps1 similarity index 93% rename from PSJira/Public/Remove-JiraSession.ps1 rename to JiraPS/Public/Remove-JiraSession.ps1 index d5a34c0d..e7ec600c 100644 --- a/PSJira/Public/Remove-JiraSession.ps1 +++ b/JiraPS/Public/Remove-JiraSession.ps1 @@ -8,7 +8,7 @@ function Remove-JiraSession This can be used to "log out" of JIRA once work is complete. If called with the Session parameter, this function will attempt to close the provided - PSJira.Session object. + JiraPS.Session object. If called with no parameters, this function will close the saved JIRA session in the module's PrivateData. @@ -23,9 +23,9 @@ function Remove-JiraSession This example creates a JIRA session and saves it to a variable, then uses the variable reference to close the session. .INPUTS - [PSJira.Session] A Session object to close. + [JiraPS.Session] A Session object to close. .OUTPUTS - [PSJira.Session] An object representing the Jira session + [JiraPS.Session] An object representing the Jira session #> [CmdletBinding()] param( @@ -60,12 +60,12 @@ function Remove-JiraSession if ($Session) { Write-Debug "[Remove-JiraSession] Validating Session parameter" - if ((Get-Member -InputObject $Session).TypeName -eq 'PSJira.Session') + if ((Get-Member -InputObject $Session).TypeName -eq 'JiraPS.Session') { - Write-Debug "[Remove-JiraSession] Successfully parsed Session parameter as a PSJira.Session object" + Write-Debug "[Remove-JiraSession] Successfully parsed Session parameter as a JiraPS.Session object" } else { - Write-Debug "[Remove-JiraSession] Session parameter is not a PSJira.Session object. Throwing exception" - throw "Unable to parse parameter [$Session] as a PSJira.Session object" + Write-Debug "[Remove-JiraSession] Session parameter is not a JiraPS.Session object. Throwing exception" + throw "Unable to parse parameter [$Session] as a JiraPS.Session object" } } else { Write-Debug "[Remove-JiraSession] Session parameter was not supplied. Checking for saved session in module PrivateData" diff --git a/PSJira/Public/Remove-JiraUser.ps1 b/JiraPS/Public/Remove-JiraUser.ps1 similarity index 98% rename from PSJira/Public/Remove-JiraUser.ps1 rename to JiraPS/Public/Remove-JiraUser.ps1 index df17e47c..e3f34a50 100644 --- a/PSJira/Public/Remove-JiraUser.ps1 +++ b/JiraPS/Public/Remove-JiraUser.ps1 @@ -14,7 +14,7 @@ function Remove-JiraUser Remove-JiraUser -UserName testUser Removes the JIRA user TestUser .INPUTS - [PSJira.User[]] The JIRA users to delete + [JiraPS.User[]] The JIRA users to delete .OUTPUTS This function returns no output. #> diff --git a/PSJira/Public/Set-JiraConfigServer.ps1 b/JiraPS/Public/Set-JiraConfigServer.ps1 similarity index 97% rename from PSJira/Public/Set-JiraConfigServer.ps1 rename to JiraPS/Public/Set-JiraConfigServer.ps1 index a669e6e3..af2a3952 100644 --- a/PSJira/Public/Set-JiraConfigServer.ps1 +++ b/JiraPS/Public/Set-JiraConfigServer.ps1 @@ -4,10 +4,10 @@ function Set-JiraConfigServer .Synopsis Defines the configured URL for the JIRA server .DESCRIPTION - This function defines the configured URL for the JIRA server that PSJira should manipulate. By default, this is stored in a config.xml file at the module's root path. + This function defines the configured URL for the JIRA server that JiraPS should manipulate. By default, this is stored in a config.xml file at the module's root path. .EXAMPLE Set-JiraConfigServer 'https://jira.example.com:8080' - This example defines the server URL of the JIRA server configured in the PSJira config file. + This example defines the server URL of the JIRA server configured in the JiraPS config file. .EXAMPLE Set-JiraConfigServer -Server 'https://jira.example.com:8080' -ConfigFile C:\jiraconfig.xml This example defines the server URL of the JIRA server configured at C:\jiraconfig.xml. diff --git a/PSJira/Public/Set-JiraIssue.ps1 b/JiraPS/Public/Set-JiraIssue.ps1 similarity index 98% rename from PSJira/Public/Set-JiraIssue.ps1 rename to JiraPS/Public/Set-JiraIssue.ps1 index d6d24857..1def2746 100644 --- a/PSJira/Public/Set-JiraIssue.ps1 +++ b/JiraPS/Public/Set-JiraIssue.ps1 @@ -18,14 +18,14 @@ function Set-JiraIssue Set-JiraIssue -Issue TEST-01 -Assignee 'Unassigned' This example removes the assignee from JIRA issue TEST-01. .INPUTS - [PSJira.Issue[]] The JIRA issue that should be modified + [JiraPS.Issue[]] The JIRA issue that should be modified .OUTPUTS If the -PassThru parameter is provided, this function will provide a reference to the JIRA issue modified. Otherwise, this function does not provide output. #> [CmdletBinding(DefaultParameterSetName = 'ByInputObject')] param( - # Issue key or PSJira.Issue object returned from Get-JiraIssue + # Issue key or JiraPS.Issue object returned from Get-JiraIssue [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, diff --git a/PSJira/Public/Set-JiraIssueLabel.ps1 b/JiraPS/Public/Set-JiraIssueLabel.ps1 similarity index 98% rename from PSJira/Public/Set-JiraIssueLabel.ps1 rename to JiraPS/Public/Set-JiraIssueLabel.ps1 index 1e6b2ae3..cd8be82b 100644 --- a/PSJira/Public/Set-JiraIssueLabel.ps1 +++ b/JiraPS/Public/Set-JiraIssueLabel.ps1 @@ -23,14 +23,14 @@ set in the $jql variable - in this case, all issues created by user joeSmith in the last 7 days. .INPUTS - [PSJira.Issue[]] The JIRA issue that should be modified + [JiraPS.Issue[]] The JIRA issue that should be modified .OUTPUTS If the -PassThru parameter is provided, this function will provide a reference to the JIRA issue modified. Otherwise, this function does not provide output. #> [CmdletBinding(DefaultParameterSetName = 'ReplaceLabels')] param( - # Issue key or PSJira.Issue object returned from Get-JiraIssue + # Issue key or JiraPS.Issue object returned from Get-JiraIssue [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, diff --git a/PSJira/Public/Set-JiraUser.ps1 b/JiraPS/Public/Set-JiraUser.ps1 similarity index 98% rename from PSJira/Public/Set-JiraUser.ps1 rename to JiraPS/Public/Set-JiraUser.ps1 index b4adbc44..c908374d 100644 --- a/PSJira/Public/Set-JiraUser.ps1 +++ b/JiraPS/Public/Set-JiraUser.ps1 @@ -14,7 +14,7 @@ function Set-JiraUser This example modifies a user's properties using a hashtable. This allows updating properties that are not exposed as parameters to this function. .INPUTS - [PSJira.User[]] The JIRA user that should be modified. + [JiraPS.User[]] The JIRA user that should be modified. .OUTPUTS If the -PassThru parameter is provided, this function will provide a reference to the JIRA user modified. Otherwise, this function does not provide output. diff --git a/README.md b/README.md index 87ce9ea6..93bd636f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# [PSJira](https://psjira.github.io/) +# [JiraPS](https://JiraPS.github.io/) -[![Build status](https://ci.appveyor.com/api/projects/status/utpel25via67xw3b?svg=true)](https://ci.appveyor.com/project/JoshuaT/psjira) -[![Documentation Status](https://readthedocs.org/projects/psjira/badge/?version=latest)](http://psjira.readthedocs.io/en/latest/?badge=latest) +[![Build status](https://ci.appveyor.com/api/projects/status/utpel25via67xw3b?svg=true)](https://ci.appveyor.com/project/JoshuaT/JiraPS) +[![Documentation Status](https://readthedocs.org/projects/JiraPS/badge/?version=latest)](http://JiraPS.readthedocs.io/en/latest/?badge=latest) -PSJira is a Windows PowerShell module to interact with [Atlassian JIRA](https://www.atlassian.com/software/jira) via a REST API, while maintaining a consistent PowerShell look and feel. +JiraPS is a Windows PowerShell module to interact with [Atlassian JIRA](https://www.atlassian.com/software/jira) via a REST API, while maintaining a consistent PowerShell look and feel. -Join the conversation on [![SlackLogo][] PSJira.Slack.com](https://slofile.com/slack/psjira) +Join the conversation on [![SlackLogo][] AtlassianPS.Slack.com](https://slofile.com/slack/atlassianps) [SlackLogo]: assets/Slack_Mark_Web_28x28.png @@ -13,7 +13,7 @@ Join the conversation on [![SlackLogo][] PSJira.Slack.com](https://slofile.com/s ## Documentation on ReadTheDocs -Documentation for PSJira has moved to [ReadTheDocs.io](http://psjira.readthedocs.io). Check it out, and feel free to submit issues or PRs against the documentation as well! +Documentation for JiraPS has moved to [ReadTheDocs.io](http://JiraPS.readthedocs.io). Check it out, and feel free to submit issues or PRs against the documentation as well! --- @@ -26,29 +26,30 @@ This module has a hard dependency on PowerShell 3.0. There are no plans to rele Due to the magic of continuous integration, the latest passing build of this project will always be on the PowerShell Gallery. If you have the Package Management module for PowerShell (which comes with PowerShell 5.0), you can install the latest build easily: ```powershell -Install-Module PSJira +Install-Module JiraPS ``` If you're using PowerShell 3 or 4, consider updating! If that's not an option, consider installing PackageManagement on PowerShell 3 or 4 (you can do so from the [PowerShell gallery](https://www.powershellgallery.com/) using the MSI installer link). -You can also download this module from the Download Zip button on this page. You'll need to extract the PSJira folder to your $PSModulePath (normally, this is at C:\Users\\Documents\WindowsPowerShell\Modules). +You can also download this module from the Download Zip button on this page. You'll need to extract the JiraPS folder to your $PSModulePath (normally, this is at C:\Users\\\\Documents\WindowsPowerShell\Modules). Finally, you can check the releases page here on GitHub for "stable" versions, but again, PSGallery will always have the latest (tested) version of the module. ## Usage -All the documentation for PSJira is on the [ReadTheDocs page](http://psjira.readthedocs.io). +All the documentation for JiraPS is on the [ReadTheDocs page](http://PSJira.readthedocs.io). -For basic instructions to get up and running, check out the [Getting Started](http://psjira.readthedocs.io/en/latest/getting_started.html) page. +For basic instructions to get up and running, check out the [Getting Started](http://PSJira.readthedocs.io/en/latest/getting_started.html) page. ## Contributing -Want to contribute to PSJira? Great! Start with the [Contributing](http://psjira.readthedocs.io/en/latest/contributing.html) page on the project documentation - it will explain how to work with PSJira's test and CI systems. +Want to contribute to JiraPS? Great! Start with the [Contributing](http://PSJira.readthedocs.io/en/latest/contributing.html) page on the project documentation - it will explain how to work with JiraPS's test and CI systems. -**Pull requests for PSJira are expected to pass all Pester tests before being merged.** More details can be found on the project documentation site. +**Pull requests for JiraPS are expected to pass all Pester tests before being merged.** More details can be found on the project documentation site. ## Contact -Feel free to comment on this project here on GitHub using the issues or discussion pages. You can also check out [my blog](http://replicajunction.github.io/) or catch me on the [PowerShell subreddit](https://www.reddit.com/r/powershell). +Join the conversation on [![SlackLogo][] AtlassianPS.Slack.com](https://slofile.com/slack/atlassianps) +Or write an email to contact@atlassianps.org -*Note:* As with all community PowerShell modules and code, you use PSJira at your own risk. I am not responsible if your JIRA instance causes a fire in your datacenter (literal or otherwise). +*Note:* As with all community PowerShell modules and code, you use JiraPS at your own risk. I am not responsible if your JIRA instance causes a fire in your datacenter (literal or otherwise). diff --git a/Tests/Add-JiraGroupMember.Tests.ps1 b/Tests/Add-JiraGroupMember.Tests.ps1 index 7513c302..1bc088c9 100644 --- a/Tests/Add-JiraGroupMember.Tests.ps1 +++ b/Tests/Add-JiraGroupMember.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -15,31 +15,31 @@ InModuleScope PSJira { Describe "Add-JiraGroupMember" { - Mock Write-Debug -ModuleName PSJira { + Mock Write-Debug -ModuleName JiraPS { if ($ShowDebugData) { Write-Host -Object "[DEBUG] $Message" -ForegroundColor Yellow } } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraGroup -ModuleName PSJira { + Mock Get-JiraGroup -ModuleName JiraPS { [PSCustomObject] @{ 'Name' = $testGroupName; 'Size' = 2; } } - Mock Get-JiraUser -ModuleName PSJira { + Mock Get-JiraUser -ModuleName JiraPS { [PSCustomObject] @{ 'Name' = "$InputObject"; } } - Mock Get-JiraGroupMember -ModuleName PSJira { + Mock Get-JiraGroupMember -ModuleName JiraPS { @( [PSCustomObject] @{ 'Name'=$testUsername1; @@ -47,7 +47,7 @@ InModuleScope PSJira { ) } - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod" -ForegroundColor Cyan @@ -66,7 +66,7 @@ InModuleScope PSJira { Assert-MockCalled -CommandName Invoke-JiraMethod -ParameterFilter {$URI -match $testGroupName} -Exactly -Times 1 -Scope It } - It "Accepts a PSJira.Group object to the -Group parameter" { + It "Accepts a JiraPS.Group object to the -Group parameter" { $group = Get-JiraGroup -GroupName $testGroupName { Add-JiraGroupMember -Group $testGroupName -User $testUsername2 } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -ParameterFilter {$URI -match $testGroupName} -Exactly -Times 1 -Scope It @@ -93,7 +93,7 @@ InModuleScope PSJira { It "Adds multiple users to a JIRA group if they are passed to the -User parameter" { # Override our previous mock so we have no group members - Mock Get-JiraGroupMember -ModuleName PSJira { + Mock Get-JiraGroupMember -ModuleName JiraPS { @() } diff --git a/Tests/Add-JiraIssueComment.Tests.ps1 b/Tests/Add-JiraIssueComment.Tests.ps1 index dce2bfcf..00fdc75c 100644 --- a/Tests/Add-JiraIssueComment.Tests.ps1 +++ b/Tests/Add-JiraIssueComment.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -71,10 +71,10 @@ InModuleScope PSJira { $commentResult | Should Not BeNullOrEmpty # Get-JiraIssue should be used to identify the issue parameter - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 1 -Scope It # Invoke-JiraMethod should be used to add the comment - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts pipeline input from Get-JiraIssue" { @@ -82,8 +82,8 @@ InModuleScope PSJira { $commentResult | Should Not BeNullOrEmpty # Get-JiraIssue should be called once here, and once inside Add-JiraIssueComment (to identify the InputObject parameter) - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } Context "Output checking" { diff --git a/Tests/ConvertTo-JiraComment.Tests.ps1 b/Tests/ConvertTo-JiraComment.Tests.ps1 index c0a3c812..091f3c2b 100644 --- a/Tests/ConvertTo-JiraComment.Tests.ps1 +++ b/Tests/ConvertTo-JiraComment.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraComment" { . $PSScriptRoot\Shared.ps1 @@ -59,7 +59,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Comment' + checkPsType $r 'JiraPS.Comment' defProp $r 'Id' $commentId diff --git a/Tests/ConvertTo-JiraComponent.Tests.ps1 b/Tests/ConvertTo-JiraComponent.Tests.ps1 index c941d156..2520c2f3 100644 --- a/Tests/ConvertTo-JiraComponent.Tests.ps1 +++ b/Tests/ConvertTo-JiraComponent.Tests.ps1 @@ -1,10 +1,10 @@ . $PSScriptRoot\Shared.ps1 # This is a private function, so the test needs to be within the module's scope -InModuleScope PSJira { +InModuleScope JiraPS { # A bit counter-intuitive to import this twice, but otherwise its functions - # are outside the PSJira module scope. We need it outside to make sure the + # are outside the JiraPS module scope. We need it outside to make sure the # module is loaded, and we need it inside to make sure functions are # available. . $PSScriptRoot\Shared.ps1 @@ -27,9 +27,9 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - It "Sets the type name to PSJira.Project" { - # (Get-Member -InputObject $r).TypeName | Should Be 'PSJira.Component' - $r.PSObject.TypeNames[0] | Should Be 'PSJira.Component' + It "Sets the type name to JiraPS.Project" { + # (Get-Member -InputObject $r).TypeName | Should Be 'JiraPS.Component' + $r.PSObject.TypeNames[0] | Should Be 'JiraPS.Component' } defProp $r 'Id' '11000' diff --git a/Tests/ConvertTo-JiraCreateMetaField.Tests.ps1 b/Tests/ConvertTo-JiraCreateMetaField.Tests.ps1 index 94a107a2..7f08460e 100644 --- a/Tests/ConvertTo-JiraCreateMetaField.Tests.ps1 +++ b/Tests/ConvertTo-JiraCreateMetaField.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraCreateMetaField" { . $PSScriptRoot\Shared.ps1 @@ -86,7 +86,7 @@ InModuleScope PSJira { $r.Count | Should Be 2 } - checkPsType $r[0] 'PSJira.CreateMetaField' + checkPsType $r[0] 'JiraPS.CreateMetaField' Context "Data validation" { # Our sample JSON includes two fields: summary and priority. diff --git a/Tests/ConvertTo-JiraEditMetaField.Tests.ps1 b/Tests/ConvertTo-JiraEditMetaField.Tests.ps1 index 35e4424a..b82db9f4 100644 --- a/Tests/ConvertTo-JiraEditMetaField.Tests.ps1 +++ b/Tests/ConvertTo-JiraEditMetaField.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraEditMetaField" { . $PSScriptRoot\Shared.ps1 @@ -75,7 +75,7 @@ InModuleScope PSJira { $r.Count | Should Be 2 } - checkPsType $r[0] 'PSJira.EditMetaField' + checkPsType $r[0] 'JiraPS.EditMetaField' Context "Data validation" { # Our sample JSON includes two fields: summary and priority. diff --git a/Tests/ConvertTo-JiraField.Tests.ps1 b/Tests/ConvertTo-JiraField.Tests.ps1 index d8cc674c..2f9a6e4d 100644 --- a/Tests/ConvertTo-JiraField.Tests.ps1 +++ b/Tests/ConvertTo-JiraField.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraField" { . $PSScriptRoot\Shared.ps1 @@ -12,7 +12,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Field' + checkPsType $r 'JiraPS.Field' defProp $r 'Id' 'issuetype' defProp $r 'Name' 'Issue Type' diff --git a/Tests/ConvertTo-JiraFilter.Tests.ps1 b/Tests/ConvertTo-JiraFilter.Tests.ps1 index 4a17ddd8..1dbe0574 100644 --- a/Tests/ConvertTo-JiraFilter.Tests.ps1 +++ b/Tests/ConvertTo-JiraFilter.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraFilter" { . $PSScriptRoot\Shared.ps1 @@ -57,7 +57,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Filter' + checkPsType $r 'JiraPS.Filter' defProp $r 'Id' 12844 defProp $r 'Name' 'All JIRA Bugs' diff --git a/Tests/ConvertTo-JiraGroup.Tests.ps1 b/Tests/ConvertTo-JiraGroup.Tests.ps1 index d1068a80..0571a258 100644 --- a/Tests/ConvertTo-JiraGroup.Tests.ps1 +++ b/Tests/ConvertTo-JiraGroup.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraGroup" { . $PSScriptRoot\Shared.ps1 @@ -29,7 +29,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Group' + checkPsType $r 'JiraPS.Group' defProp $r 'Name' $groupName defProp $r 'RestUrl' "$jiraServer/rest/api/2/group?groupname=$groupName" diff --git a/Tests/ConvertTo-JiraIssue.Tests.ps1 b/Tests/ConvertTo-JiraIssue.Tests.ps1 index 7dee8ab3..c408c359 100644 --- a/Tests/ConvertTo-JiraIssue.Tests.ps1 +++ b/Tests/ConvertTo-JiraIssue.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { . $PSScriptRoot\Shared.ps1 @@ -862,7 +862,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Issue' + checkPsType $r 'JiraPS.Issue' defProp $r 'Key' 'JRA-37294' defProp $r 'Id' '320391' @@ -877,10 +877,10 @@ InModuleScope PSJira { # we need to mock out a few others to avoid our Assert-MockCalled # counts being unexpected. -# Mock ConvertTo-JiraComment -ModuleName PSJira { $InputObject } -# Mock ConvertTo-JiraProject -ModuleName PSJira { $InputObject } -# Mock ConvertTo-JiraTransition -ModuleName PSJira { $InputObject } -# Mock ConvertTo-JiraUser -ModuleName PSJira { $InputObject } +# Mock ConvertTo-JiraComment -ModuleName JiraPS { $InputObject } +# Mock ConvertTo-JiraProject -ModuleName JiraPS { $InputObject } +# Mock ConvertTo-JiraTransition -ModuleName JiraPS { $InputObject } +# Mock ConvertTo-JiraUser -ModuleName JiraPS { $InputObject } $r = ConvertTo-JiraIssue -InputObject $sampleObject @@ -900,8 +900,8 @@ InModuleScope PSJira { { $value = $r.$f $value | Should Not BeNullOrEmpty - # (Get-Member -InputObject $value).TypeName | Should Be 'PSJira.User' - checkType $value 'PSJira.User' + # (Get-Member -InputObject $value).TypeName | Should Be 'JiraPS.User' + checkType $value 'JiraPS.User' } # We can't mock this out without rewriting most of the code in it @@ -909,12 +909,12 @@ InModuleScope PSJira { } It "Uses ConvertTo-JiraProject to return the project as an object" { - # (Get-Member -InputObject $r.Project).TypeName | Should Be 'PSJira.Project' - checkType $r.Project 'PSJira.Project' + # (Get-Member -InputObject $r.Project).TypeName | Should Be 'JiraPS.Project' + checkType $r.Project 'JiraPS.Project' } It "Uses ConvertTo-JiraTransition to return the issue's transitions as an object" { - checkType $r.Transition[0] 'PSJira.Transition' + checkType $r.Transition[0] 'JiraPS.Transition' } } } diff --git a/Tests/ConvertTo-JiraIssueType.Tests.ps1 b/Tests/ConvertTo-JiraIssueType.Tests.ps1 index 0be3dcc6..23b2645a 100644 --- a/Tests/ConvertTo-JiraIssueType.Tests.ps1 +++ b/Tests/ConvertTo-JiraIssueType.Tests.ps1 @@ -1,5 +1,5 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraIssueType" { . $PSScriptRoot\Shared.ps1 @@ -26,7 +26,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.IssueType' + checkPsType $r 'JiraPS.IssueType' defProp $r 'Id' $issueTypeId defProp $r 'Name' $issueTypeName diff --git a/Tests/ConvertTo-JiraPriority.Tests.ps1 b/Tests/ConvertTo-JiraPriority.Tests.ps1 index a7456daf..dd12acf3 100644 --- a/Tests/ConvertTo-JiraPriority.Tests.ps1 +++ b/Tests/ConvertTo-JiraPriority.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraPriority" { . $PSScriptRoot\Shared.ps1 @@ -27,7 +27,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Priority' + checkPsType $r 'JiraPS.Priority' defProp $r 'Id' $priorityId defProp $r 'Name' $priorityName diff --git a/Tests/ConvertTo-JiraProject.Tests.ps1 b/Tests/ConvertTo-JiraProject.Tests.ps1 index b0fb4626..f2085e98 100644 --- a/Tests/ConvertTo-JiraProject.Tests.ps1 +++ b/Tests/ConvertTo-JiraProject.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraProject" { . $PSScriptRoot\Shared.ps1 @@ -38,7 +38,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Project' + checkPsType $r 'JiraPS.Project' defProp $r 'Id' $projectId defProp $r 'Key' $projectKey diff --git a/Tests/ConvertTo-JiraSession.Tests.ps1 b/Tests/ConvertTo-JiraSession.Tests.ps1 index 1b207bc7..3f23fbc5 100644 --- a/Tests/ConvertTo-JiraSession.Tests.ps1 +++ b/Tests/ConvertTo-JiraSession.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { . $PSScriptRoot\Shared.ps1 Describe "ConvertTo-JiraSession" { @@ -26,7 +26,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Session' + checkPsType $r 'JiraPS.Session' defProp $r 'Username' $sampleUsername defProp $r 'JSessionID' $sampleJSessionID diff --git a/Tests/ConvertTo-JiraStatus.Tests.ps1 b/Tests/ConvertTo-JiraStatus.Tests.ps1 index 3ed2c330..56d217e6 100644 --- a/Tests/ConvertTo-JiraStatus.Tests.ps1 +++ b/Tests/ConvertTo-JiraStatus.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraStatus" { . $PSScriptRoot\Shared.ps1 @@ -34,7 +34,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Status' + checkPsType $r 'JiraPS.Status' defProp $r 'Id' $statusId defProp $r 'Name' $statusName diff --git a/Tests/ConvertTo-JiraTransition.Tests.ps1 b/Tests/ConvertTo-JiraTransition.Tests.ps1 index 403ad656..8666757b 100644 --- a/Tests/ConvertTo-JiraTransition.Tests.ps1 +++ b/Tests/ConvertTo-JiraTransition.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraTransition" { . $PSScriptRoot\Shared.ps1 @@ -42,12 +42,12 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.Transition' + checkPsType $r 'JiraPS.Transition' defProp $r 'Id' $tId defProp $r 'Name' $tName - It "Defines the 'ResultStatus' property as a PSJira.Status object" { + It "Defines the 'ResultStatus' property as a JiraPS.Status object" { $r.ResultStatus.Id | Should Be $tRId $r.ResultStatus.Name | Should Be $tRName } diff --git a/Tests/ConvertTo-JiraUser.Tests.ps1 b/Tests/ConvertTo-JiraUser.Tests.ps1 index ea363b84..faa212cc 100644 --- a/Tests/ConvertTo-JiraUser.Tests.ps1 +++ b/Tests/ConvertTo-JiraUser.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { Describe "ConvertTo-JiraUser" { . $PSScriptRoot\Shared.ps1 @@ -27,7 +27,7 @@ InModuleScope PSJira { $r | Should Not BeNullOrEmpty } - checkPsType $r 'PSJira.User' + checkPsType $r 'JiraPS.User' defProp $r 'Name' $username defProp $r 'DisplayName' $displayName diff --git a/Tests/Format-Jira.Tests.ps1 b/Tests/Format-Jira.Tests.ps1 index 86e7a22b..0c29dde9 100644 --- a/Tests/Format-Jira.Tests.ps1 +++ b/Tests/Format-Jira.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true diff --git a/Tests/Get-JiraComponent.Tests.ps1 b/Tests/Get-JiraComponent.Tests.ps1 index 8a12ecdb..22cfee04 100644 --- a/Tests/Get-JiraComponent.Tests.ps1 +++ b/Tests/Get-JiraComponent.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -49,16 +49,16 @@ InModuleScope PSJira { "@ Describe "Get-JiraComponent" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/component/${componentId}"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/component/${componentId}"} { ConvertFrom-Json2 $restResultOne } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed diff --git a/Tests/Get-JiraConfigServer.Tests.ps1 b/Tests/Get-JiraConfigServer.Tests.ps1 index a76e5fcd..cd15702f 100644 --- a/Tests/Get-JiraConfigServer.Tests.ps1 +++ b/Tests/Get-JiraConfigServer.Tests.ps1 @@ -1,7 +1,7 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true diff --git a/Tests/Get-JiraField.Tests.ps1 b/Tests/Get-JiraField.Tests.ps1 index 0ea2f293..c1d64ab4 100644 --- a/Tests/Get-JiraField.Tests.ps1 +++ b/Tests/Get-JiraField.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { $jiraServer = 'http://jiraserver.example.com' @@ -132,11 +132,11 @@ InModuleScope PSJira { "@ Describe "Get-JiraField" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $Uri -eq "$jiraServer/rest/api/latest/field"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $Uri -eq "$jiraServer/rest/api/latest/field"} { ConvertFrom-Json2 $restResult } @@ -146,7 +146,7 @@ InModuleScope PSJira { $allResults = Get-JiraField $allResults | Should Not BeNullOrEmpty @($allResults).Count | Should Be @((ConvertFrom-Json2 -InputObject $restResult)).Count - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Gets a specified field if a field ID is provided" { diff --git a/Tests/Get-JiraFilter.Tests.ps1 b/Tests/Get-JiraFilter.Tests.ps1 index 161565c5..8466c4b2 100644 --- a/Tests/Get-JiraFilter.Tests.ps1 +++ b/Tests/Get-JiraFilter.Tests.ps1 @@ -1,7 +1,7 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -21,7 +21,7 @@ InModuleScope PSJira { # If we don't override this in a context or test, we don't want it to # actually try to query a JIRA instance - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-WebRequest" -ForegroundColor Cyan @@ -48,14 +48,14 @@ InModuleScope PSJira { Context "Behavior testing" { It "Queries JIRA for a filter with a given ID" { { Get-JiraFilter -Id 12345 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/12345'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/12345'} } It "Uses ConvertTo-JiraFilter to output a Filter object if JIRA returns data" { - Mock Invoke-JiraMethod -ModuleName PSJira { $true } - Mock ConvertTo-JiraFilter -ModuleName PSJira {} + Mock Invoke-JiraMethod -ModuleName JiraPS { $true } + Mock ConvertTo-JiraFilter -ModuleName JiraPS {} { Get-JiraFilter -Id 12345 } | Should Not Throw - Assert-MockCalled -CommandName ConvertTo-JiraFilter -ModuleName PSJira + Assert-MockCalled -CommandName ConvertTo-JiraFilter -ModuleName JiraPS } } @@ -107,23 +107,23 @@ InModuleScope PSJira { It "Accepts a filter ID for the -Filter parameter" { { Get-JiraFilter -Id 12345 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts multiple filter IDs to the -Filter parameter" { { Get-JiraFilter -Id '12345','67890' } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/12345'} - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/67890'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/12345'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/filter/67890'} } - It "Accepts a PSJira.Filter object to the InputObject parameter" { + It "Accepts a JiraPS.Filter object to the InputObject parameter" { { Get-JiraFilter -InputObject $sampleFilter } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*rest/api/*/filter/12844'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*rest/api/*/filter/12844'} } - It "Accepts a PSJira.Filter object via pipeline" { + It "Accepts a JiraPS.Filter object via pipeline" { { $sampleFilter | Get-JiraFilter } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*rest/api/*/filter/12844'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*rest/api/*/filter/12844'} } } } diff --git a/Tests/Get-JiraGroup.Tests.ps1 b/Tests/Get-JiraGroup.Tests.ps1 index 324a3b66..c36a4f64 100644 --- a/Tests/Get-JiraGroup.Tests.ps1 +++ b/Tests/Get-JiraGroup.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { $showMockData = $false @@ -27,12 +27,12 @@ InModuleScope PSJira { Describe "Get-JiraGroup" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } # Searching for a group. - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/group?groupname=$testGroupNameEscaped"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/group?groupname=$testGroupNameEscaped"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with GET method" -ForegroundColor Cyan @@ -43,7 +43,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed diff --git a/Tests/Get-JiraGroupMember.Tests.ps1 b/Tests/Get-JiraGroupMember.Tests.ps1 index 7d2ff561..e62c9205 100644 --- a/Tests/Get-JiraGroupMember.Tests.ps1 +++ b/Tests/Get-JiraGroupMember.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -22,7 +22,7 @@ InModuleScope PSJira { # actually try to query a JIRA instance Mock Invoke-JiraMethod {} - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup*' } { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup*' } { ConvertFrom-Json2 @' { "Name": "testgroup", @@ -32,13 +32,13 @@ InModuleScope PSJira { '@ } - Mock Get-JiraGroup -ModuleName PSJira { + Mock Get-JiraGroup -ModuleName JiraPS { $obj = [PSCustomObject] @{ 'Name' = 'testgroup' 'RestUrl' = 'https://jira.example.com/rest/api/2/group?groupname=testgroup' 'Size' = 2 } - $obj.PSObject.TypeNames.Insert(0, 'PSJira.Group') + $obj.PSObject.TypeNames.Insert(0, 'JiraPS.Group') Write-Output $obj } @@ -59,7 +59,7 @@ InModuleScope PSJira { } Context "Behavior testing" { - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod" -ForegroundColor Cyan @@ -69,7 +69,7 @@ InModuleScope PSJira { } } - Mock Get-JiraUser -ModuleName PSJira { + Mock Get-JiraUser -ModuleName JiraPS { [PSCustomObject] @{ 'Name' = 'username' } @@ -77,7 +77,7 @@ InModuleScope PSJira { It "Obtains members about a provided group in JIRA" { { Get-JiraGroupMember -Group testgroup } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } } It "Supports the -StartIndex and -MaxResults parameters to page through search results" { @@ -85,7 +85,7 @@ InModuleScope PSJira { # Expected: expand=users[10:60] (start index of 10, last index of 10+50) # https://docs.atlassian.com/jira/REST/6.4.12/#d2e2307 # Also, -like doesn't seem to "like" square brackets - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*10:60*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*10:60*' } } It "Returns all issues via looping if -MaxResults is not specified" { @@ -93,7 +93,7 @@ InModuleScope PSJira { # In order to test this, we'll need a slightly more elaborate # mock that actually returns some data. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod" -ForegroundColor Cyan @@ -144,14 +144,14 @@ InModuleScope PSJira { Context "Input testing" { It "Accepts a group name for the -Group parameter" { { Get-JiraGroupMember -Group testgroup } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } } It "Accepts a group object for the -InputObject parameter" { $group = Get-JiraGroup -GroupName testgroup { Get-JiraGroupMember -Group $group } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/group?groupname=testgroup&expand=users*' } # We called Get-JiraGroup once manually, and it should be # called twice by Get-JiraGroupMember. diff --git a/Tests/Get-JiraIssue.Tests.ps1 b/Tests/Get-JiraIssue.Tests.ps1 index a43fefee..a3401ee7 100644 --- a/Tests/Get-JiraIssue.Tests.ps1 +++ b/Tests/Get-JiraIssue.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -57,17 +57,17 @@ InModuleScope PSJira { It "Obtains information about a provided issue in JIRA" { { Get-JiraIssue -Key TEST-001 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } } It "Uses JQL to search for issues if the -Query parameter is used" { { Get-JiraIssue -Query $jql } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*" } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*" } } It "Supports the -StartIndex and -MaxResults parameters to page through search results" { { Get-JiraIssue -Query $jql -StartIndex 10 -MaxResults 50 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*startAt=10&maxResults=50*" } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*startAt=10&maxResults=50*" } } It "Returns all issues via looping if -MaxResults is not specified" { @@ -105,17 +105,17 @@ InModuleScope PSJira { { Get-JiraIssue -Query $jql -PageSize 25 } | Should Not Throw # This should call Invoke-JiraMethod once for one issue (to get the MaxResults value)... - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*maxResults=1*" } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*maxResults=1*" } # ...and once more with the MaxResults set to the PageSize parameter - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*startAt=0&maxResults=25" } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like "*/rest/api/latest/search?jql=$jqlEscaped*startAt=0&maxResults=25" } } } Context "Input testing" { It "Accepts an issue key for the -Key parameter" { { Get-JiraIssue -Key TEST-001 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } } It "Accepts an issue object for the -InputObject parameter" { @@ -123,11 +123,11 @@ InModuleScope PSJira { 'Key' = 'TEST-001' 'ID' = '12345' } - $issue.PSObject.TypeNames.Insert(0, 'PSJira.Issue') + $issue.PSObject.TypeNames.Insert(0, 'JiraPS.Issue') # Should call Get-JiraIssue using the -Key parameter, so our URL should reflect the key we provided { Get-JiraIssue -InputObject $issue } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/TEST-001*' } } } } diff --git a/Tests/Get-JiraIssueComment.Tests.ps1 b/Tests/Get-JiraIssueComment.Tests.ps1 index c14ebbab..71cbfb92 100644 --- a/Tests/Get-JiraIssueComment.Tests.ps1 +++ b/Tests/Get-JiraIssueComment.Tests.ps1 @@ -1,7 +1,7 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true . $PSScriptRoot\Shared.ps1 @@ -32,11 +32,11 @@ InModuleScope PSJira { ] } "@ - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraIssue -ModuleName PSJira { + Mock Get-JiraIssue -ModuleName JiraPS { [PSCustomObject] @{ ID = $issueID; Key = $issueKey; @@ -45,7 +45,7 @@ InModuleScope PSJira { } # Obtaining comments from an issue...this is IT-3676 in the test environment - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/issue/$issueID/comment"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/issue/$issueID/comment"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with GET method" -ForegroundColor Cyan @@ -56,7 +56,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -80,11 +80,11 @@ InModuleScope PSJira { $comments.RestUrl | Should Be "$jiraServer/rest/api/2/issue/$issueID/comment/90730" # Get-JiraIssue should be called to identify the -Issue parameter - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 1 -Scope It # Normally, this would be called once in Get-JiraIssue and a second time in Get-JiraIssueComment, but # since we've mocked Get-JiraIssue out, it will only be called once. - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Obtains all Jira comments from a Jira issue if the Jira object is provided" { @@ -92,14 +92,14 @@ InModuleScope PSJira { $comments = Get-JiraIssueComment -Issue $issue $comments | Should Not BeNullOrEmpty $comments.ID | Should Be 90730 - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Handles pipeline input from Get-JiraIssue" { $comments = Get-JiraIssue -Key $issueKey | Get-JiraIssueComment $comments | Should Not BeNullOrEmpty $comments.ID | Should Be 90730 - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } } } diff --git a/Tests/Get-JiraIssueCreateMetadata.Tests.ps1 b/Tests/Get-JiraIssueCreateMetadata.Tests.ps1 index 8716cf53..d53c2a13 100644 --- a/Tests/Get-JiraIssueCreateMetadata.Tests.ps1 +++ b/Tests/Get-JiraIssueCreateMetadata.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -21,7 +21,7 @@ InModuleScope PSJira { # If we don't override this in a context or test, we don't want it to # actually try to query a JIRA instance - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-WebRequest" -ForegroundColor Cyan @@ -230,14 +230,14 @@ InModuleScope PSJira { } '@ - Mock Get-JiraProject -ModuleName PSJira { + Mock Get-JiraProject -ModuleName JiraPS { [PSCustomObject] @{ ID = 10003; Name = 'Test Project'; } } - Mock Get-JiraIssueType -ModuleName PSJira { + Mock Get-JiraIssueType -ModuleName JiraPS { [PSCustomObject] @{ ID = 2; Name = 'Test Issue Type'; @@ -246,13 +246,13 @@ InModuleScope PSJira { It "Queries Jira for metadata information about creating an issue" { { Get-JiraIssueCreateMetadata -Project 10003 -IssueType 2 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/createmeta?projectIds=10003&issuetypeIds=2&expand=projects.issuetypes.fields'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/createmeta?projectIds=10003&issuetypeIds=2&expand=projects.issuetypes.fields'} } It "Uses ConvertTo-JiraCreateMetaField to output CreateMetaField objects if JIRA returns data" { # This is a simplified version of what JIRA will give back - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { @{ projects = @{ issuetypes = @{ @@ -264,15 +264,15 @@ InModuleScope PSJira { } } } - Mock ConvertTo-JiraCreateMetaField -ModuleName PSJira {} + Mock ConvertTo-JiraCreateMetaField -ModuleName JiraPS {} { Get-JiraIssueCreateMetadata -Project 10003 -IssueType 2 } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/createmeta?projectIds=10003&issuetypeIds=2&expand=projects.issuetypes.fields'} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like '*/rest/api/*/issue/createmeta?projectIds=10003&issuetypeIds=2&expand=projects.issuetypes.fields'} # There are 2 example fields in our mock above, but they should # be passed to Convert-JiraCreateMetaField as a single object. # The method should only be called once. - Assert-MockCalled -CommandName ConvertTo-JiraCreateMetaField -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName ConvertTo-JiraCreateMetaField -ModuleName JiraPS -Exactly -Times 1 -Scope It } } } diff --git a/Tests/Get-JiraIssueEditMetadata.Tests.ps1 b/Tests/Get-JiraIssueEditMetadata.Tests.ps1 index 1780a75c..40fb6cd6 100644 --- a/Tests/Get-JiraIssueEditMetadata.Tests.ps1 +++ b/Tests/Get-JiraIssueEditMetadata.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -24,7 +24,7 @@ InModuleScope PSJira { # If we don't override this in a context or test, we don't want it to # actually try to query a JIRA instance - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod" -ForegroundColor Cyan @@ -212,7 +212,7 @@ InModuleScope PSJira { } '@ - Mock Get-JiraIssue -ModuleName PSJira { + Mock Get-JiraIssue -ModuleName JiraPS { [PSCustomObject] @{ ID = $issueID; Key = $issueKey; @@ -222,13 +222,13 @@ InModuleScope PSJira { It "Queries Jira for metadata information about editing an issue" { { Get-JiraIssueEditMetadata -Issue $issueID } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like "*/rest/api/*/issue/$issueID/editmeta"} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like "*/rest/api/*/issue/$issueID/editmeta"} } It "Uses ConvertTo-JiraEditMetaField to output EditMetaField objects if JIRA returns data" { # This is a simplified version of what JIRA will give back - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { @{ fields = [PSCustomObject] @{ 'a' = 1; @@ -236,15 +236,15 @@ InModuleScope PSJira { } } } - Mock ConvertTo-JiraEditMetaField -ModuleName PSJira {} + Mock ConvertTo-JiraEditMetaField -ModuleName JiraPS {} { Get-JiraIssueEditMetadata -Issue $issueID } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like "*/rest/api/*/issue/$issueID/editmeta"} + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It -ParameterFilter {$Method -eq 'Get' -and $URI -like "*/rest/api/*/issue/$issueID/editmeta"} # There are 2 example fields in our mock above, but they should # be passed to Convert-JiraCreateMetaField as a single object. # The method should only be called once. - Assert-MockCalled -CommandName ConvertTo-JiraEditMetaField -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName ConvertTo-JiraEditMetaField -ModuleName JiraPS -Exactly -Times 1 -Scope It } } } diff --git a/Tests/Get-JiraIssueType.Tests.ps1 b/Tests/Get-JiraIssueType.Tests.ps1 index 959d886a..8db3b600 100644 --- a/Tests/Get-JiraIssueType.Tests.ps1 +++ b/Tests/Get-JiraIssueType.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { $jiraServer = 'http://jiraserver.example.com' @@ -78,16 +78,16 @@ InModuleScope PSJira { Describe "Get-JiraIssueType" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $Uri -eq "$jiraServer/rest/api/latest/issuetype"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $Uri -eq "$jiraServer/rest/api/latest/issuetype"} { ConvertFrom-Json2 $restResult } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -98,7 +98,7 @@ InModuleScope PSJira { $allResults = Get-JiraIssueType $allResults | Should Not BeNullOrEmpty @($allResults).Count | Should Be 8 - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Gets a specified issue type if an issue type ID is provided" { diff --git a/Tests/Get-JiraPriority.Tests.ps1 b/Tests/Get-JiraPriority.Tests.ps1 index 32c02dc1..c02e8af4 100644 --- a/Tests/Get-JiraPriority.Tests.ps1 +++ b/Tests/Get-JiraPriority.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -60,20 +60,20 @@ InModuleScope PSJira { Describe "Get-JiraPriority" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/priority"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/priority"} { ConvertFrom-Json2 $restResultAll } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/priority/1"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/priority/1"} { ConvertFrom-Json2 $restResultOne } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -100,10 +100,10 @@ InModuleScope PSJira { @($getResult).Count | Should Be 1 } - It "Converts the output object to type PSJira.Priority" { + It "Converts the output object to type JiraPS.Priority" { $getResult = Get-JiraPriority -Id 1 -Credential $testCred $getResult | Should Not BeNullOrEmpty - $getResult.PSObject.TypeNames[0] | Should Be 'PSJira.Priority' + $getResult.PSObject.TypeNames[0] | Should Be 'JiraPS.Priority' } } } diff --git a/Tests/Get-JiraProject.Tests.ps1 b/Tests/Get-JiraProject.Tests.ps1 index bf88fa76..fcb8e988 100644 --- a/Tests/Get-JiraProject.Tests.ps1 +++ b/Tests/Get-JiraProject.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -63,28 +63,28 @@ InModuleScope PSJira { "@ Describe "Get-JiraProject" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project"} { ConvertFrom-Json2 $restResultAll } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectKey}?expand=projectKeys"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectKey}?expand=projectKeys"} { ConvertFrom-Json2 $restResultOne } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectId}?expand=projectKeys"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectId}?expand=projectKeys"} { ConvertFrom-Json2 $restResultOne } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectKey}expand=projectKeys"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -eq "$jiraServer/rest/api/latest/project/${projectKey}expand=projectKeys"} { ConvertFrom-Json2 $restResultOne } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed diff --git a/Tests/Get-JiraSession.Tests.ps1 b/Tests/Get-JiraSession.Tests.ps1 index 59bd0ffd..f6662ac4 100644 --- a/Tests/Get-JiraSession.Tests.ps1 +++ b/Tests/Get-JiraSession.Tests.ps1 @@ -1,12 +1,12 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true . $PSScriptRoot\Shared.ps1 Describe "Get-JiraSession" { - It "Obtains a saved PSJira.Session object from module PrivateData" { + It "Obtains a saved JiraPS.Session object from module PrivateData" { # I don't know how to test this, since I can't access module PrivateData from Pester. # The tests for New-JiraSession use this function to validate that they work, so if # those tests pass, this function should be working as well. diff --git a/Tests/Get-JiraUser.Tests.ps1 b/Tests/Get-JiraUser.Tests.ps1 index d3e2f969..5ae697e7 100644 --- a/Tests/Get-JiraUser.Tests.ps1 +++ b/Tests/Get-JiraUser.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -55,12 +55,12 @@ InModuleScope PSJira { Describe "Get-JiraUser" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } # Searching for a user. - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -like "$jiraServer/rest/api/*/user/search?username=$testUsername"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -like "$jiraServer/rest/api/*/user/search?username=$testUsername"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with GET method" -ForegroundColor Cyan @@ -71,7 +71,7 @@ InModuleScope PSJira { } # Viewing a specific user. The main difference here is that this includes groups, and the first does not. - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Get' -and $URI -like "$jiraServer/rest/api/*/user?username=$testUsername&expand=groups"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Get' -and $URI -like "$jiraServer/rest/api/*/user?username=$testUsername&expand=groups"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with GET method" -ForegroundColor Cyan @@ -82,7 +82,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -112,7 +112,7 @@ InModuleScope PSJira { $getResult.Active | Should Be $restObj.active } - It "Gets information for a provided Jira user if a PSJira.User object is provided to the InputObject parameter" { + It "Gets information for a provided Jira user if a JiraPS.User object is provided to the InputObject parameter" { $result2 = Get-JiraUser -InputObject $getResult $result2 | Should Not BeNullOrEmpty $result2.Name | Should Be $testUsername diff --git a/Tests/Invoke-JiraIssueTransition.Tests.ps1 b/Tests/Invoke-JiraIssueTransition.Tests.ps1 index 78849a67..26f01e83 100644 --- a/Tests/Invoke-JiraIssueTransition.Tests.ps1 +++ b/Tests/Invoke-JiraIssueTransition.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -12,21 +12,21 @@ InModuleScope PSJira { Describe "Invoke-JiraIssueTransition" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraIssue -ModuleName PSJira { + Mock Get-JiraIssue -ModuleName JiraPS { $t1 = [PSCustomObject] @{ Name = 'Start Progress'; ID = 11; } - $t1.PSObject.TypeNames.Insert(0, 'PSJira.Transition') + $t1.PSObject.TypeNames.Insert(0, 'JiraPS.Transition') $t2 = [PSCustomObject] @{ Name = 'Resolve'; ID = 81; } - $t2.PSObject.TypeNames.Insert(0, 'PSJira.Transition') + $t2.PSObject.TypeNames.Insert(0, 'JiraPS.Transition') [PSCustomObject] @{ ID = $issueID; @@ -36,7 +36,7 @@ InModuleScope PSJira { } } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Post' -and $URI -eq "$jiraServer/rest/api/latest/issue/$issueID/transitions"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Post' -and $URI -eq "$jiraServer/rest/api/latest/issue/$issueID/transitions"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with POST method" -ForegroundColor Cyan @@ -47,7 +47,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -64,8 +64,8 @@ InModuleScope PSJira { It "Performs a transition on a Jira issue when given an issue key and transition ID" { { $result = Invoke-JiraIssueTransition -Issue $issueKey -Transition 11 } | Should Not Throw - Assert-MockCalled Get-JiraIssue -ModuleName PSJira -Exactly -Times 1 -Scope It - Assert-MockCalled Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled Get-JiraIssue -ModuleName JiraPS -Exactly -Times 1 -Scope It + Assert-MockCalled Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Performs a transition on a Jira issue when given an issue object and transition object" { @@ -74,14 +74,14 @@ InModuleScope PSJira { { Invoke-JiraIssueTransition -Issue $issue -Transition $transition } | Should Not Throw # Get-JiraIssue should be called once here in the test, and once in Invoke-JiraIssueTransition to # obtain a reference to the issue object - Assert-MockCalled Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Handles pipeline input from Get-JiraIssue" { { $result = Get-JiraIssue -Key $issueKey | Invoke-JiraIssueTransition -Transition 11 } | Should Not Throw - Assert-MockCalled Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } } } diff --git a/Tests/Invoke-JiraMethod.Tests.ps1 b/Tests/Invoke-JiraMethod.Tests.ps1 index 810d01e3..10dcc43b 100644 --- a/Tests/Invoke-JiraMethod.Tests.ps1 +++ b/Tests/Invoke-JiraMethod.Tests.ps1 @@ -5,7 +5,7 @@ param() . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -94,7 +94,7 @@ InModuleScope PSJira { # This is the authorizion token that should be provided when using HTTP Basic authentication. It takes the form of # "username:password" encoded into a base 64 String. - # This is why you shouldn't use PSJira on a plain HTTP connection. + # This is why you shouldn't use JiraPS on a plain HTTP connection. # See how easy it would be to decrypt your credentials? $token = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("${testUsername}:$testPassword")) diff --git a/Tests/PSJira.Tests.ps1 b/Tests/JiraPS.Tests.ps1 similarity index 97% rename from Tests/PSJira.Tests.ps1 rename to Tests/JiraPS.Tests.ps1 index daa1e4ab..0e2b813b 100644 --- a/Tests/PSJira.Tests.ps1 +++ b/Tests/JiraPS.Tests.ps1 @@ -1,14 +1,14 @@ $here = Split-Path -Parent $MyInvocation.MyCommand.Path $projectRoot = Split-Path -Parent $here -$moduleRoot = "$projectRoot\PSJira" +$moduleRoot = "$projectRoot\JiraPS" -$manifestFile = "$moduleRoot\PSJira.psd1" +$manifestFile = "$moduleRoot\JiraPS.psd1" $changelogFile = "$projectRoot\CHANGELOG.md" $appveyorFile = "$projectRoot\appveyor.yml" $publicFunctions = "$moduleRoot\Public" $internalFunctions = "$moduleRoot\Internal" -Describe "PSJira" { +Describe "JiraPS" { Context "All required tests are present" { # We want to make sure that every .ps1 file in the Functions directory that isn't a Pester test has an associated Pester test. # This helps keep me honest and makes sure I'm testing my code appropriately. @@ -25,7 +25,7 @@ Describe "PSJira" { # These tests are...erm, borrowed...from the module tests from the Pester module. # I think they are excellent for sanity checking, and all credit for the following # tests goes to Dave Wyatt, the genius behind Pester. I've just adapted them - # slightly to match PSJira. + # slightly to match JiraPS. $script:manifest = $null It "Includes a valid manifest file" { @@ -43,7 +43,7 @@ Describe "PSJira" { $script:manifest = Invoke-Expression (Get-Content $script:manifestFile -Raw) It "Manifest file includes the correct root module" { - $script:manifest.RootModule | Should Be 'PSJira.psm1' + $script:manifest.RootModule | Should Be 'JiraPS.psm1' } It "Manifest file includes the correct guid" { diff --git a/Tests/New-JiraGroup.Tests.ps1 b/Tests/New-JiraGroup.Tests.ps1 index 4e49b5bf..e73b3106 100644 --- a/Tests/New-JiraGroup.Tests.ps1 +++ b/Tests/New-JiraGroup.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -34,11 +34,11 @@ InModuleScope PSJira { # } # } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'POST' -and $URI -eq "$jiraServer/rest/api/latest/group"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'POST' -and $URI -eq "$jiraServer/rest/api/latest/group"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with POST method" -ForegroundColor Cyan @@ -49,7 +49,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -71,9 +71,9 @@ InModuleScope PSJira { Assert-MockCalled 'ConvertTo-JiraGroup' } - # It "Outputs a PSJira.Group object" { + # It "Outputs a JiraPS.Group object" { # $newResult = New-JiraGroup -GroupName $testGroupName - # (Get-Member -InputObject $newResult).TypeName | Should Be 'PSJira.Group' + # (Get-Member -InputObject $newResult).TypeName | Should Be 'JiraPS.Group' # $newResult.Name | Should Be $testGroupName # $newResult.RestUrl | Should Be "$jiraServer/rest/api/2/group?groupname=$testGroupName" # } diff --git a/Tests/New-JiraIssue.Tests.ps1 b/Tests/New-JiraIssue.Tests.ps1 index 1a49aaad..da6ea3ea 100644 --- a/Tests/New-JiraIssue.Tests.ps1 +++ b/Tests/New-JiraIssue.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -95,7 +95,7 @@ InModuleScope PSJira { # The String in the ParameterFilter is made from the keywords # we should expect to see in the JSON that should be sent, # including the summary provided in the test call above. - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Post' -and $URI -like '*/rest/api/*/issue' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Post' -and $URI -like '*/rest/api/*/issue' } } } diff --git a/Tests/New-JiraSession.Tests.ps1 b/Tests/New-JiraSession.Tests.ps1 index 63169bfa..63048154 100644 --- a/Tests/New-JiraSession.Tests.ps1 +++ b/Tests/New-JiraSession.Tests.ps1 @@ -5,7 +5,7 @@ param() . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -36,7 +36,7 @@ InModuleScope PSJira { "@ Describe "New-JiraSession" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } diff --git a/Tests/New-JiraUser.Tests.ps1 b/Tests/New-JiraUser.Tests.ps1 index 5f7cbf0f..ff3ee659 100644 --- a/Tests/New-JiraUser.Tests.ps1 +++ b/Tests/New-JiraUser.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -33,11 +33,11 @@ InModuleScope PSJira { } } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'POST' -and $URI -eq "$jiraServer/rest/api/latest/user"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'POST' -and $URI -eq "$jiraServer/rest/api/latest/user"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with POST method" -ForegroundColor Cyan @@ -48,7 +48,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed diff --git a/Tests/Remove-JiraGroup.Tests.ps1 b/Tests/Remove-JiraGroup.Tests.ps1 index 31481eca..c6bf6d4b 100644 --- a/Tests/Remove-JiraGroup.Tests.ps1 +++ b/Tests/Remove-JiraGroup.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -27,22 +27,22 @@ InModuleScope PSJira { Describe "Remove-JiraGroup" { - Mock Write-Debug -ModuleName PSJira { + Mock Write-Debug -ModuleName JiraPS { if ($ShowDebugData) { Write-Host -Object "[DEBUG] $Message" -ForegroundColor Yellow } } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraGroup -ModuleName PSJira { + Mock Get-JiraGroup -ModuleName JiraPS { ConvertTo-JiraGroup (ConvertFrom-Json2 $testJson) } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'DELETE' -and $URI -eq "$jiraServer/rest/api/latest/group?groupname=$testGroupName"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'DELETE' -and $URI -eq "$jiraServer/rest/api/latest/group?groupname=$testGroupName"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with DELETE method" -ForegroundColor Cyan @@ -53,7 +53,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -69,7 +69,7 @@ InModuleScope PSJira { Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It } - It "Accepts a PSJira.Group object to the -Group parameter" { + It "Accepts a JiraPS.Group object to the -Group parameter" { $group = Get-JiraGroup -GroupName $testGroupName { Remove-JiraGroup -Group $group -Force } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It diff --git a/Tests/Remove-JiraGroupMember.Tests.ps1 b/Tests/Remove-JiraGroupMember.Tests.ps1 index fd62f1ff..e31cf0a9 100644 --- a/Tests/Remove-JiraGroupMember.Tests.ps1 +++ b/Tests/Remove-JiraGroupMember.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -14,31 +14,31 @@ InModuleScope PSJira { Describe "Remove-JiraGroupMember" { - Mock Write-Debug -ModuleName PSJira { + Mock Write-Debug -ModuleName JiraPS { if ($ShowDebugData) { Write-Host -Object "[DEBUG] $Message" -ForegroundColor Yellow } } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraGroup -ModuleName PSJira { + Mock Get-JiraGroup -ModuleName JiraPS { [PSCustomObject] @{ 'Name' = $testGroupName; 'Size' = 2; } } - Mock Get-JiraUser -ModuleName PSJira { + Mock Get-JiraUser -ModuleName JiraPS { [PSCustomObject] @{ 'Name' = "$InputObject"; } } - Mock Get-JiraGroupMember -ModuleName PSJira { + Mock Get-JiraGroupMember -ModuleName JiraPS { @( [PSCustomObject] @{ 'Name'=$testUsername1; @@ -46,7 +46,7 @@ InModuleScope PSJira { ) } - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod" -ForegroundColor Cyan @@ -65,7 +65,7 @@ InModuleScope PSJira { Assert-MockCalled -CommandName Invoke-JiraMethod -ParameterFilter {$URI -match $testGroupName} -Exactly -Times 1 -Scope It } - It "Accepts a PSJira.Group object to the -Group parameter" { + It "Accepts a JiraPS.Group object to the -Group parameter" { $group = Get-JiraGroup -GroupName $testGroupName { Remove-JiraGroupMember -Group $testGroupName -User $testUsername1 -Force } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -ParameterFilter {$URI -match $testGroupName} -Exactly -Times 1 -Scope It @@ -92,7 +92,7 @@ InModuleScope PSJira { It "Removes multiple users to a JIRA group if they are passed to the -User parameter" { # Override our previous mock so we have two group members - Mock Get-JiraGroupMember -ModuleName PSJira { + Mock Get-JiraGroupMember -ModuleName JiraPS { @( [PSCustomObject] @{ 'Name'=$testUsername1; diff --git a/Tests/Remove-JiraSession.Tests.ps1 b/Tests/Remove-JiraSession.Tests.ps1 index 992a3451..34553f06 100644 --- a/Tests/Remove-JiraSession.Tests.ps1 +++ b/Tests/Remove-JiraSession.Tests.ps1 @@ -5,7 +5,7 @@ param() . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -36,7 +36,7 @@ InModuleScope PSJira { Describe "Remove-JiraSession" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } @@ -67,7 +67,7 @@ InModuleScope PSJira { throw "Unidentified call to Invoke-JiraMethod" } - It "Closes a saved PSJira.Session object from module PrivateData" { + It "Closes a saved JiraPS.Session object from module PrivateData" { # This probably isn't the best test for this, but it's about all I can come up with at the moment. # New-JiraSession has some slightly more elaborate testing, which includes a test for Get-JiraSession, diff --git a/Tests/Remove-JiraUser.Tests.ps1 b/Tests/Remove-JiraUser.Tests.ps1 index 5429cee5..125579ca 100644 --- a/Tests/Remove-JiraUser.Tests.ps1 +++ b/Tests/Remove-JiraUser.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -26,22 +26,22 @@ InModuleScope PSJira { Describe "Remove-JiraUser" { - Mock Write-Debug -ModuleName PSJira { + Mock Write-Debug -ModuleName JiraPS { if ($ShowDebugData) { Write-Host -Object "[DEBUG] $Message" -ForegroundColor Yellow } } - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraUser -ModuleName PSJira { + Mock Get-JiraUser -ModuleName JiraPS { ConvertTo-JiraUser (ConvertFrom-Json2 $testJsonGet) } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'DELETE' -and $URI -eq "$jiraServer/rest/api/latest/user?username=$testUsername"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'DELETE' -and $URI -eq "$jiraServer/rest/api/latest/user?username=$testUsername"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with DELETE method" -ForegroundColor Cyan @@ -52,7 +52,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -68,7 +68,7 @@ InModuleScope PSJira { Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It } - It "Accepts a PSJira.User object to the -User parameter" { + It "Accepts a JiraPS.User object to the -User parameter" { $user = Get-JiraUser -UserName $testUsername { Remove-JiraUser -User $user -Force } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It diff --git a/Tests/Resolve-JiraError.Tests.ps1 b/Tests/Resolve-JiraError.Tests.ps1 index bc273f08..cfd1859c 100644 --- a/Tests/Resolve-JiraError.Tests.ps1 +++ b/Tests/Resolve-JiraError.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true . $PSScriptRoot\Shared.ps1 diff --git a/Tests/Set-JiraConfigServer.Tests.ps1 b/Tests/Set-JiraConfigServer.Tests.ps1 index 1aa12075..e1ad1602 100644 --- a/Tests/Set-JiraConfigServer.Tests.ps1 +++ b/Tests/Set-JiraConfigServer.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true diff --git a/Tests/Set-JiraIssue.Tests.ps1 b/Tests/Set-JiraIssue.Tests.ps1 index 3c58b111..095cd981 100644 --- a/Tests/Set-JiraIssue.Tests.ps1 +++ b/Tests/Set-JiraIssue.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -76,33 +76,33 @@ InModuleScope PSJira { # The String in the ParameterFilter is made from the keywords # we should expect to see in the JSON that should be sent, # including the summary provided in the test call above. - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*summary*set*New summary*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*summary*set*New summary*' } } It "Modifies the description of an issue if the -Description parameter is passed" { { Set-JiraIssue -Issue TEST-001 -Description 'New description' } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*description*set*New description*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*description*set*New description*' } } It "Modifies the assignee of an issue if -Assignee is passed" { { Set-JiraIssue -Issue TEST-001 -Assignee username } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*username*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*username*' } } It "Unassigns an issue if 'Unassigned' is passed to the -Assignee parameter" { { Set-JiraIssue -Issue TEST-001 -Assignee unassigned } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*""*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*""*' } } It "Calls Invoke-JiraMethod twice if using Assignee and another field" { { Set-JiraIssue -Issue TEST-001 -Summary 'New summary' -Assignee username } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*summary*set*New summary*' } - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*username*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*summary*set*New summary*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345/assignee' -and $Body -like '*name*username*' } } It "Uses Set-JiraIssueLabel with the -Set parameter when the -Label parameter is used" { { Set-JiraIssue -Issue TEST-001 -Label 'test' } | Should Not Throw - Assert-MockCalled -CommandName Set-JiraIssueLabel -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Set -ne $null } + Assert-MockCalled -CommandName Set-JiraIssueLabel -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Set -ne $null } } It "Updates custom fields if provided to the -Fields parameter" { @@ -113,9 +113,9 @@ InModuleScope PSJira { } } { Set-JiraIssue -Issue TEST-001 -Fields @{'customfield_12345'='foo'; 'customfield_67890'='bar'; 'customfield_111222'=@(@{value='foobar'})} } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_12345*set*foo*' } - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_67890*set*bar*' } - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_111222*set*foobar*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_12345*set*foo*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_67890*set*bar*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_111222*set*foobar*' } } } @@ -123,8 +123,8 @@ InModuleScope PSJira { Context "Input testing" { It "Accepts an issue key for the -Issue parameter" { { Set-JiraIssue -Issue TEST-001 -Summary 'Test summary - using issue key' } | Should Not Throw - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 1 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts an issue object for the -Issue parameter" { @@ -132,14 +132,14 @@ InModuleScope PSJira { { Set-JiraIssue -Issue $issue -Summary 'Test summary - Object' } | Should Not Throw # Get-JiraIssue is called once explicitly in this test, and a # second time by Set-JiraIssue - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts the output of Get-JiraObject by pipeline for the -Issue paramete" { { Get-JiraIssue -Key TEST-001 | Set-JiraIssue -Summary 'Test summary - InputObject pipeline' } | Should Not Throw - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Throws an exception if an invalid issue is provided" { diff --git a/Tests/Set-JiraIssueLabel.Tests.ps1 b/Tests/Set-JiraIssueLabel.Tests.ps1 index d8232f3d..34ebad6a 100644 --- a/Tests/Set-JiraIssueLabel.Tests.ps1 +++ b/Tests/Set-JiraIssueLabel.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -75,24 +75,24 @@ InModuleScope PSJira { # The String in the ParameterFilter is made from the keywords # we should expect to see in the JSON that should be sent, # including the summary provided in the test call above. - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*testLabel1*testLabel2*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*testLabel1*testLabel2*' } } It "Adds new labels if the Add parameter is supplied" { { Set-JiraIssueLabel -Issue TEST-001 -Add 'testLabel3' } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*testLabel3*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*testLabel3*' } } It "Removes labels if the Remove parameter is supplied" { # The issue already has labels existingLabel1 and # existingLabel2. It should be set to just existingLabel2. { Set-JiraIssueLabel -Issue TEST-001 -Remove 'existingLabel1' } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*existingLabel2*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*existingLabel2*' } } It "Clears all labels if the Clear parameter is supplied" { { Set-JiraIssueLabel -Issue TEST-001 -Clear } | Should Not Throw - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*update*labels*set*' } } It "Allows use of both Add and Remove parameters at the same time" { @@ -103,8 +103,8 @@ InModuleScope PSJira { Context "Input testing" { It "Accepts an issue key for the -Issue parameter" { { Set-JiraIssueLabel -Issue TEST-001 -Set 'testLabel1' } | Should Not Throw - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 1 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts an issue object for the -Issue parameter" { @@ -112,14 +112,14 @@ InModuleScope PSJira { { Set-JiraIssueLabel -Issue $issue -Set 'testLabel1' } | Should Not Throw # Get-JiraIssue is called once explicitly in this test, and a # second time by Set-JiraIssue - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } It "Accepts the output of Get-JiraIssue by pipeline for the -Issue paramete" { { Get-JiraIssue -Key TEST-001 | Set-JiraIssueLabel -Set 'testLabel1' } | Should Not Throw - Assert-MockCalled -CommandName Get-JiraIssue -ModuleName PSJira -Exactly -Times 2 -Scope It - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Exactly -Times 1 -Scope It + Assert-MockCalled -CommandName Get-JiraIssue -ModuleName JiraPS -Exactly -Times 2 -Scope It + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Exactly -Times 1 -Scope It } } } diff --git a/Tests/Set-JiraUser.Tests.ps1 b/Tests/Set-JiraUser.Tests.ps1 index b5288a18..35cd1009 100644 --- a/Tests/Set-JiraUser.Tests.ps1 +++ b/Tests/Set-JiraUser.Tests.ps1 @@ -1,6 +1,6 @@ . $PSScriptRoot\Shared.ps1 -InModuleScope PSJira { +InModuleScope JiraPS { [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope='*', Target='SuppressImportModule')] $SuppressImportModule = $true @@ -28,15 +28,15 @@ InModuleScope PSJira { Describe "Set-JiraUser" { - Mock Get-JiraConfigServer -ModuleName PSJira { + Mock Get-JiraConfigServer -ModuleName JiraPS { Write-Output $jiraServer } - Mock Get-JiraUser -ModuleName PSJira { + Mock Get-JiraUser -ModuleName JiraPS { ConvertTo-JiraUser (ConvertFrom-Json2 $restResultGet) } - Mock Invoke-JiraMethod -ModuleName PSJira -ParameterFilter {$Method -eq 'Put' -and $URI -eq "$jiraServer/rest/api/latest/user?username=$testUsername"} { + Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter {$Method -eq 'Put' -and $URI -eq "$jiraServer/rest/api/latest/user?username=$testUsername"} { if ($ShowMockData) { Write-Host " Mocked Invoke-JiraMethod with GET method" -ForegroundColor Cyan @@ -47,7 +47,7 @@ InModuleScope PSJira { } # Generic catch-all. This will throw an exception if we forgot to mock something. - Mock Invoke-JiraMethod -ModuleName PSJira { + Mock Invoke-JiraMethod -ModuleName JiraPS { Write-Host " Mocked Invoke-JiraMethod with no parameter filter." -ForegroundColor DarkRed Write-Host " [Method] $Method" -ForegroundColor DarkRed Write-Host " [URI] $URI" -ForegroundColor DarkRed @@ -67,7 +67,7 @@ InModuleScope PSJira { Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It } - It "Accepts a PSJira.User object to the -User parameter" { + It "Accepts a JiraPS.User object to the -User parameter" { $user = Get-JiraUser -UserName $testUsername { Set-JiraUser -User $user -DisplayName $testDisplayNameChanged } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -Exactly -Times 1 -Scope It @@ -95,7 +95,7 @@ InModuleScope PSJira { $output | Should BeNullOrEmpty } - It "Outputs a PSJira.User object if the -PassThru parameter is passed" { + It "Outputs a JiraPS.User object if the -PassThru parameter is passed" { $output = Set-JiraUser -User $testUsername -DisplayName $testDisplayNameChanged -PassThru $output | Should Not BeNullOrEmpty } diff --git a/Tests/Shared.ps1 b/Tests/Shared.ps1 index 5cb587c9..a59e7ef9 100644 --- a/Tests/Shared.ps1 +++ b/Tests/Shared.ps1 @@ -1,7 +1,7 @@ # Dot source this script in any Pester test script that requires the module to be imported. -$ModuleName = 'PSJira' +$ModuleName = 'JiraPS' $ModuleManifestPath = "$PSScriptRoot\..\$ModuleName\$ModuleManifestName.psd1" $RootModule = "$PSScriptRoot\..\$ModuleName\$ModuleName.psm1" @@ -11,7 +11,7 @@ $RootModule = "$PSScriptRoot\..\$ModuleName\$ModuleName.psm1" if (-not (Get-Module -Name $ModuleName -ErrorAction SilentlyContinue) -or (!$SuppressImportModule)) { # If we import the .psd1 file, Pester has issues where it detects multiple - # modules named PSJira. Importing the .psm1 file seems to correct this. + # modules named JiraPS. Importing the .psm1 file seems to correct this. # -Scope Global is needed when running tests from within a CI environment Import-Module $RootModule -Scope Global -Force diff --git a/Tools/Appveyor.ps1 b/Tools/Appveyor.ps1 index 6756542c..2c6ac406 100644 --- a/Tools/Appveyor.ps1 +++ b/Tools/Appveyor.ps1 @@ -6,11 +6,11 @@ #region Variables # AppVeyor environment variables -# This refers to the root of the project directory - usually C:\Projects\PSJira, but it's not safe to assume that +# This refers to the root of the project directory - usually C:\Projects\JiraPS, but it's not safe to assume that $ProjectRoot = $env:APPVEYOR_BUILD_FOLDER # This is the root of the module folder inside the project, where the .psm1 file lives -$ModuleRoot = Join-Path -Path $ProjectRoot -ChildPath 'PSJira' +$ModuleRoot = Join-Path -Path $ProjectRoot -ChildPath 'JiraPS' # This is AppVeyor's internal job ID, used to return results using their REST API $JobId = $env:APPVEYOR_JOB_ID @@ -62,4 +62,4 @@ Write-Host Write-Host "=== Completed AppVeyor.ps1 ===" -ForegroundColor Green Write-Host -exit ( [int] (-not $psake.build_success) ) \ No newline at end of file +exit ( [int] (-not $psake.build_success) ) diff --git a/Tools/Deploy.ps1 b/Tools/Deploy.ps1 index cf1a22b6..567dc25e 100644 --- a/Tools/Deploy.ps1 +++ b/Tools/Deploy.ps1 @@ -62,7 +62,7 @@ if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { $shouldDeploy = $true } -Update-ModuleManifest -Path (Join-Path -Path $ModuleRoot -ChildPath 'PSJira.psd1') -BuildNumber $env:APPVEYOR_BUILD_NUMBER +Update-ModuleManifest -Path (Join-Path -Path $ModuleRoot -ChildPath 'JiraPS.psd1') -BuildNumber $env:APPVEYOR_BUILD_NUMBER $publishParams = @{ Path = Join-Path -Path $env:APPVEYOR_BUILD_FOLDER -ChildPath $env:ModuleName @@ -99,4 +99,4 @@ if ($shouldDeploy) Write-Host Write-Host "=== Completed Deploy.ps1 ===" -ForegroundColor Green -Write-Host \ No newline at end of file +Write-Host diff --git a/Tools/Pre-Push.ps1 b/Tools/Pre-Push.ps1 index 33e36b18..63d71573 100644 --- a/Tools/Pre-Push.ps1 +++ b/Tools/Pre-Push.ps1 @@ -1,7 +1,7 @@ Write-Host "Starting Pre-Push Hooks..." -ForegroundColor Cyan try { Write-Host "PSScriptRoot: $PSScriptRoot" - $moduleManifest = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'PSJira\PSJira.psd1' + $moduleManifest = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'JiraPS\JiraPS.psd1' Write-Host "Module manifest file: $moduleManifest" Import-Module $moduleManifest $pesterResults = Invoke-Pester -Quiet -PassThru @@ -36,4 +36,4 @@ catch { Write-Error -Message $_ Write-Host "`n" exit 1 -} \ No newline at end of file +} diff --git a/Tools/psake.ps1 b/Tools/psake.ps1 index b88b7834..bc8711e3 100644 --- a/Tools/psake.ps1 +++ b/Tools/psake.ps1 @@ -4,7 +4,7 @@ Properties { $ProjectRoot = $env:APPVEYOR_BUILD_FOLDER # This is the root of the module folder inside the project - $ModuleRoot = Join-Path -Path $ProjectRoot -ChildPath 'PSJira' + $ModuleRoot = Join-Path -Path $ProjectRoot -ChildPath 'JiraPS' $Commit = $env:APPVEYOR_REPO_COMMIT $CommitMessage = $env:APPVEYOR_REPO_COMMIT_MESSAGE @@ -24,7 +24,7 @@ Task Init { $line Set-Location $ProjectRoot "Importing module" - Import-Module "$ProjectRoot\PSJira\PSJira.psd1" + Import-Module "$ProjectRoot\JiraPS\JiraPS.psd1" "`n" } @@ -114,7 +114,7 @@ Task Deploy -Depends Build { if ($env:APPVEYOR_REPO_BRANCH -eq 'master' -and -not $env:APPVEYOR_PULL_REQUEST_NUMBER) { "Patching module manifest version with build number ($env:APPVEYOR_BUILD_NUMBER)" - Update-ModuleManifest -Path (Join-Path -Path $ModuleRoot -ChildPath 'PSJira.psd1') -BuildNumber $env:APPVEYOR_BUILD_NUMBER + Update-ModuleManifest -Path (Join-Path -Path $ModuleRoot -ChildPath 'JiraPS.psd1') -BuildNumber $env:APPVEYOR_BUILD_NUMBER $publishParams = @{ Path = $ModuleRoot @@ -147,4 +147,4 @@ Task Deploy -Depends Build { } } -Task Default -Depends Deploy \ No newline at end of file +Task Default -Depends Deploy diff --git a/appveyor.yml b/appveyor.yml index 5d973b3c..cf84b32a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,8 @@ os: WMF 5 environment: ModuleName: $(APPVEYOR_PROJECT_NAME) Tags: 'JIRA' - LicenseUri: 'https://github.com/PSJira/PSJira/blob/master/LICENSE' - ProjectUri: 'https://github.com/PSJira/PSJira/' + LicenseUri: 'https://github.com/AtlassianPS/JiraPS/blob/master/LICENSE' + ProjectUri: 'https://github.com/AtlassianPS/JiraPS/' # To encrypt a value in AppVeyor, go to the Account menu and choose "Encrypt data" PSGalleryAPIKey: diff --git a/docs/Makefile b/docs/Makefile index 643f80ca..24fb7085 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = PSJira +SPHINXPROJ = JiraPS SOURCEDIR = . BUILDDIR = _build @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/authentication.rst b/docs/authentication.rst index 57b51a59..8a9ae036 100644 --- a/docs/authentication.rst +++ b/docs/authentication.rst @@ -9,7 +9,7 @@ At present, there are two main methods of authenticating to JIRA: HTTP basic aut HTTP Basic ========== -Each PSJira function that queries a JIRA instance provides a -Credential parameter. Simply pass your JIRA credentials to this parameter. +Each JiraPS function that queries a JIRA instance provides a -Credential parameter. Simply pass your JIRA credentials to this parameter. .. code-block:: powershell @@ -32,7 +32,7 @@ To create a JIRA session, you can use the New-JiraSession function: $cred = Get-Credential 'powershell' New-JiraSession -Credential $cred -Once you've created this session, you're done! You don't need to specify it when running other commands - PSJira will manage this session internally and provide the session cookie to JIRA when needed. This also means your credentials are only sent over the network once. +Once you've created this session, you're done! You don't need to specify it when running other commands - JiraPS will manage this session internally and provide the session cookie to JIRA when needed. This also means your credentials are only sent over the network once. To close this session, use this command: @@ -47,6 +47,6 @@ This will close the active "logged in" session with JIRA. What About OAuth? ================= -JIRA does support use of OAuth, but PSJira does not yet. This is a to-do item! +JIRA does support use of OAuth, but JiraPS does not yet. This is a to-do item! -.. _Basic Access Authentication: https://en.wikipedia.org/wiki/Basic_access_authentication \ No newline at end of file +.. _Basic Access Authentication: https://en.wikipedia.org/wiki/Basic_access_authentication diff --git a/docs/conf.py b/docs/conf.py index a2a7508c..ed7c44eb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# PSJira documentation build configuration file, created by +# JiraPS documentation build configuration file, created by # sphinx-quickstart on Tue Dec 13 19:31:32 2016. # # This file is execfile()d with the current directory set to its @@ -47,9 +47,9 @@ master_doc = 'index' # General information about the project. -project = 'PSJira' -copyright = '2016, replicaJunction' -author = 'replicaJunction' +project = 'JiraPS' +copyright = '2016, AtlassianPS' +author = 'AtlassianPS' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -101,7 +101,7 @@ # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = 'PSJiradoc' +htmlhelp_basename = 'JiraPSdoc' # -- Options for LaTeX output --------------------------------------------- @@ -128,8 +128,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'PSJira.tex', 'PSJira Documentation', - 'replicaJunction', 'manual'), + (master_doc, 'JiraPS.tex', 'JiraPS Documentation', + [author] 'manual'), ] @@ -138,7 +138,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'psjira', 'PSJira Documentation', + (master_doc, 'JiraPS', 'JiraPS Documentation', [author], 1) ] @@ -149,8 +149,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'PSJira', 'PSJira Documentation', - author, 'PSJira', 'One line description of project.', + (master_doc, 'JiraPS', 'JiraPS Documentation', + author, 'JiraPS', 'One line description of project.', 'Miscellaneous'), ] @@ -165,4 +165,4 @@ html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] -# otherwise, readthedocs.org uses their theme by default, so no need to specify it \ No newline at end of file +# otherwise, readthedocs.org uses their theme by default, so no need to specify it diff --git a/docs/contributing.rst b/docs/contributing.rst index fa007515..a6851b04 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -1,22 +1,22 @@ ====================== -Contributing to PSJira +Contributing to JiraPS ====================== -There are two main areas where PSJira needs your help: in the module code itself, and in this documentation. +There are two main areas where JiraPS needs your help: in the module code itself, and in this documentation. -* :ref:`PSJira core` +* :ref:`JiraPS core` * :ref:`Documentation` -.. _PSJira core: +.. _JiraPS core: Module Code =========== -The code for PSJira relies extensively on Pester tests as a sanity check. Pester tests make sure that when a function gets changed, other functions that depend on it don't break due to the change. +The code for JiraPS relies extensively on Pester tests as a sanity check. Pester tests make sure that when a function gets changed, other functions that depend on it don't break due to the change. -**Pull requests for PSJira are expected to pass all Pester tests before they will be merged.** +**Pull requests for JiraPS are expected to pass all Pester tests before they will be merged.** -This is not intended to keep people from contributing to PSJira...just to ensure that new features and changes don't break existing ones. If you have ideas for improvements but aren't comfortable with Pester, please feel free to submit a pull request. I (or other authors) would be glad to work with you to figure out what's failing and make the necessary changes (whether in your code or in the test code). +This is not intended to keep people from contributing to JiraPS...just to ensure that new features and changes don't break existing ones. If you have ideas for improvements but aren't comfortable with Pester, please feel free to submit a pull request. I (or other authors) would be glad to work with you to figure out what's failing and make the necessary changes (whether in your code or in the test code). Tests are code, just like the module itself, so it's entirely possible that they need to be fixed or updated when the module changes. Correcting tests is a healthy part of developing a tool, so changes to tests are welcome as well. @@ -27,7 +27,7 @@ Automated Testing via Pre-Push Hooks By setting up a pre-push hook in your local Git repository, you can make sure that all Pester tests pass before you push your changes back to GitHub. This is not necessary to contribute, but it can save some frustration all around. -In your PSJira workspace, create a file at .git/hooks/pre-push (with no file extension) +In your JiraPS workspace, create a file at .git/hooks/pre-push (with no file extension) Edit this file in a text editor and add this content: @@ -48,11 +48,11 @@ Documentation Unlike the main module code, there is very little to be tested in this documentation (the big thing that gets tested is the changelog, to make sure it's kept up-to-date with releases). -This documentation is found in the /docs/ folder of the main PSJira repo, and is written in `ReStructured Text`_. This format was chosen mostly due to a deeper integration with ReadTheDocs than Markdown provided on its own, but the Sphinx build engine that processes the RST is quite powerful and supports a lot of interesting features. +This documentation is found in the /docs/ folder of the main JiraPS repo, and is written in `ReStructured Text`_. This format was chosen mostly due to a deeper integration with ReadTheDocs than Markdown provided on its own, but the Sphinx build engine that processes the RST is quite powerful and supports a lot of interesting features. RST isn't difficult - a lot of the information in here is just written in plain text, and the parts that aren't provide examples of how to use it - but if you'd like to read more on how to write in RST, I'd recommend the `Sphinx guide`_ on RST, since that engine is responsible for building this documentation. One particular place where I'd love some help with these docs is the :doc:`custom_fields` page. I'd like to add as many examples of the -Fields parameter as possible to this page, so that in the future, users can find working examples for specific fields and field types. .. _ReStructured Text: http://docutils.sourceforge.net/rst.html -.. _Sphinx guide: http://www.sphinx-doc.org/en/1.4.9/rest.html \ No newline at end of file +.. _Sphinx guide: http://www.sphinx-doc.org/en/1.4.9/rest.html diff --git a/docs/creating_issues.rst b/docs/creating_issues.rst index cb51af8b..ae74b69a 100644 --- a/docs/creating_issues.rst +++ b/docs/creating_issues.rst @@ -8,12 +8,12 @@ In order to create a new issue in JIRA, you need to provide a certain amount of :alt: The "Create issue" screen in JIRA shows information needed in order to create an issue in JIRA. :width: 406 -To create an issue using PSJira, you need to provide this information as well. Before you can provide the needed information to create an issue, though, you'll need to know what information your JIRA instance requires! This can be dramatically different from one JIRA instance to the next, and even from one project to another. +To create an issue using JiraPS, you need to provide this information as well. Before you can provide the needed information to create an issue, though, you'll need to know what information your JIRA instance requires! This can be dramatically different from one JIRA instance to the next, and even from one project to another. Identifying "Create" Metadata ============================= -PSJira includes a command to make discorering this metadata as simple as possible. You will need to provide both a project and an issue type to this function, because each project and issue type can be configured to accept or require different fields when creating issues. +JiraPS includes a command to make discovering this metadata as simple as possible. You will need to provide both a project and an issue type to this function, because each project and issue type can be configured to accept or require different fields when creating issues. .. code-block:: powershell @@ -55,4 +55,4 @@ New-JiraIssue provides the -Fields parameter for working with these custom field New-JiraIssue -Fields @{'customfield_10001'='foo'} # Other New-JiraIssue parameters -For more information on the -Fields parameter, see the :doc:`custom_fields` page. \ No newline at end of file +For more information on the -Fields parameter, see the :doc:`custom_fields` page. diff --git a/docs/custom_fields.rst b/docs/custom_fields.rst index 575dcc3d..0f5b9a83 100644 --- a/docs/custom_fields.rst +++ b/docs/custom_fields.rst @@ -2,9 +2,9 @@ Working With Fields =================== -Many of PSJira's functions contain convenience parameters for issue fields that are commonly used. These parameters take care of translating PowerShell to the correct JSON format when working with JIRA'S API. +Many of JiraPS's functions contain convenience parameters for issue fields that are commonly used. These parameters take care of translating PowerShell to the correct JSON format when working with JIRA'S API. -However, not every standard JIRA field is implemented via a parameter, and most JIRA instances also contain custom fields to allow your organization to tailor its JIRA instance to your own requirements. To allow PSJira to work with fields that do not have named parameters, these functions support a generic -Fields parameter. +However, not every standard JIRA field is implemented via a parameter, and most JIRA instances also contain custom fields to allow your organization to tailor its JIRA instance to your own requirements. To allow JiraPS to work with fields that do not have named parameters, these functions support a generic -Fields parameter. Using -Fields ============= @@ -88,4 +88,4 @@ Then, use this syntax: } } -If you run into any additional fields that you'd like to see documented, feel free to let me know in a GitHub issue - or submit a PR to this page with the field! \ No newline at end of file +If you run into any additional fields that you'd like to see documented, feel free to let me know in a GitHub issue - or submit a PR to this page with the field! diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 82fcb572..a736183b 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -5,21 +5,21 @@ Getting Started Prerequisites ------------- -There are only two pre-requisites for PSJira: +There are only two pre-requisites for JiraPS: 1. A working JIRA environment 2. PowerShell 3.0 or greater -You do *not* need to be a JIRA administrator to use PSJira, though of course you won't be able to perform admin-only tasks if you don't have those permissions. +You do *not* need to be a JIRA administrator to use JiraPS, though of course you won't be able to perform admin-only tasks if you don't have those permissions. Installing ---------- -If you have PowerShell 5.0 (or the PackageManagement module), you can install PSJira easily with a single line. +If you have PowerShell 5.0 (or the PackageManagement module), you can install JiraPS easily with a single line. .. code-block:: powershell - Install-Module PSJira + Install-Module JiraPS If you don't have PowerShell 5, consider updating! It's pretty quick and easy, and there are a fair amount of new features. @@ -28,14 +28,14 @@ If updating isn't an option, consider installing PackageManagement on PowerShell First-Time Setup ---------------- -Before using PSJira, you'll need to define the URL of the JIRA server you'll be using. You can do this with just one line of PowerShell: +Before using JiraPS, you'll need to define the URL of the JIRA server you'll be using. You can do this with just one line of PowerShell: .. code-block:: powershell Set-JiraConfigServer -Server 'https://my.jira.server.com:8080' -That's it! You should only need to do that once (it saves a config.xml file to the same location where the PSJira module is saved). +That's it! You should only need to do that once (it saves a config.xml file to the same location where the JiraPS module is saved). -.. note:: If you installed PSJira to Program Files, you may need to run the above command in an elevated PowerShell session. Otherwise, you might get an Access Denied error. +.. note:: If you installed JiraPS to Program Files, you may need to run the above command in an elevated PowerShell session. Otherwise, you might get an Access Denied error. -.. _PowerShell gallery: http://www.powershellgallery.com/ \ No newline at end of file +.. _PowerShell gallery: http://www.powershellgallery.com/ diff --git a/docs/index.rst b/docs/index.rst index 5aea6aed..ddf9767f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,22 +1,22 @@ -.. PSJira documentation master file, created by +.. JiraPS documentation master file, created by sphinx-quickstart on Tue Dec 13 19:31:32 2016. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ====== -PSJira +JiraPS ====== .. image:: https://ci.appveyor.com/api/projects/status/utpel25via67xw3b?svg=true - :target: https://ci.appveyor.com/project/JoshuaT/psjira + :target: https://ci.appveyor.com/project/JoshuaT/JiraPS :alt: Appveyor build status -.. image:: https://readthedocs.org/projects/psjira/badge/?version=latest - :target: http://psjira.readthedocs.io/en/latest/?badge=latest +.. image:: https://readthedocs.org/projects/JiraPS/badge/?version=latest + :target: http://JiraPS.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -PSJira is a Windows PowerShell module to interact with Atlassian JIRA via a REST API, while maintaining a consistent PowerShell look and feel. +JiraPS is a Windows PowerShell module to interact with Atlassian JIRA via a REST API, while maintaining a consistent PowerShell look and feel. .. note:: This documentation is a work in progress - but there's enough here already that I wanted to go ahead and publish it as I continue fleshing it out. Please feel free to submit PR's or issues on this documentation over on the `GitHub Issues`_ page! @@ -38,11 +38,11 @@ PSJira is a Windows PowerShell module to interact with Atlassian JIRA via a REST .. toctree:: :maxdepth: 1 - :caption: About PSJira + :caption: About JiraPS contributing changelog New to the project? Check out the :doc:`getting_started` page for a quick guide to get you up and running! -.. _`GitHub Issues`: https://github.com/PSJira/PSJira/issues +.. _`GitHub Issues`: https://github.com/AtlassianPS/JiraPS/issues diff --git a/docs/make.bat b/docs/make.bat index 9c17b346..e34a76cd 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build -set SPHINXPROJ=PSJira +set SPHINXPROJ=JiraPS if "%1" == "" goto help From 4587517fa9064815344e74b51ad187b9d491782f Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Sat, 24 Jun 2017 15:59:07 +0200 Subject: [PATCH 2/2] Update major version: 2.0.0 --- CHANGELOG.md | 9 ++++++++- JiraPS/JiraPS.psd1 | 8 ++++---- appveyor.yml | 2 +- docs/changelog.rst | 14 +++++++++++++- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8440fad..961f46d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.0.0 (Jun 24, 2017) + +### Changes to the code module + - Move module to organization `AtlassianPS` + - Rename of the module to `JiraPS` **breaking change** + - Rename of module's custom objects to `JiraPS.*` **breaking change** + ## 1.2.5 (Aug 08, 2016) IMPROVEMENTS: @@ -100,4 +107,4 @@ FEATURES: IMPROVEMENTS: -BUG FIXES: \ No newline at end of file +BUG FIXES: diff --git a/JiraPS/JiraPS.psd1 b/JiraPS/JiraPS.psd1 index dbf9d240..cf99da8a 100644 --- a/JiraPS/JiraPS.psd1 +++ b/JiraPS/JiraPS.psd1 @@ -12,7 +12,7 @@ RootModule = 'JiraPS.psm1' # Version number of this module. -ModuleVersion = '1.2.5' +ModuleVersion = '2.0.0' # Supported PSEditions # CompatiblePSEditions = @() @@ -21,13 +21,13 @@ ModuleVersion = '1.2.5' GUID = '4bf3eb15-037e-43b7-9e47-20a30436324f' # Author of this module -Author = 'Joshua T' +Author = 'AtlassianPS' # Company or vendor of this module -CompanyName = 'Unknown' +CompanyName = 'AtlassianPS.org' # Copyright statement for this module -Copyright = '(c) 2015 Joshua T. All rights reserved.' +Copyright = '(c) 2017 AtlassianPS. All rights reserved.' # Description of the functionality provided by this module Description = 'Windows PowerShell module to interact with Atlassian JIRA' diff --git a/appveyor.yml b/appveyor.yml index cf84b32a..5cc0d9a9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ environment: PSGalleryAPIKey: secure: 5WCRuuF+sk5Mjnt5cL6uJw4cMU2QzDNE8uBXOw2hXSujE93zxRcROS3ZM1w85ui3 -version: 1.2.5.{build} +version: 2.0.0.{build} # Only build commits to these branches branches: diff --git a/docs/changelog.rst b/docs/changelog.rst index 8fc9f910..cb921416 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,18 @@ Changelog ========= +2.0.0 +===== + +Release date: Jun 24, 2017 + +Changes to the code module +-------------------------- + +* Move module to organization ``AtlassianPS`` +* Rename of the module to ``JiraPS`` [**breaking change**} +* Rename of module's custom objects to ``JiraPS.*`` [**breaking change**] + 1.2.5 ===== @@ -161,4 +173,4 @@ Bug Fixes The format of this changelog is inspired by `Pester's changelog`_, which is in turn inspired by `Vagrant`_. .. _`Pester's changelog`: https://github.com/pester/Pester/blob/master/CHANGELOG.md -.. _`Vagrant`: https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md \ No newline at end of file +.. _`Vagrant`: https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md