Skip to content

Commit

Permalink
Move standard text blocks to their own file
Browse files Browse the repository at this point in the history
  • Loading branch information
ssorj committed Jan 16, 2024
1 parent dda0671 commit 263aa37
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 44 deletions.
50 changes: 6 additions & 44 deletions python/skewer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,8 @@
"generate_readme", "run_steps_minikube", "run_steps", "Minikube",
]

standard_steps_yaml = read(join(get_parent_dir(__file__), "standardsteps.yaml"))
standard_steps = parse_yaml(standard_steps_yaml)

example_suite_para = """
This example is part of a [suite of examples][examples] showing the
different ways you can use [Skupper][website] to connect services
across cloud providers, data centers, and edge sites.
[website]: https://skupper.io/
[examples]: https://skupper.io/examples/index.html
""".strip()

standard_prerequisites = """
* The `kubectl` command-line tool, version 1.15 or later
([installation guide][install-kubectl])
* Access to at least one Kubernetes cluster, from [any provider you
choose][kube-providers]
[install-kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[kube-providers]: https://skupper.io/start/kubernetes.html
""".strip()

standard_next_steps = """
Check out the other [examples][examples] on the Skupper website.
""".strip()

about_this_example = """
This example was produced using [Skewer][skewer], a library for
documenting and testing Skupper examples.
[skewer]: https://github.com/skupperproject/skewer
Skewer provides utility functions for generating the README and
running the example steps. Use the `./plano` command in the project
root to see what is available.
To quickly stand up the example using Minikube, try the `./plano demo`
command.
""".strip()
standard_text = read_yaml(join(get_parent_dir(__file__), "standardtext.yaml"))
standard_steps = read_yaml(join(get_parent_dir(__file__), "standardsteps.yaml"))

def check_environment():
check_program("base64")
Expand Down Expand Up @@ -352,7 +314,7 @@ def step_heading(step):
out.append(f"#### {model.subtitle}")
out.append("")

out.append(example_suite_para)
out.append(standard_text["example_suite_para"].strip())
out.append("")
out.append("#### Contents")
out.append("")
Expand Down Expand Up @@ -382,7 +344,7 @@ def step_heading(step):

append_section("Summary", model.summary)
append_section("Next steps", model.next_steps)
append_section("About this example", about_this_example)
append_section("About this example", standard_text["about_this_example"].strip())

write(output_file, "\n".join(out).strip() + "\n")

Expand Down Expand Up @@ -554,9 +516,9 @@ class Model:
subtitle = object_property("subtitle")
workflow = object_property("workflow", "main.yaml")
overview = object_property("overview")
prerequisites = object_property("prerequisites", standard_prerequisites)
prerequisites = object_property("prerequisites", standard_text["prerequisites"].strip())
summary = object_property("summary")
next_steps = object_property("next_steps", standard_next_steps)
next_steps = object_property("next_steps", standard_text["next_steps"].strip())

def __init__(self, skewer_file, kubeconfigs=[]):
self.skewer_file = skewer_file
Expand Down
30 changes: 30 additions & 0 deletions python/skewer/standardtext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
example_suite_para: |
This example is part of a [suite of examples][examples] showing the
different ways you can use [Skupper][website] to connect services
across cloud providers, data centers, and edge sites.
[website]: https://skupper.io/
[examples]: https://skupper.io/examples/index.html
prerequisites: |
* The `kubectl` command-line tool, version 1.15 or later
([installation guide][install-kubectl])
* Access to at least one Kubernetes cluster, from [any provider you
choose][kube-providers]
[install-kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[kube-providers]: https://skupper.io/start/kubernetes.html
next_steps: |
Check out the other [examples][examples] on the Skupper website.
about_this_example: |
This example was produced using [Skewer][skewer], a library for
documenting and testing Skupper examples.
[skewer]: https://github.com/skupperproject/skewer
Skewer provides utility functions for generating the README and
running the example steps. Use the `./plano` command in the project
root to see what is available.
To quickly stand up the example using Minikube, try the `./plano demo`
command.

0 comments on commit 263aa37

Please sign in to comment.