-
-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7e2643
commit 9882af6
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
function Get-DbatoolsChangeLog { | ||
<# | ||
.SYNOPSIS | ||
Opens the link to our online change log | ||
.DESCRIPTION | ||
Opens the link to our online change log. To see the local changelog instead, use the Local parameter. | ||
.PARAMETER Local | ||
Return the local change log to the console | ||
.PARAMETER EnableException | ||
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. | ||
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. | ||
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch. | ||
.NOTES | ||
Tags: changelog | ||
Author: Chrissy LeMaire (@cl), netnerds.net | ||
Website: https://dbatools.io | ||
Copyright: (c) 2018 by dbatools, licensed under MIT | ||
License: MIT https://opensource.org/licenses/MIT | ||
.LINK | ||
https://dbatools.io/Get-DbatoolsChangeLog | ||
.EXAMPLE | ||
Get-DbatoolsChangeLog | ||
Opens a browser to our online changelog | ||
.EXAMPLE | ||
Get-DbatoolsChangeLog -Local | ||
Returns the content from changelog.md | ||
#> | ||
[CmdletBinding()] | ||
param ( | ||
[switch]$Local, | ||
[switch]$EnableException | ||
) | ||
|
||
try { | ||
if (-not $Local) { | ||
Start-Process "https://github.com/sqlcollaborative/dbatools/blob/development/changelog.md" | ||
} else { | ||
$releasenotes = Get-Content $script:PSModuleRoot\changelog.md -Raw | ||
|
||
if ($Local) { | ||
($releasenotes -Split "##Local")[0] | ||
} else { | ||
$releasenotes | ||
} | ||
} | ||
} catch { | ||
Stop-Function -Message "Failure" -ErrorRecord $_ | ||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") | ||
Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan | ||
. "$PSScriptRoot\constants.ps1" | ||
|
||
Describe "$CommandName Unit Tests" -Tag 'UnitTests' { | ||
Context "Validate parameters" { | ||
[object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} | ||
[object[]]$knownParameters = 'Local', 'EnableException' | ||
$knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters | ||
It "Should only contain our specific parameters" { | ||
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 | ||
} | ||
} | ||
} | ||
<# | ||
Integration test should appear below and are custom to the command you are writing. | ||
Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests | ||
for more guidence. | ||
#> |