feat(samples): expand sample to include full publishing
This commit is contained in:
parent
496d70360b
commit
4b458df7c1
4 changed files with 152 additions and 39 deletions
|
|
@ -1,33 +1,53 @@
|
|||
{
|
||||
"Pages": [
|
||||
{
|
||||
"Title": "Default Sample~",
|
||||
"Ref": "pages/Default+Sample~.xml"
|
||||
},
|
||||
{
|
||||
"Title": "Cats",
|
||||
"Ref": "pages/Cats.xml",
|
||||
"AncestorTitle": "Default Sample~"
|
||||
}
|
||||
],
|
||||
"Attachments": [
|
||||
{
|
||||
"Name": "pexels-just-a-couple-photos-3777622.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"Ref": "attachments/Cats/pexels-just-a-couple-photos-3777622.jpg"
|
||||
},
|
||||
{
|
||||
"Name": "pexels-sami-aksu-14356302.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"Ref": "attachments/Cats/pexels-sami-aksu-14356302.jpg"
|
||||
},
|
||||
{
|
||||
"Name": "objects.inv",
|
||||
"ContainerPageTitle": "Default Sample~",
|
||||
"MimeType": "application/octet-stream",
|
||||
"Ref": "attachments/Default+Sample~/objects.inv"
|
||||
}
|
||||
]
|
||||
}
|
||||
"Pages": [
|
||||
{
|
||||
"Title": "Default Sample~",
|
||||
"Hash": "4E4884BA3DEB5FE39C86E41507F3335C37A6D12895236D673BFA1C101ADAF6FF",
|
||||
"Id": "789703362",
|
||||
"Version": 1,
|
||||
"_Ref": "pages/Default+Sample~.xml",
|
||||
"Ref": "pages/Default+Sample~.xml"
|
||||
},
|
||||
{
|
||||
"Title": "Cats",
|
||||
"AncestorTitle": "Default Sample~",
|
||||
"Hash": "7AC678181A472E7F1B962566E9F9CACA1B5C35C055775692970A101B3C70985A",
|
||||
"Id": "789703374",
|
||||
"Version": 2,
|
||||
"_Ref": "pages/Cats.xml",
|
||||
"Ref": "pages/Cats.xml"
|
||||
}
|
||||
],
|
||||
"Attachments": [
|
||||
{
|
||||
"Name": "pexels-just-a-couple-photos-3777622.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"_Ref": "attachments/Cats/pexels-just-a-couple-photos-3777622.jpg",
|
||||
"Ref": "attachments/Cats/pexels-just-a-couple-photos-3777622.jpg",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "FF90EF756F8C28433CF74AA039ABC0681FAE17D7A925498F00ACB9774AC8FF31"
|
||||
},
|
||||
{
|
||||
"Name": "pexels-sami-aksu-14356302.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"_Ref": "attachments/Cats/pexels-sami-aksu-14356302.jpg",
|
||||
"Ref": "attachments/Cats/pexels-sami-aksu-14356302.jpg",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "4A0DF56CAC53F413371CDB7FA1A8F66455B0060D0B5F9D41B2468DE08D11C7EF"
|
||||
},
|
||||
{
|
||||
"Name": "objects.inv",
|
||||
"ContainerPageTitle": "Default Sample~",
|
||||
"MimeType": "application/octet-stream",
|
||||
"_Ref": "attachments/Default+Sample~/objects.inv",
|
||||
"Ref": "attachments/Default+Sample~/objects.inv",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "24FD5FA3627643C373552861775BF930B7AF5195376E481F9919FB08E06C0CA6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
53
samples/default/data/manifest.json.bck
Executable file
53
samples/default/data/manifest.json.bck
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"Pages": [
|
||||
{
|
||||
"Title": "Default Sample~",
|
||||
"Hash": "4E4884BA3DEB5FE39C86E41507F3335C37A6D12895236D673BFA1C101ADAF6FF",
|
||||
"Id": "789703362",
|
||||
"Version": 1,
|
||||
"_Ref": "pages/Default+Sample~.xml",
|
||||
"Ref": "pages/Default+Sample~.xml"
|
||||
},
|
||||
{
|
||||
"Title": "Cats",
|
||||
"AncestorTitle": "Default Sample~",
|
||||
"Hash": "7AC678181A472E7F1B962566E9F9CACA1B5C35C055775692970A101B3C70985A",
|
||||
"Id": "789703374",
|
||||
"Version": 2,
|
||||
"_Ref": "pages/Cats.xml",
|
||||
"Ref": "pages/Cats.xml"
|
||||
}
|
||||
],
|
||||
"Attachments": [
|
||||
{
|
||||
"Name": "pexels-just-a-couple-photos-3777622.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"_Ref": "attachments/Cats/pexels-just-a-couple-photos-3777622.jpg",
|
||||
"Ref": "attachments/Cats/pexels-just-a-couple-photos-3777622.jpg",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "FF90EF756F8C28433CF74AA039ABC0681FAE17D7A925498F00ACB9774AC8FF31"
|
||||
},
|
||||
{
|
||||
"Name": "pexels-sami-aksu-14356302.jpg",
|
||||
"ContainerPageTitle": "Cats",
|
||||
"MimeType": "image/jpeg",
|
||||
"_Ref": "attachments/Cats/pexels-sami-aksu-14356302.jpg",
|
||||
"Ref": "attachments/Cats/pexels-sami-aksu-14356302.jpg",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "4A0DF56CAC53F413371CDB7FA1A8F66455B0060D0B5F9D41B2468DE08D11C7EF"
|
||||
},
|
||||
{
|
||||
"Name": "objects.inv",
|
||||
"ContainerPageTitle": "Default Sample~",
|
||||
"MimeType": "application/octet-stream",
|
||||
"_Ref": "attachments/Default+Sample~/objects.inv",
|
||||
"Ref": "attachments/Default+Sample~/objects.inv",
|
||||
"Id": null,
|
||||
"Version": null,
|
||||
"Hash": "24FD5FA3627643C373552861775BF930B7AF5195376E481F9919FB08E06C0CA6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<p>What can we say… They secretly rule the world.</p><ac:image>
|
||||
<ri:attachment ri:filename="pexels-just-a-couple-photos-3777622.jpg"></ri:attachment>
|
||||
</ac:image><p>photo by: <a href="https://www.pexels.com/@jacp/">https://www.pexels.com/@jacp/</a></p><ac:image>
|
||||
</ac:image><p>photo by: <a href="https://www.pexels.com/@jacp/">https://www.pexels.com/@jacp/</a></p><ac:image>
|
||||
<ri:attachment ri:filename="pexels-sami-aksu-14356302.jpg"></ri:attachment>
|
||||
</ac:image><p>photo by: <a href="https://www.pexels.com/@sami-aksu-48867324/">https://www.pexels.com/@sami-aksu-48867324/</a></p>
|
||||
</ac:image><p>photo by: <a href="https://www.pexels.com/@sami-aksu-48867324/">https://www.pexels.com/@sami-aksu-48867324/</a></p>
|
||||
|
|
|
|||
|
|
@ -12,29 +12,69 @@ Param(
|
|||
[Parameter(Mandatory)] [String] $Hostname,
|
||||
[Parameter(Mandatory)] [String] $Space,
|
||||
[Parameter(Mandatory)] [String] $PersonalAccessToken,
|
||||
[Parameter()] [String] $ManifestFile = 'data/manifest.json'
|
||||
[Parameter()] [String] $ManifestFile = "$PSScriptRoot/data/manifest.json"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$DebugPreference = 'Continue'
|
||||
|
||||
Import-Module "$PSScriptRoot/../../src/PSConfluencePublisher.psd1"
|
||||
|
||||
# create a high-level manifest pseudo-object
|
||||
Write-Host "initializing manifest..."
|
||||
|
||||
# create a high-level manifest pseudo-object. As mentioned, this is just a
|
||||
# pseduo-object to organize things a little better.
|
||||
$manifest = Initialize-Manifest -Path $ManifestFile
|
||||
|
||||
# create a high-level connection pseudo-object
|
||||
Write-Host "initializing and testing connectivity..."
|
||||
|
||||
# create a high-level connection pseudo-object. As mentioned, this is just a
|
||||
# pseduo-object to organize things a little better.
|
||||
$connection = Initialize-Connection `
|
||||
-Host $Hostname `
|
||||
-Space $Space `
|
||||
-PersonalAccessToken $PersonalAccessToken
|
||||
|
||||
Write-Host "fetching pages metadata..."
|
||||
|
||||
# unidirectionally synchronize all remote metadata to local (in-memory) manifest
|
||||
$manifest.Manifest.Pages = Get-PageMeta `
|
||||
-Host $Hostname `
|
||||
-Manifest $manifest.Manifest.Pages `
|
||||
-Space $Space `
|
||||
-Force
|
||||
|
||||
Write-Host "publishing pages ($($manifest.Manifest.Pages.Count))..."
|
||||
|
||||
# publish all pages listed in manifest
|
||||
Publish-Pages `
|
||||
-Manifest $manifest `
|
||||
-Connection $connection
|
||||
|
||||
Write-Host "fetching attachments metadata..."
|
||||
|
||||
# unidirectionally synchronize all remote attachment metadata to local
|
||||
# (in-memory) manifest
|
||||
$manifest.Manifest.Attachments = Get-AttachmentMeta `
|
||||
-Host $Hostname `
|
||||
-Manifest $manifest.Manifest.Attachments `
|
||||
-Index $manifest.Index.Attachments `
|
||||
-PagesManifest $manifest.Manifest.Pages `
|
||||
-PagesIndex $manifest.Index.Pages `
|
||||
-Space $Space `
|
||||
-Force
|
||||
|
||||
Write-Host "publishing attachments ($($manifest.Manifest.Attachments.Count))..."
|
||||
|
||||
# publish all pages listed in manifest
|
||||
Publish-Attachments `
|
||||
-Manifest $manifest `
|
||||
-Connection $connection
|
||||
|
||||
Write-Host "dumping manifest to filesystem..."
|
||||
|
||||
# write back to disk
|
||||
Set-Manifest `
|
||||
-Manifest $manifest.Manifest `
|
||||
-File $manifest.Path `
|
||||
-Backup $true
|
||||
-Backup $true | Out-Null
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue