Skip to content

Commit

Permalink
Merge pull request #7 from rhpds/showroom
Browse files Browse the repository at this point in the history
Showroom, initial migration
  • Loading branch information
kodonnellredhat authored May 31, 2024
2 parents 8cf85bf + 7354565 commit 23bb601
Show file tree
Hide file tree
Showing 313 changed files with 3,936 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: github pages

on:
workflow_dispatch:
push:
branches: [showroom]
paths-ignore:
- "README.adoc"
- ".gitignore"

permissions:
pages: write
id-token: write

concurrency:
group: gh-pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: configure pages
uses: actions/configure-pages@v5
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20.13.1
- name: install antora
run: npm install --global @antora/cli@3.1 @antora/site-generator@3.1
- name: antora generate
run: antora generate default-site.yml --stacktrace
- name: upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: www
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: deploy github pages
id: deployment
uses: actions/deploy-pages@v4
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Ignore macOS system files
.DS_Store

# Ignore node_modules directory
node_modules/

# Ignore build output
www/
.cache/

# Ignore IDE and editor files
.vscode/
.idea/

# Ignore logs and temporary files
*.log
*.tmp

# Ignore environment-specific files
.env
.env.local
.env.*.local

# Ignore sensitive or private information
secrets.json

# Ignore compiled binaries or executables
*.exe
*.dll
*.so
*.dylib
*.core

# Ignore package-lock.json for npm
package-lock.json

# Ignore yarn.lock for Yarn
yarn.lock
68 changes: 68 additions & 0 deletions TODO.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
== Bookbag -> Showroom Migration

=== GitHub Pages

=== Progress so far

. in new branch `showroom`
* all asciidoc and images move into their proper places.
* all (?) asciidoc `image:[]` edited to locate images correctly.
* new `nav.adoc` created with a *Modules* header for the many modules.

=== Generate your site

. Install Antora on your laptop
. Clone this repo
. Switch branches to `showroom`
. Generate the site
+
[source,console,subs="verbatim,quotes"]
----
*cd ~/Development/roadshow_ocpvirt_instructions-bootcamp-edition; antora generate default-site.yml*
(node:7931) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
site-wide attributes (as defined in playbook)
{}
master@modules attributes (as defined in antora.yml)
{
lab_name: "I'm the lab_name var",
'release-version': 'master',
'page-pagination': true,
my_var: 'foo',
guid: 'my-guid',
ssh_user: 'devops',
ssh_password: 'devops',
ssh_command: 'ssh devops@bastion.{guid}.example.opentlc.com',
xdg_runtime_dir: 'xdg_runtime_dir'
}
[09:32:24.139] ERROR (asciidoctor): level 0 sections can only be used when doctype is book
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:5
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.140] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:8
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.141] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:12
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.141] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:16
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.141] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:20
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.142] ERROR (asciidoctor): level 0 sections can only be used when doctype is book
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:24
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.142] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:26
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
[09:32:24.142] WARN (asciidoctor): section title out of sequence: expected level 1, got level 2
file: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition/content/modules/ROOT/pages/04a_DO316.adoc:30
source: /Users/jmaltin/Development/roadshow_ocpvirt_instructions-bootcamp-edition (branch: showroom <worktree> | start path: content)
Site generation complete!
Open file:///$HOME/Development/roadshow_ocpvirt_instructions-bootcamp-edition/www/index.html in a browser to view your site.
----
+
. Fix the WARNings and re-run the `antora generate default-site.yml`
. Click the URL
17 changes: 17 additions & 0 deletions content/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: modules
title: Virtualization Bootcamp
version: master
nav:
- modules/ROOT/nav.adoc

asciidoc:
attributes:
lab_name: "I'm the lab_name var"
release-version: master
page-pagination: true
my_var: "foo"
guid: my-guid
ssh_user: devops
ssh_password: devops
ssh_command: ssh devops@bastion.{guid}.example.opentlc.com
xdg_runtime_dir: xdg_runtime_dir
35 changes: 35 additions & 0 deletions content/lib/all-attributes-console-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports.register = function () {
this.once('contentClassified', ({ playbook, contentCatalog }) => {
const newPage = contentCatalog.addFile({
contents: Buffer.from('= New Page\n\nThis is the contents of a generated page.'),
path: 'content/modules/ROOT/pages/new-page.adoc',
version: '3.1',
src: {
path: 'content/modules/ROOT/pages/new-page.adoc',
component: 'antora',
version: '3.1',
module: 'ROOT',
family: 'page',
relative: 'new-page.adoc',
},})
console.log('site-wide attributes (as defined in playbook)')
console.log(playbook.asciidoc.attributes)
contentCatalog.getComponents().forEach((component) => {
component.versions.forEach((componentVersion) => {
getUniqueOrigins(contentCatalog, componentVersion).forEach((origin) => {
console.log(`${componentVersion.version}@${componentVersion.name} attributes (as defined in antora.yml)`)
console.log(origin.descriptor.asciidoc?.attributes || {})
})
})
})
})
}

function getUniqueOrigins (contentCatalog, componentVersion) {
return contentCatalog.findBy({ component: componentVersion.name, version: componentVersion.version })
.reduce((origins, file) => {
const origin = file.src.origin
if (origin && !origins.includes(origin)) origins.push(origin)
return origins
}, [])
}
16 changes: 16 additions & 0 deletions content/lib/attributes-page-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports.register = function ({ config }) {
this.once('contentClassified', ({ contentCatalog }) => {
const newPage = contentCatalog.addFile({
contents: Buffer.from('= New Page\n\nThis is the contents of a generated page.'),
path: 'content/modules/ROOT/pages/new-page.adoc',
src: {
path: 'content/modules/ROOT/pages/new-page.adoc',
component: 'antora',
version: '3.1',
module: 'ROOT',
family: 'page',
relative: 'new-page.adoc',
},
})
})
}
85 changes: 85 additions & 0 deletions content/lib/dev-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
'use strict'

