Skip to content

Commit

Permalink
formatting update
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Nov 14, 2018
1 parent 0af362c commit 9f48b00
Show file tree
Hide file tree
Showing 1,196 changed files with 3,511 additions and 4,945 deletions.
18 changes: 7 additions & 11 deletions bin/build-project.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ param(
[ValidateSet('ps3', 'ps4', 'Release', 'Debug')]
[string] $MsbuildConfiguration = "Release",
[string] $MsbuildOptions = "",
[Parameter(HelpMessage='Target to run instead of build')]
[Parameter(HelpMessage = 'Target to run instead of build')]
[string] $MsbuildTarget = 'Build'
)

if (-not $PSBoundParameters.ContainsKey('MsbuildConfiguration'))
{
$_MsbuildConfiguration = switch ($PSVersionTable.PSVersion.Major)
{
if (-not $PSBoundParameters.ContainsKey('MsbuildConfiguration')) {
$_MsbuildConfiguration = switch ($PSVersionTable.PSVersion.Major) {
3 { "ps3" }
4 { "ps4" }
default { "Release" }
}
}
else { $_MsbuildConfiguration = $MsbuildConfiguration }
} else { $_MsbuildConfiguration = $MsbuildConfiguration }

function Get-MsBuildPath {
[CmdletBinding()]
[OutputType([string])]
param()
process{
process {
$rawPath = "$(Split-Path ([string].Assembly.Location))\msbuild.exe"
(Resolve-Path $rawPath).Path
}
Expand Down Expand Up @@ -60,10 +57,9 @@ if ($MsbuildTarget -eq 'Build') {
if ($script:alwaysBuildLibrary) { Move-Item -Path "$PSModuleRoot\bin\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop }
else { Copy-Item -Path "$PSModuleRoot\bin\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop }
Add-Type -Path "$PSModuleRoot\dbatools.dll" -ErrorAction Stop
}
catch {
} catch {
Write-Verbose -Message "Failed to copy & import, attempting to import straight from the module directory"
Add-Type -Path "$PSModuleRoot\bin\dbatools.dll" -ErrorAction Stop
}
Write-Verbose -Message "Total duration: $((Get-Date) - $start)"
}
}
9 changes: 3 additions & 6 deletions bin/build/vsts-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ $previousVersion = Import-Clixml ".\vsts-version.xml"
$currentVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo((Get-Item "bin\dbatools.dll").FullName).FileVersion
Remove-Item ".\vsts-version.xml"

if ($previousVersion -ne $currentVersion)
{
if ($previousVersion -ne $currentVersion) {
$branch = $env:BUILD_SOURCEBRANCHNAME
Write-Host "Previous: $previousVersion | Current: $currentVersion | Library should be updated"

git add .
git commit -m "VSTS Library Compile ***NO_CI***"
$errorMessage = git push "https://$env:SYSTEM_ACCESSTOKEN@github.com/sqlcollaborative/dbatools.git" head:$branch 2>&1
if ($LASTEXITCODE -gt 0) { throw $errorMessage }
}
else
{
} else {
Write-Host "Version: $currentVersion | Library is up to date"
}
}
2 changes: 1 addition & 1 deletion bin/build/vsts-prebuild.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$item = Get-Item "bin\dbatools.dll"
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($item.FullName).FileVersion
$version | Export-Clixml ".\vsts-version.xml"
$version | Export-Clixml ".\vsts-version.xml"
21 changes: 7 additions & 14 deletions bin/library.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Configu
# No need to load the library again, if the module was once already imported.
Write-Verbose -Message "Library already loaded, will not load again"
$ImportLibrary = $false
}
else {
} else {
Write-Verbose -Message "Library not present already, will import"
$ImportLibrary = $true
}
Expand All @@ -54,8 +53,7 @@ if ($ImportLibrary) {
if ($script:strictSecurityMode) {
if (Test-Path -Path "$libraryBase\dbatools.dll") {
Add-Type -Path "$libraryBase\dbatools.dll" -ErrorAction Stop
}
else {
} else {
throw "Library not found, terminating!"
}
}
Expand All @@ -70,17 +68,14 @@ if ($ImportLibrary) {
Write-Verbose -Message "Found library, trying to copy & import"
if ($libraryBase -ne $script:DllRoot) { Copy-Item -Path "$libraryBase\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop }
Add-Type -Path "$script:DllRoot\dbatools.dll" -ErrorAction Stop
}
catch {
} catch {
Write-Verbose -Message "Failed to copy&import, attempting to import straight from the module directory"
Add-Type -Path "$libraryBase\dbatools.dll" -ErrorAction Stop
}
Write-Verbose -Message "Total duration: $((Get-Date) - $start)"
}
elseif ($hasProject) {
} elseif ($hasProject) {
. Import-ModuleFile "$($script:PSModuleRoot)\bin\build-project.ps1"
}
else {
} else {
throw "No valid dbatools library found! Check your module integrity"
}
}
Expand All @@ -89,8 +84,7 @@ if ($ImportLibrary) {
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsException" -SerializationDepth 2 -ErrorAction Ignore
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsExceptionRecord" -SerializationDepth 2 -ErrorAction Ignore
#endregion PowerShell TypeData
}
catch {
} catch {
#region Warning
Write-Warning @'
Dear User,
Expand Down Expand Up @@ -138,5 +132,4 @@ Please restart the console to apply the library update, or unexpected behavior w
If the issues continue to persist, please Remove-Item '$script:PSModuleRoot\bin\dbatools.dll'
"@
}
#endregion Version Warning

#endregion Version Warning
2 changes: 1 addition & 1 deletion bin/type-extensions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ if (-not ([Sqlcollaborative.Dbatools.dbaSystem.SystemHost]::ModuleImported)) {

$this.ExecuteNonQuery($Command)
} -ErrorAction Ignore
}
}
6 changes: 2 additions & 4 deletions bin/typealiases.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ $TypeAliasTable = @{
foreach ($TypeAlias in $TypeAliasTable.Keys) {
try {
$TAType::Add($TypeAlias, $TypeAliasTable[$TypeAlias])
} catch {
}
catch {
}
}

}
5 changes: 2 additions & 3 deletions functions/Add-DbaAgDatabase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Add-DbaAgDatabase {
PS C:\> Get-DbaDbSharePoint -SqlInstance sqlcluster -ConfigDatabase SharePoint_Config_2019 | Add-DbaAgDatabase -AvailabilityGroup SharePoint
Adds SharePoint databases as found in SharePoint_Config_2019 on sqlcluster to ag1 on sqlcluster
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[DbaInstanceParameter[]]$SqlInstance,
Expand Down Expand Up @@ -103,5 +103,4 @@ function Add-DbaAgDatabase {
}
}
}
}

}
2 changes: 1 addition & 1 deletion functions/Add-DbaAgListener.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Add-DbaAgListener {
Creates a listener on port 1433 with a dynamic IP for the group1 availability group on sql2017.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[DbaInstanceParameter[]]$SqlInstance,
Expand Down
4 changes: 2 additions & 2 deletions functions/Add-DbaAgReplica.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Add-DbaAgReplica {
PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup SharePoint | Add-DbaAgReplica -SqlInstance sql2017b -FailoverMode Manual
Adds sql2017b to the SharePoint availability group on sql2017a with a manual failover mode.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[DbaInstanceParameter[]]$SqlInstance,
Expand Down Expand Up @@ -203,4 +203,4 @@ function Add-DbaAgReplica {
}
}
}
}
}
5 changes: 2 additions & 3 deletions functions/Add-DbaCmsRegServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Add-DbaCmsRegServer {
Creates a registered server on sql2008's CMS which points to the SQL Server, sql01. When scrolling in CMS, the name "sql01" will be visible within the Seattle group which is in the hr group.
#>
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Alias("ServerInstance", "SqlServer")]
Expand Down Expand Up @@ -142,5 +142,4 @@ function Add-DbaCmsRegServer {
end {
Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Add-DbaRegisteredServer
}
}

}
5 changes: 2 additions & 3 deletions functions/Add-DbaCmsRegServerGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Add-DbaCmsRegServerGroup {
Creates a registered server group on sql2012 and sql2014 called sub-folder within the HR group of each server
#>
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Alias("ServerInstance", "SqlServer")]
Expand Down Expand Up @@ -116,5 +116,4 @@ function Add-DbaCmsRegServerGroup {
end {
Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Add-DbaRegisteredServerGroup
}
}

}
5 changes: 2 additions & 3 deletions functions/Add-DbaComputerCertificate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Add-DbaComputerCertificate {
Adds the local C:\temp\cert.cer to the local computer's LocalMachine\My (Personal) certificate store.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")]
param (
[Alias("ServerInstance", "SqlServer", "SqlInstance")]
Expand Down Expand Up @@ -147,5 +147,4 @@ function Add-DbaComputerCertificate {
}
}
}
}

}
5 changes: 2 additions & 3 deletions functions/Add-DbaDbMirrorMonitor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Add-DbaDbMirrorMonitor {
Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on sql2008 and sql2012.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[parameter(Mandatory, ValueFromPipeline)]
Expand Down Expand Up @@ -73,5 +73,4 @@ function Add-DbaDbMirrorMonitor {
}
}
}
}

}
5 changes: 2 additions & 3 deletions functions/Add-DbaPfDataCollectorCounter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Add-DbaPfDataCollectorCounter {
Allows you to select which Data Collector you'd like to add the counter '\LogicalDisk(*)\Avg. Disk Queue Length' on localhost and prompts for confirmation.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")]
param (
[DbaInstance[]]$ComputerName = $env:COMPUTERNAME,
Expand Down Expand Up @@ -138,5 +138,4 @@ function Add-DbaPfDataCollectorCounter {
}
}
}
}

}
2 changes: 1 addition & 1 deletion functions/Backup-DbaDatabase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function Backup-DbaDatabase {
PS C:\> Backup-DbaDatabase -SqlInstance Sql2017 -Database master -BackupFileName NUL
Performs a backup of master, but sends the output to the NUL device (ie; throws it away)
#>
#>
[CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] #For AzureCredential
param (
Expand Down
5 changes: 2 additions & 3 deletions functions/Backup-DbaDbCertificate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function Backup-DbaDbCertificate {
Exports all certificates found on sql2016 to the default data directory.
#>
#>
[CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[parameter(Mandatory, ParameterSetName = "instance")]
Expand Down Expand Up @@ -248,5 +248,4 @@ function Backup-DbaDbCertificate {
}
}
}
}

}
5 changes: 2 additions & 3 deletions functions/Backup-DbaDbMasterKey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Backup-DbaDbMasterKey {
Logs into sql2016 with Windows credentials then backs up db1's keys to the \\nas\sqlbackups\keys directory.
#>
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[DbaInstanceParameter[]]$SqlInstance,
Expand Down Expand Up @@ -158,5 +158,4 @@ function Backup-DbaDbMasterKey {
end {
Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Backup-DbaDatabaseMasterKey
}
}

}
4 changes: 2 additions & 2 deletions functions/Clear-DbaConnectionPool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Clear-DbaConnectionPool {
Clears all connection pools on workstation27.
#>
#>
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
Expand Down Expand Up @@ -81,4 +81,4 @@ function Clear-DbaConnectionPool {
end {
Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Clear-DbaSqlConnectionPool
}
}
}
4 changes: 2 additions & 2 deletions functions/Clear-DbaLatchStatistics.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Clear-DbaLatchStatistics {
PS C:\> Clear-DbaLatchStatistics -SqlInstance sql2008 -SqlCredential $cred
Connects using sqladmin credential and clears latch statistics on servers sql2008 and sqlserver2012
#>
#>
[CmdletBinding(ConfirmImpact = 'High', SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Singular Noun doesn't make sense")]
param (
Expand Down Expand Up @@ -92,4 +92,4 @@ function Clear-DbaLatchStatistics {
}
}
}
}
}
5 changes: 2 additions & 3 deletions functions/Clear-DbaPlanCache.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Clear-DbaPlanCache {
PS C:\> Find-DbaInstance -ComputerName localhost | Get-DbaPlanCache | Clear-DbaPlanCache -Threshold 200
Scans localhost for instances using the browser service, traverses all instances and gets the plan cache for each, clears them out if they are above 200 MB.
#>
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Alias("ServerInstance", "SqlServer", "SqlServers")]
Expand Down Expand Up @@ -107,5 +107,4 @@ function Clear-DbaPlanCache {
}
}
}
}

}
4 changes: 2 additions & 2 deletions functions/Clear-DbaWaitStatistics.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function Clear-DbaWaitStatistics {
Clears wait stats on servers sql2008 and sqlserver2012, without prompting
#>
#>
[CmdletBinding(ConfirmImpact = 'High', SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Singular Noun doesn't make sense")]
param (
Expand Down Expand Up @@ -81,4 +81,4 @@ function Clear-DbaWaitStatistics {
}
}
}
}
}
Loading

0 comments on commit 9f48b00

Please sign in to comment.