Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
pwright committed Jun 24, 2024
1 parent 259bc5b commit ab8d3f4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 50 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/asciidoc-convert-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,8 @@ jobs:
run: |
mkdir -p converted_files
# List of AsciiDoc files to convert
files=(
"cli/index.adoc"
"cli/tokens.adoc"
"cli/podman.adoc"
"cli/native-security-options.adoc"
"yaml/index.adoc"
"operator/index.adoc"
"console/index.adoc"
"policy/index.adoc"
"troubleshooting/index.adoc"
"overview/connectivity.adoc"
"overview/glossary.adoc"
"overview/index.adoc"
"overview/resources.adoc"
"overview/routing.adoc"
"overview/security.adoc"
"overview/load.adoc"
"kubernetes/deployment-concerns.adoc"
)
mapfile -t files < published-adoc.txt
for file in "${files[@]}"; do
# Create the target directory if it doesn't exist
target_dir=converted_files/$(dirname "$file")
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export PYTHONPATH := python

.PHONY: generate-preview
generate-preview:
python ./scripts/convert-all.py ./scripts/convert-adoc.sh .github/workflows/asciidoc-convert-check.yml
python ./scripts/convert-all.py ./scripts/convert-adoc.sh published-adoc.txt
File renamed without changes.
17 changes: 17 additions & 0 deletions published-adoc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cli/index.adoc
cli/tokens.adoc
cli/podman.adoc
cli/native-security-options.adoc
yaml/index.adoc
operator/index.adoc
console/index.adoc
policy/index.adoc
troubleshooting/index.adoc
overview/connectivity.adoc
overview/glossary.adoc
overview/index.adoc
overview/resources.adoc
overview/routing.adoc
overview/security.adoc
overview/load-balancing.adoc
kubernetes/deployment-concerns.adoc
35 changes: 7 additions & 28 deletions scripts/convert-all.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import yaml
import subprocess
import os
import argparse
Expand All @@ -7,33 +6,14 @@
def parse_args():
parser = argparse.ArgumentParser(description="Process AsciiDoc files using a specified script.")
parser.add_argument('script', help="Path to the script to process AsciiDoc files.")
parser.add_argument('yaml_file', help="Path to the YAML file containing the list of AsciiDoc files.")
parser.add_argument('file_list', help="Path to the text file containing the list of AsciiDoc files.")
return parser.parse_args()

# Function to read the YAML content from a file
def read_yaml(yaml_file):
with open(yaml_file, 'r') as file:
return yaml.safe_load(file)

# Function to retrieve AsciiDoc files list
def get_asciidoc_files(data):
asciidoc_files = []
# Navigate through the nested dictionary to find the 'files' list
for job_name, job_details in data.get('jobs', {}).items():
steps = job_details.get('steps', [])
for step in steps:
if step.get('name') == 'Convert specified AsciiDoc files to HTML':
run_content = step.get('run', '')
if 'files=(' in run_content:
start = run_content.find('files=(') + len('files=(')
end = run_content.find(')', start)
files_list = run_content[start:end].strip().split('\n')
# Clean and add the files to the list
for file in files_list:
clean_file = file.strip().strip('"')
if clean_file:
asciidoc_files.append(clean_file)
return asciidoc_files
# Function to read the list of AsciiDoc files from a text file
def read_file_list(file_list_path):
with open(file_list_path, 'r') as file:
files = [line.strip() for line in file if line.strip()]
return files

# Function to run the specified script against each AsciiDoc file
def process_asciidoc_file(script, file):
Expand All @@ -49,8 +29,7 @@ def process_asciidoc_file(script, file):

def main():
args = parse_args()
data = read_yaml(args.yaml_file)
asciidoc_files = get_asciidoc_files(data)
asciidoc_files = read_file_list(args.file_list)
for file in asciidoc_files:
process_asciidoc_file(args.script, file)

Expand Down
3 changes: 1 addition & 2 deletions yaml/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,14 @@ $ kubectl apply -f token.yml
$ skupper link status --wait 60
----

// tag::skupper-io[]
Skupper recommends using the CLI to create links.

A future release of Skupper will provide an alternative declarative method to create links.

// end::skupper-io[]

include::annotations.adoc[leveloffset=+1]

// end::skupper-io[]


// Type: reference
Expand Down

0 comments on commit ab8d3f4

Please sign in to comment.