Skip to content

Commit df694e2

Browse files
committed
Renamed module
1 parent d620d21 commit df694e2

File tree

94 files changed

+11093
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+11093
-0
lines changed

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

appveyor.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See http://www.appveyor.com/docs/appveyor-yml for many more options
2+
image: Visual Studio 2019
3+
4+
version: 0.1.{build}
5+
6+
cache:
7+
- C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer -> appveyor.yml
8+
- C:\Program Files\WindowsPowerShell\Modules\Pester -> appveyor.yml
9+
- C:\Program Files\WindowsPowerShell\Modules\PSFramework -> appveyor.yml
10+
- C:\Program Files\WindowsPowerShell\Modules\dbatools -> appveyor.yml
11+
12+
shallow_clone: true
13+
14+
environment:
15+
workingdirectory: c:\projects\
16+
workingfolder: c:\projects\dbarefresh
17+
environment: development
18+
version: 0.1.$(appveyor_build_number)
19+
appveyor_rdp_password: P$Psd@tabaserefresh2019
20+
21+
services:
22+
- mssql2017
23+
24+
matrix:
25+
fast_finish: true
26+
27+
before_test:
28+
- ps: .\build\appveyor-prerequisites.ps1
29+
30+
build: off
31+
32+
test_script:
33+
- ps: .\build\appveyor-validate.ps1 -Finalize -IncludeCoverage
34+
35+
on_success:
36+
- ps: .\build\appveyor-build.ps1 -SkipPublish
37+
38+
#on_finish:
39+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
40+

bin/readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# bin folder
2+
3+
The bin folder exists to store binary data. And scripts related to the type system.
4+
5+
This may include your own C#-based library, third party libraries you want to include (watch the license!), or a script declaring type accelerators (effectively aliases for .NET types)
6+
7+
For more information on Type Accelerators, see the help on Set-PSFTypeAlias