module.exports.register = function ({ config }) {
this.once('contentClassified', ({ playbook, contentCatalog }) => {
var pageDetails = {}
console.log('site-wide attributes (as defined in playbook)')
console.log(playbook.asciidoc.attributes)
let fileContents = "== Site Wide Attributes\n\n"
fileContents += `${playbook.asciidoc.attributes || {}}\n`
contentCatalog.getComponents().forEach((component) => {
component.versions.forEach((componentVersion) => {
getUniqueOrigins(contentCatalog, componentVersion).forEach((origin) => {
console.log(`${componentVersion.version}@${componentVersion.name} attributes (as defined in antora.yml)`)
pageDetails = { version: `${componentVersion.version}`, name: `${componentVersion.name}` }
console.log(origin.descriptor.asciidoc?.attributes || {})
fileContents += `== Component Wide Attributes\n\n`
fileContents += `Antora component version@name: \`${componentVersion.version}@${componentVersion.name}\`\n\n`
fileContents += `[source,json]\n----\n`
fileContents += JSON.stringify(origin.descriptor.asciidoc?.attributes || {}, null, 2)
fileContents += `\n----\n`
})
})
})
const newPage = contentCatalog.addFile({
contents: Buffer.from('= Attributes Page\n\nTo disable Dev Mode (this page) comment out the dev-mode.js extenion in the playbook (usually default-site.yml)\n\n' + fileContents),
path: 'modules/ROOT/pages/attrs-page.adoc',
src: {
path: 'modules/ROOT/pages/attrs-page.adoc',
component: pageDetails.name,
version: pageDetails.version,
// component: pageDetails.name || 'modules',
// version: pageDetails.version || 'master',
module: 'ROOT',
family: 'page',
relative: 'attrs-page.adoc',
},
})
})
// add new page to navigation
this.on('navigationBuilt', ({ contentCatalog }) => {
const { addToNavigation = true, devPagesHeading = 'Dev Mode' } = config
const logger = this.getLogger('dev-pages-extension')
contentCatalog.getComponents().forEach(({ versions }) => {
versions.forEach(({ name: component, version, navigation: nav, url: defaultUrl }) => {
const navEntriesByUrl = getNavEntriesByUrl(nav)
const unlistedPages = contentCatalog
.findBy({ component, version, family: 'page' })
.filter((page) => page.out)
.reduce((collector, page) => {
if ((page.pub.url in navEntriesByUrl) || page.pub.url === defaultUrl) return collector
// logger.warn({ file: page.src, source: page.src.origin }, 'detected unlisted dev page')
return collector.concat(page)
}, [])
if (unlistedPages.length && addToNavigation) {
nav.push({
content: devPagesHeading,
items: unlistedPages.map((page) => {
// logger.warn({ content: page, url: page.pub.url }, 'unlisted dev page details')
const navtitle = page.asciidoc.navtitle || page.src.stem
return { content: navtitle, url: page.pub.url, urlType: 'internal' }
}),
root: true,
})
}
})
})
})
}

function getUniqueOrigins (contentCatalog, componentVersion) {
return contentCatalog.findBy({ component: componentVersion.name, version: componentVersion.version })
.reduce((origins, file) => {
const origin = file.src.origin
if (origin && !origins.includes(origin)) origins.push(origin)
return origins
}, [])
}

function getNavEntriesByUrl (items = [], accum = {}) {
items.forEach((item) => {
if (item.urlType === 'internal') accum[item.url.split('#')[0]] = item
getNavEntriesByUrl(item.items, accum)
})
return accum
}
39 changes: 39 additions & 0 deletions content/lib/unlisted-pages-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports.register = function ({ config }) {
const { addToNavigation, unlistedPagesHeading = 'Unlisted Pages' } = config
const logger = this.getLogger('unlisted-pages-extension')
this
.on('navigationBuilt', ({ contentCatalog }) => {
contentCatalog.getComponents().forEach(({ versions }) => {
versions.forEach(({ name: component, version, navigation: nav, url: defaultUrl }) => {
const navEntriesByUrl = getNavEntriesByUrl(nav)
const unlistedPages = contentCatalog
.findBy({ component, version, family: 'page' })
.filter((page) => page.out)
.reduce((collector, page) => {
if ((page.pub.url in navEntriesByUrl) || page.pub.url === defaultUrl) return collector
logger.warn({ file: page.src, source: page.src.origin }, 'detected unlisted page')
return collector.concat(page)
}, [])
if (unlistedPages.length && addToNavigation) {
nav.push({
content: unlistedPagesHeading,
items: unlistedPages.map((page) => {
logger.warn({ content: page, url: page.pub.url }, 'unlisted page details')
const navtitle = page.asciidoc.navtitle || page.src.stem
return { content: navtitle, url: page.pub.url, urlType: 'internal' }
}),
root: true,
})
}
})
})
})
}

function getNavEntriesByUrl (items = [], accum = {}) {
items.forEach((item) => {
if (item.urlType === 'internal') accum[item.url.split('#')[0]] = item
getNavEntriesByUrl(item.items, accum)
})
return accum
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/modules/ROOT/assets/images/Refresh_UI.png
Loading

0 comments on commit 23bb601

Please sign in to comment.