diff --git a/docs/20_Installation.md b/docs/20_Installation.md index 320086837785a1e52131c76e5797aee90695db61..c0ff06c226b91ec711c01d51bfbbfdefe9d03532 100644 --- a/docs/20_Installation.md +++ b/docs/20_Installation.md @@ -1,5 +1,14 @@ ## Installation +<!-- START-ADD-TTY-PLAYER --> +<html> + <script src=ttyrec/webcomponents-lite.min.js></script> + <link rel=stylesheet href=ttyrec/tty-player.css> + <script src=ttyrec/term.min.js></script> + <script src=ttyrec/tty-player.min.js></script> +</html> +<!-- END-ADD-TTY-PLAYER --> + ### Linux Download the binary as root or with sudo @@ -20,5 +29,11 @@ Test amcli: ```txt /usr/local/bin/amcli -V -0.4 +0.10 ``` + +#### Video + +The installation steps above shown in a video: + +<tty-player controls rows=20 cols=90 src=files/install_binary.ttyrec poster=npt:33.00></tty-player> diff --git a/docs/30_Usage.md b/docs/30_Usage.md index 1c26f0679f28e40ece941a725e1f8db19d2a8abe..08883eef050720d9d066b0cc74f17b515d6a550d 100644 --- a/docs/30_Usage.md +++ b/docs/30_Usage.md @@ -1,3 +1,12 @@ +<!-- START-ADD-TTY-PLAYER --> +<html> + <script src=ttyrec/webcomponents-lite.min.js></script> + <link rel=stylesheet href=ttyrec/tty-player.css> + <script src=ttyrec/term.min.js></script> + <script src=ttyrec/tty-player.min.js></script> +</html> +<!-- END-ADD-TTY-PLAYER --> + ## Show help ```text @@ -60,6 +69,8 @@ You find example snippets in the source code of this project in tests/config/. ``` +<tty-player controls rows=20 cols=90 src=files/usage_show_infos.ttyrec poster=npt:18.00></tty-player> + ## Execute checks Checks can be defined by writing an INI file that contains meta information and sections for each check. @@ -72,6 +83,8 @@ Recommendations: * The output is JSON in a single line. You can use `jq` to beautify it, eg `[<PATH>]amcli --ini=<FILENAME> | jq` * If the bahaviuor seems to be unwanted use `-v` to enable verbose mode. You get more debug output during the execution, showing parsed ini file and more. `[<PATH>]amcli --ini=<FILENAME> -v` +<tty-player controls rows=20 cols=90 src=files/usage_execute.ttyrec poster=npt:18.00></tty-player> + ## Exitcodes The binary could stop and exit with non zero exitcode. diff --git a/docs/80_Build.md b/docs/80_Build.md index 452a742d6db866515a2cf618fca4001c3a933205..a35b0306c4358fc9eee4dee8a5e8b6714d6a5c20 100644 --- a/docs/80_Build.md +++ b/docs/80_Build.md @@ -1,3 +1,12 @@ +<!-- START-ADD-TTY-PLAYER --> +<html> + <script src=ttyrec/webcomponents-lite.min.js></script> + <link rel=stylesheet href=ttyrec/tty-player.css> + <script src=ttyrec/term.min.js></script> + <script src=ttyrec/tty-player.min.js></script> +</html> +<!-- END-ADD-TTY-PLAYER --> + ## Requirements ### Linux @@ -98,6 +107,19 @@ The newly created files and dirs are: : ``` +### Video of the installer + +The installer automates several things. + +Espacially the download and compiler steps take a while. This video shows the process on my machine. + +<tty-player controls rows=20 cols=90 src=files/installer.ttyrec poster=npt:26.00></tty-player> + +But a 2nd run is faster. It needs to git pull the appmonitor sources. + +<tty-player controls rows=20 cols=90 src=files/installer2.ttyrec poster=npt:7.60></tty-player> + + ## Build To build the amcli binary start `./build.php`. This script has command line parameter support. diff --git a/docs/files/install_binary.ttyrec b/docs/files/install_binary.ttyrec new file mode 100644 index 0000000000000000000000000000000000000000..d956c10c60947e9a5e7d21085f3ea1298c50681b Binary files /dev/null and b/docs/files/install_binary.ttyrec differ diff --git a/docs/files/installer.ttyrec b/docs/files/installer.ttyrec new file mode 100644 index 0000000000000000000000000000000000000000..5006ddf174e29ce0b3bb245aee56f745ded518b1 Binary files /dev/null and b/docs/files/installer.ttyrec differ diff --git a/docs/files/installer2.ttyrec b/docs/files/installer2.ttyrec new file mode 100644 index 0000000000000000000000000000000000000000..25d9e818063bc10712ca6df0c13bd3f816acf2aa Binary files /dev/null and b/docs/files/installer2.ttyrec differ diff --git a/docs/files/usage_execute.ttyrec b/docs/files/usage_execute.ttyrec new file mode 100644 index 0000000000000000000000000000000000000000..039ce00c40c84c0b303e469ba22db79f5d583e84 Binary files /dev/null and b/docs/files/usage_execute.ttyrec differ diff --git a/docs/files/usage_show_infos.ttyrec b/docs/files/usage_show_infos.ttyrec new file mode 100644 index 0000000000000000000000000000000000000000..3cb8a01c2141fcfc210356e91cbdbe5fe349abeb Binary files /dev/null and b/docs/files/usage_show_infos.ttyrec differ diff --git a/docs/ttyrec b/docs/ttyrec new file mode 120000 index 0000000000000000000000000000000000000000..4c198cb203e0f7507cefc3f469564e296d75dff6 --- /dev/null +++ b/docs/ttyrec @@ -0,0 +1 @@ +/home/axel/sources/docker/docpages/public_html/docs/addons/ttyrec \ No newline at end of file diff --git a/helpers/install_binary.cdm b/helpers/install_binary.cdm new file mode 100644 index 0000000000000000000000000000000000000000..b57be5718f7ab35c1fec5065e863d23ffa7f7d27 --- /dev/null +++ b/helpers/install_binary.cdm @@ -0,0 +1,32 @@ +# ---------------------------------------------------------------------- +# +# CLI demo file +# used in docs/20_Installation.md +# +# ---------------------------------------------------------------------- + + # set fake prompt: + cdm.setpath "~" + + rem "" + rem "Welcome to this ascii demo!" + rem "Let's install the appmonitor client binary using curl" + rem "" + sudo curl -o /usr/local/bin/amcli https://static.iml.unibe.ch/downloads/appmonitor_client/amcli_linux_x86_64 + + rem "" + rem "Make it executable for everyone" + rem "" + sudo chmod 0755 /usr/local/bin/amcli + + rem "" + rem "We can test to execute it now" + rem "" + + /usr/local/bin/amcli -V + + rem "" + rem "Great, it seems to work!" + rem "" + +# ---------------------------------------------------------------------- diff --git a/helpers/installer.cdm b/helpers/installer.cdm new file mode 100644 index 0000000000000000000000000000000000000000..555f347ed3055527b23f6b898d7a9fbd1af97ccb --- /dev/null +++ b/helpers/installer.cdm @@ -0,0 +1,54 @@ +# ---------------------------------------------------------------------- +# +# CLI demo file +# used in docs/80_Build.md +# +# ---------------------------------------------------------------------- + + rem "" + rem "Welcome to this ascii demo!" + rem "Let's install the development environment." + rem "" + + cdm.shell "sleep 2" + + cdm.shell "mkdir -p ~/tmp/clidemos" + cdm.shell "cd ~/tmp/clidemos" + cdm.shell "rm -rf ~/tmp/clidemos/appmonitor-cli-client" + + # set fake prompt: + cdm.setpath "~/projects/" + + rem "" + rem "Let's get the sources." + rem "" + + git clone https://git-repo.iml.unibe.ch/iml-open-source/appmonitor-cli-client.git + cd appmonitor-cli-client + cdm.setpath "~/projects/appmonitor-cli-client" + + ls + + rem "" + rem "The 'installer.php' has a help page." + rem "" + ./installer.php -h + + rem "" + rem "The 'installer.php' script prepares the environment to start" + rem "development and build of appmonitor cli:" + rem "" + rem "- get appmonitor source code" + rem "- download 'spc' (static-php-cli)" + rem "- The 'spc doctor' command installs needed sources." + rem "- Spc builds a Php micro sfx with needed php modules." + rem "- Create a merged include file of appmonitor client" + rem "" + + ./installer.php + + rem "" + rem "Great, it seemed to work!" + rem "" + +# ---------------------------------------------------------------------- diff --git a/helpers/installer2.cdm b/helpers/installer2.cdm new file mode 100644 index 0000000000000000000000000000000000000000..c6148f1b3f955048e4946cfb360ff1c7ec014e8e --- /dev/null +++ b/helpers/installer2.cdm @@ -0,0 +1,23 @@ +# ---------------------------------------------------------------------- +# +# CLI demo file +# used in docs/80_Build.md +# +# ---------------------------------------------------------------------- + + # set fake prompt: + cdm.setpath "~/projects/appmonitor-cli-client" + cdm.shell "cd ~/tmp/clidemos/appmonitor-cli-client" + + rem "" + rem "Welcome to this ascii demo!" + rem "A 2nd run of the 'installer.php' is much faster" + rem "" + + time ./installer.php + + rem "" + rem "Yep, much faster :-)" + rem "" + +# ---------------------------------------------------------------------- diff --git a/helpers/scan_ttyrec.sh b/helpers/scan_ttyrec.sh new file mode 100755 index 0000000000000000000000000000000000000000..b9a7722584ab8e412be8d4efbb6152152dd9545a --- /dev/null +++ b/helpers/scan_ttyrec.sh @@ -0,0 +1,45 @@ +#!/usr/bin/bash +# ---------------------------------------------------------------------- +# detect ttyplayer in markdown files +# ---------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# CONFIG +# ---------------------------------------------------------------------- +cd "$(dirname "$0")/../docs" || exit 1 + +ttysource=/home/axel/sources/docker/docpages/public_html/docs/addons/ttyrec + +ttyblock="<!-- START-ADD-TTY-PLAYER --> +<html> + <script src=ttyrec/webcomponents-lite.min.js></script> + <link rel=stylesheet href=ttyrec/tty-player.css> + <script src=ttyrec/term.min.js></script> + <script src=ttyrec/tty-player.min.js></script> +</html> +<!-- END-ADD-TTY-PLAYER -->" + +# ---------------------------------------------------------------------- +# MAIN +# ---------------------------------------------------------------------- +echo +echo "Detect ttyplayer in markdown files..." +echo + +for myfile in $( grep -rl "<tty-player" *md ) +do + echo "--- $myfile" + if grep -q "$ttyblock" "$myfile"; then + echo "SKIP: html header found." + else + echo "Adding html header..." + ( echo "$ttyblock" ; echo; cat "$myfile" ) >> "$myfile.tmp" + mv "$myfile.tmp" "$myfile" + fi + + # if the 1st player was found: add ttyrec as softlink below docs folder + ls -ld ttyrec 2>/dev/null | grep -q "^l" || ln -s "$ttysource" +done + +echo "Done" +# ---------------------------------------------------------------------- diff --git a/helpers/ttyrecord b/helpers/ttyrecord new file mode 100644 index 0000000000000000000000000000000000000000..a39b60cf0e79e64d075717e238f2d86c1d3e9d0f Binary files /dev/null and b/helpers/ttyrecord differ diff --git a/helpers/usage_execute.cdm b/helpers/usage_execute.cdm new file mode 100644 index 0000000000000000000000000000000000000000..bc27a65ddc9e72350e8b5c74156cdc0a3fb5d06c --- /dev/null +++ b/helpers/usage_execute.cdm @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------- +# +# CLI demo file +# used in docs/30_Usage.md +# +# ---------------------------------------------------------------------- + + # set fake prompt: + cdm.setpath "~" + + rem "" + rem "Welcome to this ascii demo!" + rem "Let's execute a check that is declared in an ini file" + rem "" + + /usr/local/bin/amcli --ini=tests/configs/metadata.ini + + rem "" + rem "If you have tool like jq you can create a more readable output" + rem "" + + /usr/local/bin/amcli --ini=tests/configs/metadata.ini | jq + + rem "" + rem "Have fun!" + rem "" + +# ---------------------------------------------------------------------- diff --git a/helpers/usage_show_infos.cdm b/helpers/usage_show_infos.cdm new file mode 100644 index 0000000000000000000000000000000000000000..c4baa830a15bd64669975544e25812dd3f5adae7 --- /dev/null +++ b/helpers/usage_show_infos.cdm @@ -0,0 +1,53 @@ +# ---------------------------------------------------------------------- +# +# CLI demo file +# used in docs/30_Usage.md +# +# ---------------------------------------------------------------------- + + # set fake prompt: + cdm.setpath "~" + + rem "" + rem "Welcome to this ascii demo!" + rem "Let's play around with some parameters" + rem "" + + cdm.shell "sleep 2" + + rem "" + rem "Show version" + rem "" + /usr/local/bin/amcli -V + + rem "" + rem "That is just the version of the cli wrapper." + rem "We can let show the versions of related tools too:" + rem "- version of compiled appmonitor" + rem "- used PHP version" + rem "- included PHP modules" + rem "" + /usr/local/bin/amcli -b + + rem "" + rem "We can list which PHP client checks are included." + rem "" + /usr/local/bin/amcli -l + + rem "" + rem "There is an explain mode." + rem "It shows an example ini section for a single check" + rem "Let's try the 'ping' check:" + rem "" + /usr/local/bin/amcli -e=ping + + rem "" + rem "The help shows all options" + rem "" + /usr/local/bin/amcli -h + + rem "" + rem "Have fun!" + rem "" + +# ----------------------------------------------------------------------