build/appveyor-build.ps1

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<#
2+
This script publishes the module to the gallery.
3+
It expects as input an ApiKey authorized to publish the module.
4+
5+
Insert any build steps you may need to take before publishing it here.
6+
#>
7+
param (
8+
$ApiKey,
9+
10+
$WorkingDirectory,
11+
12+
$Repository = 'PSGallery',
13+
14+
[switch]
15+
$LocalRepo,
16+
17+
[switch]
18+
$SkipPublish,
19+
20+
[switch]
21+
$AutoVersion
22+
)
23+
24+
# region ApiKey defaults
25+
if (-not $ApiKey) {
26+
$ApiKey = $($env:psgallery_apiKey)
27+
}
28+
29+
#region Handle Working Directory Defaults
30+
if (-not $WorkingDirectory) {
31+
if ($env:RELEASE_PRIMARYARTIFACTSOURCEALIAS) {
32+
$WorkingDirectory = Join-Path -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -ChildPath $env:RELEASE_PRIMARYARTIFACTSOURCEALIAS
33+
}
34+
else { $WorkingDirectory = $env:workingdirectory }
35+
}
36+
#endregion Handle Working Directory Defaults
37+
38+
# Prepare publish folder
39+
try {
40+
Write-PSFMessage -Level Important -Message "Creating and populating publishing directory"
41+
$publishDir = New-Item -Path $WorkingDirectory -Name publish -ItemType Directory
42+
Copy-Item -Path "$($WorkingDirectory)\dbarefresh" -Destination $publishDir.FullName -Recurse -Force
43+
}
44+
catch {
45+
Stop-PSFFunction -Message "Something went wrong creating and populating publishing directory" -Target $publishDir -ErrorRecord $_
46+
return
47+
}
48+
49+
# region remove unneccesary directories
50+
try {
51+
Remove-Item -Path "$($publishDir.FullName)\dbarefresh\appveyor.yml" -Force -Recurse
52+
Remove-Item -Path "$($publishDir.FullName)\dbarefresh\build" -Force -Recurse
53+
Remove-Item -Path "$($publishDir.FullName)\dbarefresh\tests" -Force -Recurse
54+
}
55+
catch {
56+
Stop-PSFFunction -Message "Could not remove directories" -Target $publishDir.FullName -ErrorRecord $_
57+
return
58+
}
59+
# end region
60+
61+
#region Gather text data to compile
62+
$text = @()
63+
$processed = @()
64+
65+
# Gather Stuff to run before
66+
foreach ($line in (Get-Content "$($PSScriptRoot)\filesBefore.txt" | Where-Object { $_ -notlike "#*" })) {
67+
if ([string]::IsNullOrWhiteSpace($line)) { continue }
68+
69+
$basePath = Join-Path -Path "$($publishDir.FullName)\dbarefresh" -ChildPath $line
70+
foreach ($entry in (Resolve-PSFPath -Path $basePath)) {
71+
$item = Get-Item $entry
72+
if ($item.PSIsContainer) { continue }
73+
if ($item.FullName -in $processed) { continue }
74+
$text += [System.IO.File]::ReadAllText($item.FullName)
75+
$processed += $item.FullName
76+
}
77+
}
78+
79+
# Gather commands
80+
Get-ChildItem -Path "$($publishDir.FullName)\dbarefresh\internal\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object {
81+
$text += [System.IO.File]::ReadAllText($_.FullName)
82+
}
83+
Get-ChildItem -Path "$($publishDir.FullName)\dbarefresh\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object {
84+
$text += [System.IO.File]::ReadAllText($_.FullName)
85+
}
86+
87+
# Gather stuff to run afterwards
88+
foreach ($line in (Get-Content "$($PSScriptRoot)\filesAfter.txt" | Where-Object { $_ -notlike "#*" })) {
89+
if ([string]::IsNullOrWhiteSpace($line)) { continue }
90+
91+
$basePath = Join-Path "$($publishDir.FullName)\dbarefresh" $line
92+
foreach ($entry in (Resolve-PSFPath -Path $basePath)) {
93+
$item = Get-Item $entry
94+
if ($item.PSIsContainer) { continue }
95+
if ($item.FullName -in $processed) { continue }
96+
$text += [System.IO.File]::ReadAllText($item.FullName)
97+
$processed += $item.FullName
98+
}
99+
}
100+
#endregion Gather text data to compile
101+
102+
#region Update the psm1 file
103+
$fileData = Get-Content -Path "$($publishDir.FullName)\dbarefresh\dbarefresh.psm1" -Raw
104+
$fileData = $fileData.Replace('"<was not compiled>"', '"<was compiled>"')
105+
$fileData = $fileData.Replace('"<compile code into here>"', ($text -join "`n`n"))
106+
[System.IO.File]::WriteAllText("$($publishDir.FullName)\dbarefresh\dbarefresh.psm1", $fileData, [System.Text.Encoding]::UTF8)
107+
#endregion Update the psm1 file
108+
109+
#region Updating the Module Version
110+
Write-PSFMessage -Level Important -Message "Branch: $($env:APPVEYOR_REPO_BRANCH)"
111+
#if ($env:APPVEYOR_REPO_BRANCH -eq 'master') {
112+
if ($SkipPublish) { return }
113+
if ($AutoVersion) {
114+
Write-PSFMessage -Level Important -Message "Updating module version numbers."
115+
try { [version]$remoteVersion = (Find-Module 'dbarefresh' -Repository $Repository -ErrorAction Stop).Version }
116+
catch {
117+
Stop-PSFFunction -Message "Failed to access $($Repository)" -EnableException $true -ErrorRecord $_
118+
}
119+
if (-not $remoteVersion) {
120+
Stop-PSFFunction -Message "Couldn't find dbarefresh on repository $($Repository)" -EnableException $true
121+
}
122+
$newBuildNumber = $remoteVersion.Build + 1
123+
[version]$localVersion = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\dbarefresh\dbarefresh.psd1").ModuleVersion
124+
Update-ModuleManifest -Path "$($publishDir.FullName)\dbarefresh\dbarefresh.psd1" -ModuleVersion "$($localVersion.Major).$($localVersion.Minor).$($newBuildNumber)"
125+
}
126+
else {
127+
[version]$localVersion = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\dbarefresh\dbarefresh.psd1").ModuleVersion
128+
Update-ModuleManifest -Path "$($publishDir.FullName)\dbarefresh\dbarefresh.psd1" -ModuleVersion "$($localVersion.Major).$($localVersion.Minor).$($env:APPVEYOR_BUILD_NUMBER)"
129+
}
130+
131+
#region Publish
132+
if ($LocalRepo) {
133+
# Dependencies must go first
134+
Write-PSFMessage -Level Important -Message "Creating Nuget Package for module: PSFramework"
135+
New-PSMDModuleNugetPackage -ModulePath (Get-Module -Name PSFramework).ModuleBase -PackagePath .
136+
Write-PSFMessage -Level Important -Message "Creating Nuget Package for module: dbarefresh"
137+
New-PSMDModuleNugetPackage -ModulePath "$($publishDir.FullName)\dbarefresh" -PackagePath .
138+
}
139+
else {
140+
# Publish to Gallery
141+
Write-PSFMessage -Level Important -Message "Publishing the dbarefresh module to $($Repository)"
142+
Publish-Module -Path "$($publishDir.FullName)\dbarefresh" -NuGetApiKey $ApiKey -Force -Repository $Repository
143+
}
144+
#endregion Updating the Module Version
145+
146+
147+
#endregion Publish

