Skip to content

Commit

Permalink
docs: update gems and examples, add Makefile
Browse files Browse the repository at this point in the history
Update the dependencies and the examples after updating the
dependencies.
  • Loading branch information
derlin committed Aug 1, 2024
1 parent 4c0f84c commit a4bbae8
Show file tree
Hide file tree
Showing 26 changed files with 76 additions and 51 deletions.
3 changes: 2 additions & 1 deletion docs/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source "https://rubygems.org"

gem "github-pages", "~> 219", group: :jekyll_plugins
gem "github-pages", group: :jekyll_plugins

# kramdown v2 ships without the gfm parser by default. If you're using
# kramdown v1, comment out this line.
gem "kramdown-parser-gfm"
gem "webrick"
17 changes: 17 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DOCKER_IMAGE := bretfisher/jekyll-serve
SHELL:=/bin/bash

update_generated_assets: ## Copy the assets generated in tests to the docs
# IMPORTANT: run the ExamplesGenerator in src/tests first!
cp `find ../build/generated -type f '!' -name '*.png' '!' -name '*.svg'` _includes/generated
cp `find ../build/generated -type f -name '*.png' -o -name '*.svg'` assets/generated

serve: ## start serving the docs locally
@echo "Serving docs on http://localhost:4000/docker-compose-viz-mermaid/"
docker run --rm --name dcvm-docs -v $(PWD):/site -p 4000:4000 $(DOCKER_IMAGE)

update_local_gem: ## remove the local Gemfile.lock
rm Gemfile.lock



26 changes: 12 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Docs

## Requirements

- make
- docker

## Generate assets

Everything under `assets/generated` and `_includes/generated` is generated automatically from tests.
Expand All @@ -9,23 +14,16 @@ Those tests are however disabled by default. To generate them, use:
./gradlew test -Pgenerate
```

## Run this site locally

**INFO**: the script `jekyll.sh` does everything automatically for you.

Launch Jekyll in a docker container:
To copy them after re-generation, use the `Makefile` in this folder:
```bash
docker run --rm --volume="$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/builder:3.8 bash
make update_generated_assets
```

Then, inside the docker container, run:
## Run this site locally

Launch Jekyll in a docker container using:
```bash
# update bundler
gem install bundler
# do this once
bundle install
# then run the server
bundle exec jekyll serve --host 0.0.0.0 --verbose --config "_config.yml,_config_dev.yml"
make serve
```

The local site will be available at http://localhost:4000.
The local site will be available at http://localhost:4000/docker-compose-viz-mermaid/.
49 changes: 29 additions & 20 deletions docs/_includes/generated/help.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
Usage: cli [OPTIONS] [docker-compose-path]
Usage: cli [<options>] [<docker-compose-path>]

Visualize a docker-compose, by converting it to a Mermaid graph.

Supported outputs (`-f`):

* 'text' (default) outputs the mermaid graph (use -o to output to a file instead of stdout);
* 'markdown' is same as text, but wraps the graph text in '```mermaid```'
* 'png' or 'svg' generates the image and saves it 'image.[png|svg]' (use -o to change the destination);
* 'editor' // 'preview' generates a link to the mermaid online editor, and print it to the console.

Supported outputs (-f):
╭───────────────────────────────────────────────────────────────────────────╮
* 'text' (default) outputs the mermaid graph (use -o to output to a file │
│instead of stdout); │
* 'markdown' is same as text, but wraps the graph text in '```mermaid```' │
* 'png' or 'svg' generates the image and saves it 'image.[png|svg]' (use -o│
│to change the destination); │
* 'editor' // 'preview' generates a link to the mermaid online editor, and │
│print it to the console. │
╰───────────────────────────────────────────────────────────────────────────╯
You can further customize the result using the options below.

Processing options:
-p, --ports / -P, --no-ports Extract and display ports
-v, --volumes / -V, --no-volumes Extract and display volumes
-n, --networks / -N, --no-networks Extract and display networks
-l, --ilinks / -L, --no-ilinks Try to find implicit links between services by looking at the
environment variables
-p, --ports / -P, --no-ports Extract and display ports
-v, --volumes / -V, --no-volumes
Extract and display volumes
-n, --networks / -N, --no-networks
Extract and display networks
-l, --ilinks / -L, --no-ilinks
Try to find implicit links between services by
looking at the environment variables

Output options:
-f, --format [TEXT|MARKDOWN|EDITOR|PREVIEW|PNG|SVG]
Output type (case insensitive) (default: TEXT)
-o, --out PATH Write output to a specific file
-b, --with-bg Force background color
-d, --dir [LR|RL|TB|BT] Graph orientation (default: TB)
-t, --theme [DEFAULT|DARK] Graph theme (default: DEFAULT)
-c, --classes / -C, --no-classes Add CSS classes to mermaid to make the output nicer
-f, --format=(TEXT|MARKDOWN|EDITOR|PREVIEW|PNG|SVG)
Output type (case insensitive) (default: TEXT)
-o, --out=<path> Write output to a specific file
-b, --with-bg Force background color
-d, --dir=(LR|RL|TB|BT) Graph orientation (default: TB)
-t, --theme=(DEFAULT|DARK) Graph theme (default: DEFAULT)
-c, --classes / -C, --no-classes
Add CSS classes to mermaid to make the output
nicer

Options:
--version Show the version and exit
--debug Be verbose
-h, --help Show this message and exit
Binary file modified docs/assets/generated/contactapp-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/contactapp-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/generated/contactapp-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/contactapp-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/links-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/links-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/generated/mailman-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/mailman-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/generated/mailman-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/mailman-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/networks-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/assets/generated/networks-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a4bbae8

Please sign in to comment.