From 46b1b7c83f5050769524136d157ef09e5393cdc3 Mon Sep 17 00:00:00 2001 From: "Rodweil, Theodor" Date: Mon, 7 Aug 2023 20:56:50 +0200 Subject: [PATCH] refactor: make this a valid nuget package for Powershell gallery feat: add build environment scripts --- .gitignore | 7 ++- LICENSE | 41 ++++++++++++++++++ PSConfluencePublisher.nuspec | 13 ++++-- samples/default/README.md | 31 +++++++++++++ .../{confluence.out => data}/._.DS_Store | Bin .../{confluence.out => data}/._manifest.json | Bin .../._pexels-just-a-couple-photos-3777622.jpg | Bin .../._pexels-sami-aksu-14356302.jpg | Bin .../attachments/objects.inv | Bin .../pexels-just-a-couple-photos-3777622.jpg | Bin .../attachments/pexels-sami-aksu-14356302.jpg | Bin .../{confluence.out => data}/manifest.json | 0 .../{confluence.out => data}/pages/Cats.xml | 0 .../pages/Default+Sample~.xml | 0 scripts/._analyze.ps1 | Bin 0 -> 4096 bytes scripts/._clean.ps1 | Bin 0 -> 4096 bytes scripts/._test.ps1 | Bin 0 -> 4096 bytes scripts/analyze.ps1 | 16 +++++++ scripts/clean.ps1 | 22 ++++++++++ scripts/pack.ps1 | 12 +++++ scripts/test.ps1 | 36 +++++++++++++++ src/._PSConfluencePublisher.psd1 | Bin 0 -> 4096 bytes {tools => src}/Connection.psm1 | 0 {tools => src}/Manifest.psm1 | 6 +-- {tools => src}/PSConfluencePublisher.psd1 | 2 +- {tools => src}/PSConfluencePublisher.psm1 | 0 {tools => src}/Page.psm1 | 0 {tools => src}/PageMeta.psm1 | 2 +- {tools => src}/PersonalAccessToken.psm1 | 0 tools/String.psm1 => src/StringHelper.psm1 | 0 {tools => src/schemas}/manifest.schema.json | 0 {tools => tests}/Connection.Tests.ps1 | 3 +- {tools => tests}/Manifest.Tests.ps1 | 18 ++++---- {tools => tests}/Page.Tests.ps1 | 3 +- {tools => tests}/PageMeta.Tests.ps1 | 4 +- .../PersonalAccessToken.Tests.ps1 | 3 +- .../StringHelper.Tests.ps1 | 4 +- tools/scripts.deps.json | 19 -------- 38 files changed, 200 insertions(+), 42 deletions(-) create mode 100755 LICENSE create mode 100755 samples/default/README.md rename samples/default/{confluence.out => data}/._.DS_Store (100%) rename samples/default/{confluence.out => data}/._manifest.json (100%) rename samples/default/{confluence.out => data}/attachments/._pexels-just-a-couple-photos-3777622.jpg (100%) rename samples/default/{confluence.out => data}/attachments/._pexels-sami-aksu-14356302.jpg (100%) rename samples/default/{confluence.out => data}/attachments/objects.inv (100%) rename samples/default/{confluence.out => data}/attachments/pexels-just-a-couple-photos-3777622.jpg (100%) rename samples/default/{confluence.out => data}/attachments/pexels-sami-aksu-14356302.jpg (100%) rename samples/default/{confluence.out => data}/manifest.json (100%) rename samples/default/{confluence.out => data}/pages/Cats.xml (100%) rename samples/default/{confluence.out => data}/pages/Default+Sample~.xml (100%) create mode 100755 scripts/._analyze.ps1 create mode 100755 scripts/._clean.ps1 create mode 100755 scripts/._test.ps1 create mode 100755 scripts/analyze.ps1 create mode 100755 scripts/clean.ps1 create mode 100755 scripts/pack.ps1 create mode 100755 scripts/test.ps1 create mode 100755 src/._PSConfluencePublisher.psd1 rename {tools => src}/Connection.psm1 (100%) rename {tools => src}/Manifest.psm1 (98%) rename {tools => src}/PSConfluencePublisher.psd1 (99%) rename {tools => src}/PSConfluencePublisher.psm1 (100%) rename {tools => src}/Page.psm1 (100%) rename {tools => src}/PageMeta.psm1 (98%) rename {tools => src}/PersonalAccessToken.psm1 (100%) rename tools/String.psm1 => src/StringHelper.psm1 (100%) rename {tools => src/schemas}/manifest.schema.json (100%) rename {tools => tests}/Connection.Tests.ps1 (95%) rename {tools => tests}/Manifest.Tests.ps1 (96%) rename {tools => tests}/Page.Tests.ps1 (98%) rename {tools => tests}/PageMeta.Tests.ps1 (98%) rename {tools => tests}/PersonalAccessToken.Tests.ps1 (91%) rename tools/String.Tests.ps1 => tests/StringHelper.Tests.ps1 (76%) delete mode 100755 tools/scripts.deps.json diff --git a/.gitignore b/.gitignore index ac25485..e992d25 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,11 @@ + +.DS_Store +/test-reports/ +/dist/ + +# FAT stuff (in a filesystem sense) /_* /._* -.DS_Store #vim cache *.swp diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..f092929 --- /dev/null +++ b/LICENSE @@ -0,0 +1,41 @@ +DL-DE->BY-2.0 +Datenlizenz Deutschland – Namensnennung – Version 2.0 + +(1) Jede Nutzung ist unter den Bedingungen dieser „Datenlizenz Deutschland – Namensnennung – Version 2.0" zulässig. + +Die bereitgestellten Daten und Metadaten dürfen für die kommerzielle und nicht kommerzielle Nutzung insbesondere + + vervielfältigt, ausgedruckt, präsentiert, verändert, bearbeitet sowie an Dritte übermittelt werden; + mit eigenen Daten und Daten Anderer zusammengeführt und zu selbständigen neuen Datensätzen verbunden werden; + in interne und externe Geschäftsprozesse, Produkte und Anwendungen in öffentlichen und nicht öffentlichen elektronischen Netzwerken eingebunden werden. + +(2) Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind: + + Bezeichnung des Bereitstellers nach dessen Maßgabe, + der Vermerk „Datenlizenz Deutschland – Namensnennung – Version 2.0" oder „dl-de/by-2-0" mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie + einen Verweis auf den Datensatz (URI). + +Dies gilt nur soweit die datenhaltende Stelle die Angaben 1. bis 3. zum Quellenvermerk bereitstellt. + +(3) Veränderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten geändert wurden. + + +Data licence Germany – attribution – version 2.0 + +(1) Any use will be permitted provided it fulfils the requirements of this "Data licence Germany – attribution – Version 2.0". + +The data and meta-data provided may, for commercial and non-commercial use, in particular + + be copied, printed, presented, altered, processed and transmitted to third parties; + be merged with own data and with the data of others and be combined to form new and independent datasets; + be integrated in internal and external business processes, products and applications in public and non-public electronic networks. + +(2) The user must ensure that the source note contains the following information: + + the name of the provider, + the annotation "Data licence Germany – attribution – Version 2.0" or "dl-de/by-2-0" referring to the licence text available at www.govdata.de/dl-de/by-2-0, and + a reference to the dataset (URI). + +This applies only if the entity keeping the data provides the pieces of information 1-3 for the source note. + +(3) Changes, editing, new designs or other amendments must be marked as such in the source note. diff --git a/PSConfluencePublisher.nuspec b/PSConfluencePublisher.nuspec index e7d0244..d05d7ad 100755 --- a/PSConfluencePublisher.nuspec +++ b/PSConfluencePublisher.nuspec @@ -1,14 +1,19 @@ - PSConfluencePublisher + victorykit.PSConfluencePublisher + victorykit.PSConfluencePublisher 1.1.0 standalone publisher for xconfluencebuilder - theodor.rodweil@victory-k.it + Victory Karma IT Theodor Rodweil DL-DE-BY-2.0 - README.md + .\README.md Victory Karma IT - Powershell Confluence Publisher + PowerShell + + + + diff --git a/samples/default/README.md b/samples/default/README.md new file mode 100755 index 0000000..a3735e4 --- /dev/null +++ b/samples/default/README.md @@ -0,0 +1,31 @@ +# Default Sample + +This is a sample/reference implementation for showing the usage of +PSConfluencePublisher. + +The sample provides sample data, which was generated by a sample of the +[victorykit-xconfluencebuilder](https://bitbucket.org/victorykit/xconfluencebuilder). +The data can be found inside the `data/` directory. + +## Usage + +To get started, first identify your Confluence instance and make sure you have +the following data at hand: + +* Hostname of Confluence instance +* URL of parent/root page to publish to (you can copy it directly from your + browser) +* personal access token + +Next, make sure you changed your working directory to this directory +(`samples/default/`, navigating from the root of the repository). + +Now, import the module by executing the following: + +``` +Import-Module ../../tools/PSConfluencePublisher.psd1 +``` + +``` +$manifest = Get-Manifest -File data/manifest.json +``` diff --git a/samples/default/confluence.out/._.DS_Store b/samples/default/data/._.DS_Store similarity index 100% rename from samples/default/confluence.out/._.DS_Store rename to samples/default/data/._.DS_Store diff --git a/samples/default/confluence.out/._manifest.json b/samples/default/data/._manifest.json similarity index 100% rename from samples/default/confluence.out/._manifest.json rename to samples/default/data/._manifest.json diff --git a/samples/default/confluence.out/attachments/._pexels-just-a-couple-photos-3777622.jpg b/samples/default/data/attachments/._pexels-just-a-couple-photos-3777622.jpg similarity index 100% rename from samples/default/confluence.out/attachments/._pexels-just-a-couple-photos-3777622.jpg rename to samples/default/data/attachments/._pexels-just-a-couple-photos-3777622.jpg diff --git a/samples/default/confluence.out/attachments/._pexels-sami-aksu-14356302.jpg b/samples/default/data/attachments/._pexels-sami-aksu-14356302.jpg similarity index 100% rename from samples/default/confluence.out/attachments/._pexels-sami-aksu-14356302.jpg rename to samples/default/data/attachments/._pexels-sami-aksu-14356302.jpg diff --git a/samples/default/confluence.out/attachments/objects.inv b/samples/default/data/attachments/objects.inv similarity index 100% rename from samples/default/confluence.out/attachments/objects.inv rename to samples/default/data/attachments/objects.inv diff --git a/samples/default/confluence.out/attachments/pexels-just-a-couple-photos-3777622.jpg b/samples/default/data/attachments/pexels-just-a-couple-photos-3777622.jpg similarity index 100% rename from samples/default/confluence.out/attachments/pexels-just-a-couple-photos-3777622.jpg rename to samples/default/data/attachments/pexels-just-a-couple-photos-3777622.jpg diff --git a/samples/default/confluence.out/attachments/pexels-sami-aksu-14356302.jpg b/samples/default/data/attachments/pexels-sami-aksu-14356302.jpg similarity index 100% rename from samples/default/confluence.out/attachments/pexels-sami-aksu-14356302.jpg rename to samples/default/data/attachments/pexels-sami-aksu-14356302.jpg diff --git a/samples/default/confluence.out/manifest.json b/samples/default/data/manifest.json similarity index 100% rename from samples/default/confluence.out/manifest.json rename to samples/default/data/manifest.json diff --git a/samples/default/confluence.out/pages/Cats.xml b/samples/default/data/pages/Cats.xml similarity index 100% rename from samples/default/confluence.out/pages/Cats.xml rename to samples/default/data/pages/Cats.xml diff --git a/samples/default/confluence.out/pages/Default+Sample~.xml b/samples/default/data/pages/Default+Sample~.xml similarity index 100% rename from samples/default/confluence.out/pages/Default+Sample~.xml rename to samples/default/data/pages/Default+Sample~.xml diff --git a/scripts/._analyze.ps1 b/scripts/._analyze.ps1 new file mode 100755 index 0000000000000000000000000000000000000000..056a38b16d63e12d107332905fba25ea878e3c02 GIT binary patch literal 4096 zcmeH~u}T9$5QgWBL2QDJDI^>V>5mu`L@P@XQIaccH+vIZvbP&XV)SVz2reL6#c&O2r5J4=8hrTU+^ z%=6L3>qp%<;G5*#4NHsqcz*zJq+FTF`P^V;qz?;^MIi(B@5YTM*`?eDNTaTls&XYg z`^=+36|}P>X&-Q{jXzERdK=m&?e)aql`ZfY;OpeGi2B3px3idsgY)ClL995K025#W zOn?b60Vco%m;e)C0!(0=3D80qm%=8}{84*Rp?8Z)p_saACbSJ`<0>hQc@YMuK}?La UGunlJY}=gw&i^|}57N3`0nSfEXaE2J literal 0 HcmV?d00001 diff --git a/scripts/._clean.ps1 b/scripts/._clean.ps1 new file mode 100755 index 0000000000000000000000000000000000000000..056a38b16d63e12d107332905fba25ea878e3c02 GIT binary patch literal 4096 zcmeH~u}T9$5QgWBL2QDJDI^>V>5mu`L@P@XQIaccH+vIZvbP&XV)SVz2reL6#c&O2r5J4=8hrTU+^ z%=6L3>qp%<;G5*#4NHsqcz*zJq+FTF`P^V;qz?;^MIi(B@5YTM*`?eDNTaTls&XYg z`^=+36|}P>X&-Q{jXzERdK=m&?e)aql`ZfY;OpeGi2B3px3idsgY)ClL995K025#W zOn?b60Vco%m;e)C0!(0=3D80qm%=8}{84*Rp?8Z)p_saACbSJ`<0>hQc@YMuK}?La UGunlJY}=gw&i^|}57N3`0nSfEXaE2J literal 0 HcmV?d00001 diff --git a/scripts/._test.ps1 b/scripts/._test.ps1 new file mode 100755 index 0000000000000000000000000000000000000000..056a38b16d63e12d107332905fba25ea878e3c02 GIT binary patch literal 4096 zcmeH~u}T9$5QgWBL2QDJDI^>V>5mu`L@P@XQIaccH+vIZvbP&XV)SVz2reL6#c&O2r5J4=8hrTU+^ z%=6L3>qp%<;G5*#4NHsqcz*zJq+FTF`P^V;qz?;^MIi(B@5YTM*`?eDNTaTls&XYg z`^=+36|}P>X&-Q{jXzERdK=m&?e)aql`ZfY;OpeGi2B3px3idsgY)ClL995K025#W zOn?b60Vco%m;e)C0!(0=3D80qm%=8}{84*Rp?8Z)p_saACbSJ`<0>hQc@YMuK}?La UGunlJY}=gw&i^|}57N3`0nSfEXaE2J literal 0 HcmV?d00001 diff --git a/scripts/analyze.ps1 b/scripts/analyze.ps1 new file mode 100755 index 0000000..471faac --- /dev/null +++ b/scripts/analyze.ps1 @@ -0,0 +1,16 @@ +#! /usr/bin/pwsh + +Set-StrictMode -Version Latest + +$ErrorActionPreference = 'Stop' + +$ErrorView = "NormalView" + +$basePath = Join-Path $PSScriptRoot '..' + +Import-Module PSScriptAnalyzer -ErrorAction Stop -Force + +Invoke-ScriptAnalyzer ` + -Path (Join-Path -Path $basePath 'src') ` + -Settings PSGallery ` + -Recurse diff --git a/scripts/clean.ps1 b/scripts/clean.ps1 new file mode 100755 index 0000000..6cb668a --- /dev/null +++ b/scripts/clean.ps1 @@ -0,0 +1,22 @@ +#! /usr/bin/pwsh + +Set-StrictMode -Version Latest + +$ErrorActionPreference = 'Stop' + +$ErrorView = "NormalView" + +$basePath = Join-Path $PSScriptRoot '..' + +@( + 'dist', + 'test-reports' +) | ForEach { + $path = Join-Path $basePath $_ + + If (-Not (Test-Path $path)) {return} + + Write-Host "rm: $(Resolve-Path $path)" + + Remove-Item -Recurse -Force ($path) +} diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 new file mode 100755 index 0000000..ddd90e9 --- /dev/null +++ b/scripts/pack.ps1 @@ -0,0 +1,12 @@ +#! /usr/bin/pwsh + +Set-StrictMode -Version Latest + +$ErrorActionPreference = 'Stop' + +$ErrorView = "NormalView" + +$basePath = Join-Path $PSScriptRoot '..' + +nuget pack (Join-Path $basePath 'PSConfluencePublisher.nuspec') ` + -OutputDirectory (Join-Path $basePath 'dist') diff --git a/scripts/test.ps1 b/scripts/test.ps1 new file mode 100755 index 0000000..9ce45d9 --- /dev/null +++ b/scripts/test.ps1 @@ -0,0 +1,36 @@ +#! /usr/bin/pwsh + +Set-StrictMode -Version Latest + +$ErrorActionPreference = 'Stop' + +$ErrorView = "NormalView" + +Import-Module Pester -ErrorAction Stop -Force + +Invoke-Pester -Configuration @{ + 'Debug' = @{ + 'ShowFullErrors' = $false + 'ShowNavigationMarkers' = $false + 'WriteDebugMessagesFrom' = 'CodeCoverage' + } + 'Output' = @{ + 'Verbosity' = 'Normal' + } + 'Run' = @{ + 'Path' = Join-Path $PSScriptRoot '..' 'tests' '*' + 'Exit' = $true + 'PassThru' = $true + } + 'CodeCoverage' = @{ + 'Enabled' = $true + 'Path' = Join-Path $PSScriptRoot '..' 'src' '*' + 'OutputPath' = Join-Path $PSScriptRoot '..' 'test-reports' ` + 'coverage.xml' + } + 'TestResult' = @{ + 'Enabled' = $true + 'OutputPath' = Join-Path $PSScriptRoot '..' 'test-reports' 'testResults.xml' + } +} + diff --git a/src/._PSConfluencePublisher.psd1 b/src/._PSConfluencePublisher.psd1 new file mode 100755 index 0000000000000000000000000000000000000000..e72da3acf66cc35adecda80bd949a988abcfac79 GIT binary patch literal 4096 zcmeH~%}N7749Bx-kzR@?K`G0C_l4FE)Sf(g5T)IN*XeAkLuY5o&Q$aze1JZMui>$; z&}Z?nmNLG!|>nChr4uJ}6S&Spg&|z5lVB zJRc4gpY^%}zDRzw(XvZBHP(QOJNN52JNYvPZE6kVai8Rpm)uuGw0|BGHYUIX zm;e)C0!)AjFaajO1egF5*jfS!O&FWCqayj Vv{Sl;o35=6fA{}gr3-0Ye*