diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0d08e26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/PSScriptAnalyzer.yml b/.github/workflows/PSScriptAnalyzer.yml new file mode 100644 index 0000000..e46d73f --- /dev/null +++ b/.github/workflows/PSScriptAnalyzer.yml @@ -0,0 +1,46 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# https://github.com/microsoft/action-psscriptanalyzer +# For more information on PSScriptAnalyzer in general, see +# https://github.com/PowerShell/PSScriptAnalyzer + +name: PSScriptAnalyzer + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + name: PSScriptAnalyzer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run PSScriptAnalyzer + uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f + with: + # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options. + # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. + path: .\ + recurse: true + # Include your own basic security rules. Removing this option will run all the rules + #includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' + output: results.sarif + + # Upload the SARIF file generated in the previous step + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml new file mode 100644 index 0000000..d6e3434 --- /dev/null +++ b/.github/workflows/pester.yml @@ -0,0 +1,33 @@ +name: Run Pester Tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + pester: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Pester + shell: pwsh + run: Install-Module -Name Pester -Force -Scope CurrentUser + + - name: Run Pester Tests + run: | + # Run Pester tests with Code Coverage + Import-Module -Name Pester -Force + [PesterConfiguration] $config = Import-PowerShellDataFile -Path ".\config.pester.psd1" -ErrorAction Stop + Invoke-Pester -Configuration $config + + - name: Upload code coverage report + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report + path: coverage.xml diff --git a/Functions/New-PSOneQRCode.Tests.ps1 b/Functions/New-PSOneQRCode.Tests.ps1 index 6e75406..07c7fd9 100644 --- a/Functions/New-PSOneQRCode.Tests.ps1 +++ b/Functions/New-PSOneQRCode.Tests.ps1 @@ -1,24 +1,24 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + Get-DefaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PsOneQRCode' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + Get-DefaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCode -payload 'Test' -Show $False - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $byteArray = New-PSOneQRCode -payload 'Test' -Show $False -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCode.ps1 b/Functions/New-PSOneQRCode.ps1 index e26a149..59869c8 100644 --- a/Functions/New-PSOneQRCode.ps1 +++ b/Functions/New-PSOneQRCode.ps1 @@ -20,7 +20,7 @@ function New-PSOneQRCode { .PARAMETER AsByteArray Returns the byte array data for in memory processing. - + .EXAMPLE New-PSOneQRCode -payload $payload -Width $width -Show -OutPath $OutPath Creates a QR code png graphics on your desktop, and opens it with the associated program @@ -50,29 +50,27 @@ function New-PSOneQRCode { [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, - + $OutPath = (Get-DefaultQrCodePath), + [Parameter(ParameterSetName = 'ByteArray')] [switch] $AsByteArray, - [byte[]] + [byte[]] $DarkColorRgba = @(0, 0, 0), [byte[]] $LightColorRgba = @(255, 255, 255) - ) - $generator = New-Object -TypeName QRCoder.QRCodeGenerator $data = $generator.CreateQrCode($payload, 'Q') - $code = new-object -TypeName QRCoder.PngByteQRCode -ArgumentList ($data) + $code = New-Object -TypeName QRCoder.PngByteQRCode -ArgumentList ($data) $byteArray = $code.GetGraphic($Width, $darkColorRgba, $lightColorRgba) - + if ($AsByteArray) { return $byteArray } - + [System.IO.File]::WriteAllBytes($outPath, $byteArray) - + if ($Show) { Invoke-Item -Path $outPath } } \ No newline at end of file diff --git a/Functions/New-PSOneQRCodeGeolocation.Tests.ps1 b/Functions/New-PSOneQRCodeGeolocation.Tests.ps1 index b93158e..718a50c 100644 --- a/Functions/New-PSOneQRCodeGeolocation.Tests.ps1 +++ b/Functions/New-PSOneQRCodeGeolocation.Tests.ps1 @@ -1,17 +1,17 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeGeolocation' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCodeGeolocation -Address 'Test' - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'throws when address is not found' { @@ -22,7 +22,7 @@ Describe 'New-PSOneQRCodeGeolocation' { $byteArray = New-PSOneQRCodeGeolocation -Address 'Test' -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeGeolocation.ps1 b/Functions/New-PSOneQRCodeGeolocation.ps1 index f598386..af8ac7c 100644 --- a/Functions/New-PSOneQRCodeGeolocation.ps1 +++ b/Functions/New-PSOneQRCodeGeolocation.ps1 @@ -36,7 +36,7 @@ https://github.com/TobiasPSP/Modules.QRCodeGenerator #> - [CmdletBinding(DefaultParameterSetName = "Address")] + [CmdletBinding(DefaultParameterSetName = 'Address')] param ( [Parameter(Mandatory, ParameterSetName = 'Location')] @@ -64,7 +64,7 @@ [Parameter(ParameterSetName = 'Location')] [Parameter(ParameterSetName = 'Address')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArrayLocation')] [Parameter(ParameterSetName = 'ByteArrayAddress')] @@ -79,7 +79,7 @@ ) - if ($PSCmdlet.ParameterSetName -eq "Address") { + if ($PSCmdlet.ParameterSetName -eq 'Address') { $AddressEncoded = [System.Net.WebUtility]::UrlEncode($Address) $ApiUri = "http://nominatim.openstreetmap.org/search?q=$AddressEncoded&format=xml&addressdetails=1&limit=1" $Response = Invoke-RestMethod -Uri $ApiUri -UseBasicParsing @@ -87,7 +87,7 @@ $place = $Response.searchresults.place if ($null -eq $place) { - throw "Address not found." + throw 'Address not found.' } $Latitude = $place.lat $Longitude = $place.lon @@ -98,11 +98,11 @@ geo:$Latitude,$Longitude "@ $splat = @{ - payload = $payload - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = $payload + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } diff --git a/Functions/New-PSOneQRCodeText.Tests.ps1 b/Functions/New-PSOneQRCodeText.Tests.ps1 index f55d0a7..509984b 100644 --- a/Functions/New-PSOneQRCodeText.Tests.ps1 +++ b/Functions/New-PSOneQRCodeText.Tests.ps1 @@ -1,24 +1,24 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeText' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCodeText -Text 'Test' - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $byteArray = New-PSOneQRCodeText -Text 'Test' -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeText.ps1 b/Functions/New-PSOneQRCodeText.ps1 index d231e7b..cc8126f 100644 --- a/Functions/New-PSOneQRCodeText.ps1 +++ b/Functions/New-PSOneQRCodeText.ps1 @@ -45,7 +45,7 @@ [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArray')] [switch] @@ -59,11 +59,11 @@ ) $splat = @{ - payload = $Text - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = $Text + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } diff --git a/Functions/New-PSOneQRCodeTwitter.Tests.ps1 b/Functions/New-PSOneQRCodeTwitter.Tests.ps1 index a77f4d3..e62b4a8 100644 --- a/Functions/New-PSOneQRCodeTwitter.Tests.ps1 +++ b/Functions/New-PSOneQRCodeTwitter.Tests.ps1 @@ -1,24 +1,24 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeTwitter' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCodeTwitter -ProfileName 'Test' - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $byteArray = New-PSOneQRCodeTwitter -ProfileName 'Test' -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeTwitter.ps1 b/Functions/New-PSOneQRCodeTwitter.ps1 index 620a2e6..a838ea7 100644 --- a/Functions/New-PSOneQRCodeTwitter.ps1 +++ b/Functions/New-PSOneQRCodeTwitter.ps1 @@ -45,7 +45,7 @@ [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArray')] [switch] @@ -59,11 +59,11 @@ ) $splat = @{ - payload = "http://www.twitter.com/$ProfileName" - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = "http://www.twitter.com/$ProfileName" + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } @@ -74,5 +74,4 @@ } New-PSOneQRCode @splat - } \ No newline at end of file diff --git a/Functions/New-PSOneQRCodeURI.Tests.ps1 b/Functions/New-PSOneQRCodeURI.Tests.ps1 index b18412c..e09bca5 100644 --- a/Functions/New-PSOneQRCodeURI.Tests.ps1 +++ b/Functions/New-PSOneQRCodeURI.Tests.ps1 @@ -1,24 +1,24 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeURI' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCodeURI -URI 'http://127.0.0.1' - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $byteArray = New-PSOneQRCodeURI -URI 'http://127.0.0.1' -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeURI.ps1 b/Functions/New-PSOneQRCodeURI.ps1 index f169cce..26f0b13 100644 --- a/Functions/New-PSOneQRCodeURI.ps1 +++ b/Functions/New-PSOneQRCodeURI.ps1 @@ -37,7 +37,7 @@ function New-PSOneQRCodeURI { param ( [Parameter(Mandatory)] - [alias("URL")] + [alias('URL')] [System.Uri] $URI, @@ -50,7 +50,7 @@ function New-PSOneQRCodeURI { [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArray')] [switch] @@ -64,11 +64,11 @@ function New-PSOneQRCodeURI { ) $splat = @{ - payload = $URI.AbsoluteUri - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = $URI.AbsoluteUri + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } diff --git a/Functions/New-PSOneQRCodeVCard.Tests.ps1 b/Functions/New-PSOneQRCodeVCard.Tests.ps1 index 16a8c63..4c42c1d 100644 --- a/Functions/New-PSOneQRCodeVCard.Tests.ps1 +++ b/Functions/New-PSOneQRCodeVCard.Tests.ps1 @@ -1,37 +1,37 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeVCard' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { $splat = @{ FirstName = 'Test' - LastName = 'Test' - Company = 'Test' - Email = 'tst@test.test' + LastName = 'Test' + Company = 'Test' + Email = 'tst@test.test' } New-PSOneQRCodeVCard @splat - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $splat = @{ - FirstName = 'Test' - LastName = 'Test' - Company = 'Test' - Email = 'tst@test.test' + FirstName = 'Test' + LastName = 'Test' + Company = 'Test' + Email = 'tst@test.test' AsByteArray = $True } $byteArray = New-PSOneQRCodeVCard @splat $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeVCard.ps1 b/Functions/New-PSOneQRCodeVCard.ps1 index 4a696f5..1430f0f 100644 --- a/Functions/New-PSOneQRCodeVCard.ps1 +++ b/Functions/New-PSOneQRCodeVCard.ps1 @@ -71,7 +71,7 @@ [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArray')] [switch] @@ -96,11 +96,11 @@ END:VCARD "@ $splat = @{ - payload = $payload - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = $payload + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } diff --git a/Functions/New-PSOneQRCodeWifiAccess.Tests.ps1 b/Functions/New-PSOneQRCodeWifiAccess.Tests.ps1 index 43ea2d0..b27a2e5 100644 --- a/Functions/New-PSOneQRCodeWifiAccess.Tests.ps1 +++ b/Functions/New-PSOneQRCodeWifiAccess.Tests.ps1 @@ -1,24 +1,24 @@ BeforeAll { Import-Module "$PSScriptRoot\..\loader.psm1" -Force - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } Describe 'New-PSOneQRCodeWifiAccess' { AfterEach { - $Global:defaultQrCodePath | Remove-Item -Force -ErrorAction SilentlyContinue + (Get-DefaultQrCodePath) | Remove-Item -Force -ErrorAction SilentlyContinue } It 'defaults to file based output' { New-PSOneQRCodeWifiAccess -SSID 'Test' -Password 'Test' - Get-Item $Global:defaultQrCodePath | Should -Exist + Get-Item (Get-DefaultQrCodePath) | Should -Exist } It 'returns the byte array when `-AsByteArray` switch is on' { $byteArray = New-PSOneQRCodeWifiAccess -SSID 'Test' -Password 'Test' -AsByteArray $byteArray.Count | Should -Not -BeNullOrEmpty - Test-Path $Global:defaultQrCodePath | Should -BeFalse + Test-Path (Get-DefaultQrCodePath) | Should -BeFalse } } diff --git a/Functions/New-PSOneQRCodeWifiAccess.ps1 b/Functions/New-PSOneQRCodeWifiAccess.ps1 index 0a5be89..d889d0c 100644 --- a/Functions/New-PSOneQRCodeWifiAccess.ps1 +++ b/Functions/New-PSOneQRCodeWifiAccess.ps1 @@ -56,7 +56,7 @@ [Parameter(ParameterSetName = 'File')] [string] - $OutPath = $Global:defaultQrCodePath, + $OutPath = (Get-DefaultQrCodePath), [Parameter(ParameterSetName = 'ByteArray')] [switch] @@ -74,11 +74,11 @@ WIFI:S:$SSID;T:WPA2;P:$Password;; "@ $splat = @{ - payload = $payload - Show = $Show - Width = $Width - OutPath = $OutPath - darkColorRgba = $darkColorRgba + payload = $payload + Show = $Show + Width = $Width + OutPath = $OutPath + darkColorRgba = $darkColorRgba lightColorRgba = $lightColorRgba } diff --git a/PSScriptAnalyzerSettings.psd1 b/PSScriptAnalyzerSettings.psd1 new file mode 100644 index 0000000..843f3df --- /dev/null +++ b/PSScriptAnalyzerSettings.psd1 @@ -0,0 +1,41 @@ +@{ + Severity = @( + 'Error', + 'Warning' + ) + IncludeRules = @( + 'PSAvoidUsingWriteHost', + 'PSAvoidUsingCmdletAliases', + 'PSAvoidUsingEmptyCatchBlock', + 'PSAvoidGlobalVars', + 'PSAvoidUsingInvokeExpression', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSUseCompatibleCommands', + 'PSUseConsistentIndentation', + 'PSUseConsistentWhitespace', + 'PSUseCorrectCasing', + 'PSUseLiteralInitializerForHashtable' + ) + ExcludeRules = @( + 'PSAvoidTrailingWhitespace', + 'PSUseShouldProcessForStateChangingFunctions' + ) + Rules = @{ + PSUseConsistentIndentation = @{ + Enable = $true + IndentationSize = 4 + PipelineIndentation = 'IncreaseIndentationAfterEveryPipeline' + } + PSUseConsistentWhitespace = @{ + Enable = $true + CheckInnerBrace = $true + CheckOpenBrace = $true + CheckOperator = $true + CheckSeparator = $true + CheckParameter = $true + } + PSUseCorrectCasing = @{ + Enable = $true + } + } +} \ No newline at end of file diff --git a/QRCodeGenerator.psd1 b/QRCodeGenerator.psd1 index 19a03da..9ff2681 100644 --- a/QRCodeGenerator.psd1 +++ b/QRCodeGenerator.psd1 @@ -1,25 +1,35 @@ @{ -RootModule = 'loader.psm1' -ModuleVersion = '2.6.0' -CompatiblePSEditions = 'Core', 'Desktop' -GUID = '24384c68-14b0-46d1-ada8-7e0595d477a6' -Author = 'Dr. Tobias Weltner' -CompanyName = 'powershell.one' -Copyright = '2021 Dr. Tobias Weltner (MIT-License)' -Description = 'creates QR codes offline' -PowerShellVersion = '5.1' -FunctionsToExport = 'New-PSOneQRCodeGeolocation', 'New-PSOneQRCodeTwitter', - 'New-PSOneQRCodeWifiAccess', 'New-PSOneQRCodeVCard', 'New-PSOneQRCodeText' , 'New-PSOneQRCodeURI' -CmdletsToExport = '*' -VariablesToExport = '*' -AliasesToExport = 'New-QRCodeGeolocation', 'New-QRCodeTwitter', 'New-QRCodeVCard', - 'New-QRCodeWifiAccess', 'New-QRCodeText', 'New-QRCodeURI' -PrivateData = @{ - PSData = @{ - Tags = 'QRCode', 'powershell.one' - LicenseUri = 'https://en.wikipedia.org/wiki/MIT_License' - ProjectUri = 'https://github.com/TobiasPSP/Modules.QRCodeGenerator' - ReleaseNotes = 'added new Methods New-QRCodeText and New-QRCodeURI' + RootModule = 'loader.psm1' + ModuleVersion = '2.6.0' + CompatiblePSEditions = 'Core', 'Desktop' + GUID = '24384c68-14b0-46d1-ada8-7e0595d477a6' + Author = 'Dr. Tobias Weltner' + CompanyName = 'powershell.one' + Copyright = '2021 Dr. Tobias Weltner (MIT-License)' + Description = 'creates QR codes offline' + PowerShellVersion = '5.1' + FunctionsToExport = @( + 'New-PSOneQRCodeGeolocation', + 'New-PSOneQRCodeTwitter', + 'New-PSOneQRCodeWifiAccess', + 'New-PSOneQRCodeVCard', + 'New-PSOneQRCodeText' , + 'New-PSOneQRCodeURI' + ) + AliasesToExport = @( + 'New-QRCodeGeolocation', + 'New-QRCodeTwitter', + 'New-QRCodeVCard', + 'New-QRCodeWifiAccess', + 'New-QRCodeText', + 'New-QRCodeURI' + ) + PrivateData = @{ + PSData = @{ + Tags = 'QRCode', 'powershell.one' + LicenseUri = 'https://en.wikipedia.org/wiki/MIT_License' + ProjectUri = 'https://github.com/TobiasPSP/Modules.QRCodeGenerator' + ReleaseNotes = 'added new Methods New-QRCodeText and New-QRCodeURI' + } } -} } diff --git a/config.pester.psd1 b/config.pester.psd1 new file mode 100644 index 0000000..86bca7a --- /dev/null +++ b/config.pester.psd1 @@ -0,0 +1,11 @@ +@{ + Run = @{ + Path = '.' + } + CodeCoverage = @{ + Enabled = $true + } + TestResult = @{ + Enabled = $true + } +} \ No newline at end of file diff --git a/loader.psm1 b/loader.psm1 index 0d494ba..c0289de 100644 --- a/loader.psm1 +++ b/loader.psm1 @@ -4,8 +4,8 @@ $content = 'TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA $null = [System.Reflection.Assembly]::Load([System.Convert]::FromBase64String($content)) -$Global:tempFolder = [System.IO.Path]::GetTempPath() -$Global:defaultQrCodePath = Join-Path -Path $Global:tempFolder -ChildPath 'qrcode.png' +$script:defaultQrCodePath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath 'qrcode.png' +Function Get-DefaultQrCodePath { return $script:defaultQrCodePath } # LOADING ALL FUNCTION DEFINITIONS: . $PSScriptRoot\Functions\New-PSOneQRCodeVCard.ps1