build/appveyor-constants.ps1

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$instance1 = "localhost\sql2017"
2+
$instance2 = "localhost\sql2017"
3+
$sourcedatabase = "DB1"
4+
$destinationdatabase = "DB2"
5+
$defaultexportfilename = "database.json"
6+
$defaultexportfile = (Join-Path -Path $env:USERPROFILE -ChildPath $defaultexportfilename)

build/appveyor-prerequisites.ps1

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Add-AppveyorTest -Name "appveyor.prerequisites" -Framework NUnit -FileName "appveyor-prerequisites.ps1" -Outcome Running
2+
$sw = [system.diagnostics.stopwatch]::startNew()
3+
4+
#Write-Host -Object "appveyor.prep: Install psframework" -Level Important
5+
if (-not(Test-Path 'C:\Program Files\WindowsPowerShell\Modules\psframework\1.1.59')) {
6+
Install-Module -Name psframework -Force -SkipPublisherCheck -MaximumVersion 1.1.59 | Out-Null
7+
}
8+
9+
Write-PSFMessage -Message "appveyor.prep: Install Pester" -Level Important
10+
if (-not(Test-Path 'C:\Program Files\WindowsPowerShell\Modules\Pester\4.9.0')) {
11+
Install-Module -Name Pester -Force -SkipPublisherCheck -MaximumVersion 4.9.0 | Out-Null
12+
}
13+
14+
Write-PSFMessage -Message "appveyor.prep: Install dbatools" -Level Important
15+
if (-not(Test-Path 'C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.77')) {
16+
Install-Module -Name dbatools -Force -SkipPublisherCheck -MaximumVersion 1.0.77 | Out-Null
17+
}
18+
19+
Write-PSFMessage -Message "appveyor.prep: Install psscriptanalyzer" -Level Important
20+
if (-not(Test-Path 'C:\Program Files\WindowsPowerShell\Modules\psscriptanalyzer\1.18.3')) {
21+
Install-Module -Name psscriptanalyzer -Force -SkipPublisherCheck -MaximumVersion 1.18.3 | Out-Null
22+
}
23+
24+
. "$PSScriptRoot\appveyor-constants.ps1"
25+
26+
$sw.Stop()
27+
Update-AppveyorTest -Name "appveyor-prerequisites" -Framework NUnit -FileName "appveyor-prerequisites.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds

build/appveyor-validate.ps1

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Guide for available variables and working with secrets:
2+
# https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=powershell
3+
4+
# Needs to ensure things are Done Right and only legal commits to master get built
5+
6+
& ".\tests\pester.ps1"

0 commit comments

Comments
 (0)