rbcli 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -0
- data/LICENSE.txt +5 -670
- data/README.md +64 -160
- data/VERSION +1 -0
- data/exe/rbcli +181 -242
- data/lib/rbcli/components/commands/command.rb +120 -0
- data/lib/rbcli/components/commands/command.rb.erb +55 -0
- data/lib/rbcli/components/commands/command_old.rb +105 -0
- data/lib/rbcli/components/commands/script.rb.erb +43 -0
- data/{lib-sh → lib/rbcli/components/commands/scriptwrapper}/lib-rbcli.sh +29 -34
- data/lib/rbcli/components/commands/scriptwrapper/scriptwrapper.rb +64 -0
- data/lib/rbcli/components/config/backend.rb +104 -0
- data/lib/rbcli/components/config/backends/env.rb +63 -0
- data/lib/rbcli/components/config/backends/helpers/deep_assign.rb +47 -0
- data/lib/rbcli/components/config/backends/ini.rb +53 -0
- data/lib/rbcli/components/config/backends/json.rb +31 -0
- data/lib/rbcli/components/config/backends/null.rb +28 -0
- data/lib/rbcli/components/config/backends/toml.rb +37 -0
- data/lib/rbcli/components/config/backends/yaml.rb +31 -0
- data/lib/rbcli/components/config/component.rb +28 -0
- data/lib/rbcli/components/config/config.rb +110 -0
- data/lib/rbcli/components/config/config_of_death.rb +12 -0
- data/lib/rbcli/components/config/template.rb.erb +34 -0
- data/lib/rbcli/components/core/configurate.rb +63 -0
- data/lib/rbcli/components/core/engine.rb +30 -0
- data/lib/rbcli/components/core/warehouse.rb +18 -0
- data/lib/rbcli/components/envvars/component.rb +20 -0
- data/lib/rbcli/components/envvars/template.rb.erb +24 -0
- data/lib/rbcli/components/hooks/component.rb +36 -0
- data/lib/rbcli/components/hooks/template.rb.erb +20 -0
- data/lib/rbcli/components/logger/component.rb +32 -0
- data/lib/rbcli/components/logger/logger.rb +155 -0
- data/lib/rbcli/components/logger/lolcat/lol.rb +71 -0
- data/lib/rbcli/components/logger/template.rb.erb +40 -0
- data/lib/rbcli/components/parser/component.rb +34 -0
- data/lib/rbcli/{util → components/parser/optimist}/optimist.rb +134 -48
- data/lib/rbcli/components/parser/parser.rb +179 -0
- data/lib/rbcli/components/parser/template.rb.erb +36 -0
- data/lib/rbcli/components/updatechecker/common/common.rb +52 -0
- data/lib/rbcli/components/updatechecker/component.rb +42 -0
- data/lib/rbcli/components/updatechecker/gem_checker.rb +40 -0
- data/lib/rbcli/components/updatechecker/github_checker.rb +46 -0
- data/lib/rbcli/components/updatechecker/template.rb.erb +14 -0
- data/lib/rbcli/util/deprecation_warning.rb +41 -55
- data/lib/rbcli/util/errors.rb +12 -0
- data/lib/rbcli/util/exit.rb +12 -0
- data/lib/rbcli/util/hash_deep_symbolize.rb +50 -41
- data/lib/rbcli/util/string_compression.rb +10 -0
- data/lib/rbcli/version.rb +5 -20
- data/lib/rbcli-tool/helpers.rb +58 -0
- data/lib/rbcli-tool/skeletons/gem.rb.erb +17 -0
- data/lib/rbcli-tool/skeletons/portable.rb.erb +48 -0
- data/lib/rbcli.rb +19 -50
- data/sig/rbcli.rbs +9 -0
- metadata +124 -496
- data/.gitignore +0 -60
- data/.rakeTasks +0 -7
- data/.rbenv-gemsets +0 -1
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -193
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -92
- data/Rakefile +0 -10
- data/bin/console +0 -33
- data/bin/setup +0 -28
- data/docs/404.html +0 -59
- data/docs/advanced/automatic_updates/index.html +0 -1174
- data/docs/advanced/command_types/index.html +0 -1262
- data/docs/advanced/distributed_state_locking/index.html +0 -1176
- data/docs/advanced/hooks/index.html +0 -1192
- data/docs/advanced/index.html +0 -1140
- data/docs/advanced/index.xml +0 -75
- data/docs/advanced/interactive_commands/index.html +0 -1177
- data/docs/advanced/logging/index.html +0 -1184
- data/docs/advanced/remote_execution/index.html +0 -1190
- data/docs/advanced/state_storage/index.html +0 -1281
- data/docs/advanced/user_config_files/index.html +0 -1209
- data/docs/categories/index.html +0 -1146
- data/docs/categories/index.xml +0 -11
- data/docs/css/atom-one-dark-reasonable.css +0 -77
- data/docs/css/auto-complete.css +0 -47
- data/docs/css/featherlight.min.css +0 -8
- data/docs/css/fontawesome-all.min.css +0 -1
- data/docs/css/hugo-theme.css +0 -254
- data/docs/css/hybrid.css +0 -102
- data/docs/css/nucleus.css +0 -615
- data/docs/css/perfect-scrollbar.min.css +0 -2
- data/docs/css/tags.css +0 -49
- data/docs/css/theme-blue.css +0 -111
- data/docs/css/theme-green.css +0 -111
- data/docs/css/theme-red.css +0 -111
- data/docs/css/theme.css +0 -1136
- data/docs/development/changelog/index.html +0 -1420
- data/docs/development/code_of_conduct/index.html +0 -1222
- data/docs/development/contributing/index.html +0 -1201
- data/docs/development/index.html +0 -1140
- data/docs/development/index.xml +0 -40
- data/docs/development/license/index.html +0 -1165
- data/docs/fonts/Inconsolata.eot +0 -0
- data/docs/fonts/Inconsolata.svg +0 -1
- data/docs/fonts/Inconsolata.ttf +0 -0
- data/docs/fonts/Inconsolata.woff +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.eot +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.svg +0 -1
- data/docs/fonts/Novecentosanswide-Normal-webfont.ttf +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.woff +0 -0
- data/docs/fonts/Novecentosanswide-Normal-webfont.woff2 +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.eot +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.svg +0 -1
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.ttf +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.woff +0 -0
- data/docs/fonts/Novecentosanswide-UltraLight-webfont.woff2 +0 -0
- data/docs/fonts/Work_Sans_200.eot +0 -0
- data/docs/fonts/Work_Sans_200.svg +0 -1
- data/docs/fonts/Work_Sans_200.ttf +0 -0
- data/docs/fonts/Work_Sans_200.woff +0 -0
- data/docs/fonts/Work_Sans_200.woff2 +0 -0
- data/docs/fonts/Work_Sans_300.eot +0 -0
- data/docs/fonts/Work_Sans_300.svg +0 -1
- data/docs/fonts/Work_Sans_300.ttf +0 -0
- data/docs/fonts/Work_Sans_300.woff +0 -0
- data/docs/fonts/Work_Sans_300.woff2 +0 -0
- data/docs/fonts/Work_Sans_500.eot +0 -0
- data/docs/fonts/Work_Sans_500.svg +0 -1
- data/docs/fonts/Work_Sans_500.ttf +0 -0
- data/docs/fonts/Work_Sans_500.woff +0 -0
- data/docs/fonts/Work_Sans_500.woff2 +0 -0
- data/docs/images/clippy.svg +0 -1
- data/docs/images/favicon.png +0 -0
- data/docs/images/gopher-404.jpg +0 -0
- data/docs/imported/changelog/index.html +0 -1449
- data/docs/imported/index.html +0 -1191
- data/docs/imported/index.xml +0 -23
- data/docs/index.html +0 -1138
- data/docs/index.json +0 -183
- data/docs/index.xml +0 -138
- data/docs/js/auto-complete.js +0 -3
- data/docs/js/clipboard.min.js +0 -7
- data/docs/js/featherlight.min.js +0 -9
- data/docs/js/highlight.pack.js +0 -6
- data/docs/js/html5shiv-printshiv.min.js +0 -4
- data/docs/js/hugo-learn.js +0 -94
- data/docs/js/jquery-3.3.1.min.js +0 -2
- data/docs/js/jquery.sticky.js +0 -288
- data/docs/js/learn.js +0 -459
- data/docs/js/lunr.min.js +0 -6
- data/docs/js/modernizr.custom-3.6.0.js +0 -3
- data/docs/js/perfect-scrollbar.jquery.min.js +0 -2
- data/docs/js/perfect-scrollbar.min.js +0 -2
- data/docs/js/search.js +0 -93
- data/docs/mermaid/mermaid.css +0 -277
- data/docs/mermaid/mermaid.dark.css +0 -278
- data/docs/mermaid/mermaid.forest.css +0 -356
- data/docs/mermaid/mermaid.js +0 -8
- data/docs/quick_reference/index.html +0 -1246
- data/docs/quick_reference/index.xml +0 -12
- data/docs/sitemap.xml +0 -81
- data/docs/tags/index.html +0 -1146
- data/docs/tags/index.xml +0 -11
- data/docs/tutorial/10-getting_started/index.html +0 -1174
- data/docs/tutorial/20-project_layout/index.html +0 -1299
- data/docs/tutorial/30-your_first_command/index.html +0 -1263
- data/docs/tutorial/40-options_parameters_and_arguments/index.html +0 -1384
- data/docs/tutorial/50-publishing/index.html +0 -1187
- data/docs/tutorial/index.html +0 -1140
- data/docs/tutorial/index.xml +0 -47
- data/docs/webfonts/fa-brands-400.eot +0 -0
- data/docs/webfonts/fa-brands-400.svg +0 -1
- data/docs/webfonts/fa-brands-400.ttf +0 -0
- data/docs/webfonts/fa-brands-400.woff +0 -0
- data/docs/webfonts/fa-brands-400.woff2 +0 -0
- data/docs/webfonts/fa-regular-400.eot +0 -0
- data/docs/webfonts/fa-regular-400.svg +0 -1
- data/docs/webfonts/fa-regular-400.ttf +0 -0
- data/docs/webfonts/fa-regular-400.woff +0 -0
- data/docs/webfonts/fa-regular-400.woff2 +0 -0
- data/docs/webfonts/fa-solid-900.eot +0 -0
- data/docs/webfonts/fa-solid-900.svg +0 -1
- data/docs/webfonts/fa-solid-900.ttf +0 -0
- data/docs/webfonts/fa-solid-900.woff +0 -0
- data/docs/webfonts/fa-solid-900.woff2 +0 -0
- data/docs/whoami/index.html +0 -1155
- data/docs/whoami/index.xml +0 -12
- data/docs-src/archetypes/default.md +0 -6
- data/docs-src/config.toml +0 -37
- data/docs-src/content/_index.md +0 -40
- data/docs-src/content/advanced/_index.md +0 -11
- data/docs-src/content/advanced/automatic_updates.md +0 -46
- data/docs-src/content/advanced/command_types.md +0 -148
- data/docs-src/content/advanced/distributed_state_locking.md +0 -37
- data/docs-src/content/advanced/hooks.md +0 -69
- data/docs-src/content/advanced/interactive_commands.md +0 -41
- data/docs-src/content/advanced/logging.md +0 -39
- data/docs-src/content/advanced/remote_execution.md +0 -60
- data/docs-src/content/advanced/state_storage.md +0 -120
- data/docs-src/content/advanced/user_config_files.md +0 -51
- data/docs-src/content/development/_index.md +0 -11
- data/docs-src/content/development/changelog.md +0 -199
- data/docs-src/content/development/code_of_conduct.md +0 -81
- data/docs-src/content/development/contributing.md +0 -88
- data/docs-src/content/development/license.md +0 -17
- data/docs-src/content/quick_reference/_index.md +0 -180
- data/docs-src/content/tutorial/10-getting_started.md +0 -47
- data/docs-src/content/tutorial/20-project_layout.md +0 -123
- data/docs-src/content/tutorial/30-your_first_command.md +0 -132
- data/docs-src/content/tutorial/40-options_parameters_and_arguments.md +0 -282
- data/docs-src/content/tutorial/50-publishing.md +0 -53
- data/docs-src/content/tutorial/_index.md +0 -11
- data/docs-src/content/whoami/_index.md +0 -34
- data/docs-src/layouts/partials/logo.html +0 -3
- data/docs-src/makesite.sh +0 -40
- data/docs-src/mkdocs-archived.tar.gz +0 -0
- data/docs-src/runsite.sh +0 -8
- data/docs-src/themes/hugo-theme-learn/.editorconfig +0 -16
- data/docs-src/themes/hugo-theme-learn/.gitignore +0 -3
- data/docs-src/themes/hugo-theme-learn/.grenrc.yml +0 -25
- data/docs-src/themes/hugo-theme-learn/CHANGELOG.md +0 -226
- data/docs-src/themes/hugo-theme-learn/LICENSE.md +0 -22
- data/docs-src/themes/hugo-theme-learn/README.md +0 -97
- data/docs-src/themes/hugo-theme-learn/archetypes/chapter.md +0 -13
- data/docs-src/themes/hugo-theme-learn/archetypes/default.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/LICENSE.md +0 -20
- data/docs-src/themes/hugo-theme-learn/exampleSite/config.toml +0 -102
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/_index.en.md +0 -41
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/_index.fr.md +0 -43
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.en.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.fr.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/_index.zh.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.en.md +0 -60
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/configuration/_index.fr.md +0 -56
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/_index.en.md +0 -102
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/_index.fr.md +0 -100
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/installation/images/chapter.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/_index.en.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/_index.fr.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/requirements/images/magic.gif +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/_index.en.md +0 -194
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/_index.fr.md +0 -194
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/blue-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/green-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/basics/style-customization/images/red-variant.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/_index.en.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/_index.fr.md +0 -12
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/archetypes.en.md +0 -57
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/archetypes.fr.md +0 -57
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/_index.en.md +0 -78
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/_index.fr.md +0 -78
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/i18n/images/i18n-menu.gif +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/icons.en.md +0 -41
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/markdown.en.md +0 -692
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/markdown.fr.md +0 -666
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/menushortcuts.en.md +0 -109
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/menushortcuts.fr.md +0 -109
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/_index.en.md +0 -166
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/_index.fr.md +0 -146
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/frontmatter-icon.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/pages-chapter.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/pages/images/pages-default.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/syntaxhighlight.en.md +0 -89
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/tags.en.md +0 -39
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/cont/tags.fr.md +0 -40
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/credits.en.md +0 -28
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/credits.fr.md +0 -28
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/_index.en.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/_index.fr.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/BachGavotteShort.mp3 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/Carroll_AliceAuPaysDesMerveilles.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/adivorciarsetoca00cape.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/hugo.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.files/movieselectricsheep-flock-244-32500-2.mp4 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.en.md +0 -85
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/BachGavotteShort.mp3 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/Carroll_AliceAuPaysDesMerveilles.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/adivorciarsetoca00cape.pdf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/hugo.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.files/movieselectricsheep-flock-244-32500-2.mp4 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/attachments.fr.md +0 -85
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/button.en.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/button.fr.md +0 -16
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/_index.en.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/_index.fr.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/_index.en.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/_index.fr.md +0 -11
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/test3.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-2/test3.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-3/_index.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-3/_index.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-4/_index.en.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/children-4/_index.fr.md +0 -7
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/test.en.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/children/test.fr.md +0 -6
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/expand.en.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/expand.fr.md +0 -45
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/mermaid.en.md +0 -283
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/mermaid.fr.md +0 -283
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/notice.en.md +0 -62
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/notice.fr.md +0 -62
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/siteparam.en.md +0 -23
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/shortcodes/siteparam.fr.md +0 -23
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.en.md +0 -13
- data/docs-src/themes/hugo-theme-learn/exampleSite/content/showcase.fr.md +0 -14
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/custom-footer.html +0 -10
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/logo.html +0 -39
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/partials/menu-footer.html +0 -14
- data/docs-src/themes/hugo-theme-learn/exampleSite/layouts/shortcodes/ghcontributors.html +0 -31
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/css/theme-mine.css +0 -104
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/fonts/monogramos-webfont.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/images/showcase/inteliver_docs.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/images/showcase/tat.png +0 -0
- data/docs-src/themes/hugo-theme-learn/exampleSite/static/images/showcase/tshark_dev.png +0 -0
- data/docs-src/themes/hugo-theme-learn/i18n/ar.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/de.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/en.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/es.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/fr.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/hi.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/id.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/ja.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/nl.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/pt.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/ru.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/tr.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/i18n/zh-cn.toml +0 -26
- data/docs-src/themes/hugo-theme-learn/images/screenshot.png +0 -0
- data/docs-src/themes/hugo-theme-learn/images/tn.png +0 -0
- data/docs-src/themes/hugo-theme-learn/layouts/404.html +0 -56
- data/docs-src/themes/hugo-theme-learn/layouts/_default/list.html +0 -22
- data/docs-src/themes/hugo-theme-learn/layouts/_default/single.html +0 -12
- data/docs-src/themes/hugo-theme-learn/layouts/index.html +0 -31
- data/docs-src/themes/hugo-theme-learn/layouts/index.json +0 -12
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-comments.html +0 -3
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-footer.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/partials/custom-header.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/partials/favicon.html +0 -1
- data/docs-src/themes/hugo-theme-learn/layouts/partials/footer.html +0 -77
- data/docs-src/themes/hugo-theme-learn/layouts/partials/header.html +0 -111
- data/docs-src/themes/hugo-theme-learn/layouts/partials/logo.html +0 -19
- data/docs-src/themes/hugo-theme-learn/layouts/partials/menu-footer.html +0 -1
- data/docs-src/themes/hugo-theme-learn/layouts/partials/menu.html +0 -151
- data/docs-src/themes/hugo-theme-learn/layouts/partials/meta.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/partials/search.html +0 -16
- data/docs-src/themes/hugo-theme-learn/layouts/partials/tags.html +0 -7
- data/docs-src/themes/hugo-theme-learn/layouts/partials/toc.html +0 -5
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/attachments.html +0 -36
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/button.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/children.html +0 -101
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/expand.html +0 -17
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/mermaid.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/notice.html +0 -2
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/ref.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/relref.html +0 -14
- data/docs-src/themes/hugo-theme-learn/layouts/shortcodes/siteparam.html +0 -7
- data/docs-src/themes/hugo-theme-learn/netlify.toml +0 -23
- data/docs-src/themes/hugo-theme-learn/static/css/atom-one-dark-reasonable.css +0 -77
- data/docs-src/themes/hugo-theme-learn/static/css/auto-complete.css +0 -47
- data/docs-src/themes/hugo-theme-learn/static/css/featherlight.min.css +0 -8
- data/docs-src/themes/hugo-theme-learn/static/css/fontawesome-all.min.css +0 -1
- data/docs-src/themes/hugo-theme-learn/static/css/hugo-theme.css +0 -254
- data/docs-src/themes/hugo-theme-learn/static/css/hybrid.css +0 -102
- data/docs-src/themes/hugo-theme-learn/static/css/nucleus.css +0 -615
- data/docs-src/themes/hugo-theme-learn/static/css/perfect-scrollbar.min.css +0 -2
- data/docs-src/themes/hugo-theme-learn/static/css/tags.css +0 -49
- data/docs-src/themes/hugo-theme-learn/static/css/theme-blue.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme-green.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme-red.css +0 -111
- data/docs-src/themes/hugo-theme-learn/static/css/theme.css +0 -1136
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Inconsolata.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-Normal-webfont.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Novecentosanswide-UltraLight-webfont.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_200.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_300.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/fonts/Work_Sans_500.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/images/clippy.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/images/favicon.png +0 -0
- data/docs-src/themes/hugo-theme-learn/static/images/gopher-404.jpg +0 -0
- data/docs-src/themes/hugo-theme-learn/static/js/auto-complete.js +0 -3
- data/docs-src/themes/hugo-theme-learn/static/js/clipboard.min.js +0 -7
- data/docs-src/themes/hugo-theme-learn/static/js/featherlight.min.js +0 -9
- data/docs-src/themes/hugo-theme-learn/static/js/highlight.pack.js +0 -6
- data/docs-src/themes/hugo-theme-learn/static/js/hugo-learn.js +0 -94
- data/docs-src/themes/hugo-theme-learn/static/js/jquery-3.3.1.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/jquery.sticky.js +0 -288
- data/docs-src/themes/hugo-theme-learn/static/js/learn.js +0 -459
- data/docs-src/themes/hugo-theme-learn/static/js/lunr.min.js +0 -6
- data/docs-src/themes/hugo-theme-learn/static/js/modernizr.custom-3.6.0.js +0 -3
- data/docs-src/themes/hugo-theme-learn/static/js/perfect-scrollbar.jquery.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/perfect-scrollbar.min.js +0 -2
- data/docs-src/themes/hugo-theme-learn/static/js/search.js +0 -93
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.css +0 -277
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.dark.css +0 -278
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.forest.css +0 -356
- data/docs-src/themes/hugo-theme-learn/static/mermaid/mermaid.js +0 -8
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-brands-400.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-regular-400.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.eot +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.svg +0 -1
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.ttf +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.woff +0 -0
- data/docs-src/themes/hugo-theme-learn/static/webfonts/fa-solid-900.woff2 +0 -0
- data/docs-src/themes/hugo-theme-learn/theme.toml +0 -21
- data/docs-src/themes/hugo-theme-learn/wercker.yml +0 -16
- data/lib/rbcli/configuration/configurate.rb +0 -85
- data/lib/rbcli/configuration/configurate_blocks/hooks.rb +0 -52
- data/lib/rbcli/configuration/configurate_blocks/me.rb +0 -122
- data/lib/rbcli/configuration/configurate_blocks/storage.rb +0 -50
- data/lib/rbcli/engine/command.rb +0 -251
- data/lib/rbcli/engine/load_project.rb +0 -45
- data/lib/rbcli/engine/parser.rb +0 -116
- data/lib/rbcli/features/autoupdate/common/autoupdate.rb +0 -50
- data/lib/rbcli/features/autoupdate/gem_updater.rb +0 -62
- data/lib/rbcli/features/autoupdate/github_updater.rb +0 -76
- data/lib/rbcli/features/logging.rb +0 -98
- data/lib/rbcli/features/remote_exec.rb +0 -187
- data/lib/rbcli/features/scriptwrapper.rb +0 -75
- data/lib/rbcli/features/userconfig.rb +0 -163
- data/lib/rbcli/state_storage/common/state_storage.rb +0 -138
- data/lib/rbcli/state_storage/localstate.rb +0 -77
- data/lib/rbcli/state_storage/placeholders.rb +0 -29
- data/lib/rbcli/state_storage/remote_state_connectors/dynamodb.rb +0 -272
- data/lib/rbcli/state_storage/remotestate_dynamodb.rb +0 -115
- data/lib/rbcli/util/msg.rb +0 -55
- data/lib/rbcli/util/string_colorize.rb +0 -45
- data/lib/rbcli-tool/generators.rb +0 -105
- data/lib/rbcli-tool/mdless_fix.rb +0 -406
- data/lib/rbcli-tool/project.rb +0 -120
- data/lib/rbcli-tool/util.rb +0 -70
- data/lib/rbcli-tool.rb +0 -37
- data/rbcli.gemspec +0 -73
- data/skeletons/micro/executable +0 -132
- data/skeletons/mini/executable +0 -247
- data/skeletons/project/.gitignore +0 -11
- data/skeletons/project/.rakeTasks +0 -7
- data/skeletons/project/.rbcli +0 -0
- data/skeletons/project/.rspec +0 -3
- data/skeletons/project/CODE_OF_CONDUCT.md +0 -74
- data/skeletons/project/Gemfile +0 -6
- data/skeletons/project/README.md +0 -46
- data/skeletons/project/Rakefile +0 -6
- data/skeletons/project/application/commands/command.erb +0 -28
- data/skeletons/project/application/commands/script.erb +0 -30
- data/skeletons/project/application/commands/scripts/script.sh +0 -60
- data/skeletons/project/application/options.rb +0 -34
- data/skeletons/project/config/autoupdate.rb +0 -35
- data/skeletons/project/config/general.rb +0 -17
- data/skeletons/project/config/logging.rb +0 -19
- data/skeletons/project/config/storage.rb +0 -35
- data/skeletons/project/config/userspace.rb +0 -33
- data/skeletons/project/config/version.rb +0 -3
- data/skeletons/project/exe/executable +0 -53
- data/skeletons/project/hooks/default_action.rb +0 -16
- data/skeletons/project/hooks/first_run.rb +0 -16
- data/skeletons/project/hooks/post_execution.rb +0 -14
- data/skeletons/project/hooks/pre_execution.rb +0 -14
- data/skeletons/project/lib/lib.erb +0 -9
- data/skeletons/project/spec/spec_helper.rb +0 -14
- data/skeletons/project/spec/untitled_spec.rb +0 -9
- data/skeletons/project/untitled.gemspec +0 -40
- data/skeletons/project/userconf/user_defaults.yml +0 -6
- /data/{docs-src/.hugo_build.lock → lib/rbcli/plugins/.keep} +0 -0
data/docs/index.json
DELETED
@@ -1,183 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"uri": "https://akhoury6.github.io/rbcli/quick_reference/",
|
4
|
-
"title": "Quick Reference",
|
5
|
-
"tags": [],
|
6
|
-
"description": "",
|
7
|
-
"content": "Installation RBCli is available on rubygems.org. You can add it to your application\u0026rsquo;s Gemfile or gemspec, or install it manually by running:\ngem install rbcli Then, cd to the folder you\u0026rsquo;d like to create your project under and run:\nrbcli init -n mytool -d \u0026#34;A simple CLI tool\u0026#34; Or, for a single-file tool without any folder/gem tructure, run rbcli init -t mini -n \u0026lt;projectname\u0026gt; or rbcli init -t micro -n \u0026lt;projectname\u0026gt;.\nCreating a command There are three types of commands: standard, scripted, and external.\nStandard commands let you code the command directly in Ruby Scripted commands provide you with a bash script, where all of the parsed information (params, options, args, and config) is shared External commands let you wrap 3rd party applications directly Standard Commands To create a new command called foo, run:\nrbcli command -n foo You will now find the command code in application/commands/list.rb. Edit the action block to write your coode.\nScripted Commands To create a new scripted command called bar, run:\nrbcli script -n bar You will then find two new files:\nThe command declaration under application/commands/bar.rb The script code under application/commands/scripts/bar.sh Edit the script to write your code.\nExternal Commands To create a new external command called baz, run:\nrbcli extern -n baz You will then find the command code in application/commands/baz.rb.\nUse one of the two provided modes \u0026ndash; direct path mode or variable path mode \u0026ndash; to provide the path to the external program.\nHooks RBCli has several hooks that run at different points in the exectution chain. They can be created via the rbcli command line tool:\nrbcli hook --default # Runs when no command is provided rbcli hook --pre # Runs before any command rbcli hook --post # Runs after any command rbcli hook --firstrun # Runs the first time a user runs your application. Requires userspace config. rbcli hook -dpof # Create all hooks at once Storage RBCli supports both local and remote state storage. This is done by synchronizing a Hash with either the local disk or a remote database.\nLocal State RBCli can provide you with a unique hash that can be persisted to disk on any change to a top-level value.\nEnable local state in config/storage.rb.\nThen access it in your Standard Commands with Rbcli.local_state[:yourkeyhere].\nRemote State Similar to the Local State above, RBCli can provide you with a unique hash that can be persisted to a remote storage location.\nCurrently only AWS DynamoDB is supported, and credentials will be required for each user.\nEnable remote state in config/storage.rb.\nThen access it in your Standard Commands with Rbcli.remote_state[:yourkeyhere].\nUserspace Configuration Files RBCli provides an easy mechanism to generate and read configuration files from your users. You set the default values and help text with the defaults chain, and leverage the user chain to read them.\nYou can set defaults either by placing a YAML file in the userconf/ folder or by specifying individual options in application/options.rb (global) or application/command/*.rb (command-specific).\nUsers can generate a config file, complete with help text, by running your tool with the --generate-config option.\nLogging RBCli\u0026rsquo;s logger is configured in config/logging.rb.\nlog_level :info log_target \u0026#39;stderr\u0026#39; Then it can be accessed when writing your commands via:\nRbcli::log.info { \u0026#39;These logs can go to STDERR, STDOUT, or a file\u0026#39; } The user will also be able to change the log level and target via their config file, if it is enabled.\nAutomatic Update Check RBCli can automatically notify users when an update is available. Two sources are currently supported: Github (including Enterprise) and RubyGems.\nYou can configure automatic updates in config/autoupdate.rb in your project.\nRemote Execution RBCli can automatically execute script and extern commands on remote machines via SSH. Enable this feature in config/general.rb by changing the following line to true:\nremote_execution permitted: false Then for each command you want to enable remote execution for, add the following directive:\nremote_permitted Users can then execute commands remotly by specifying the connection string and credentials on the command line:\nmytool --remote-exec [user@]host[:port] --identity (/path/to/private/ssh/key or password) \u0026lt;command\u0026gt; ... Development and Contributing For more information about development and contributing, please see the Official Development Documentation\nLicense The gem is available as open source under the terms of the GPLv3.\nFull Documentation You can find the Official Documentation for RBCli Here.\n"
|
8
|
-
},
|
9
|
-
{
|
10
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/",
|
11
|
-
"title": "Tutorial",
|
12
|
-
"tags": [],
|
13
|
-
"description": "",
|
14
|
-
"content": "Tutorial Get yourself started with RBCli. This section alone won\u0026rsquo;t make you a Ninja, but you\u0026rsquo;ll be able to cut a tool from scratch pretty quickly.\n"
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"uri": "https://akhoury6.github.io/rbcli/development/contributing/",
|
18
|
-
"title": "Contribution Guide",
|
19
|
-
"tags": [],
|
20
|
-
"description": "",
|
21
|
-
"content": "Contributing to RBCli is the same as most open source projects:\nFork the repository Create your own branch Submit a pull request when ready That\u0026rsquo;s all there is to it! We\u0026rsquo;ve also kept our acceptance criteria pretty simple, as you\u0026rsquo;ll see below. Feel free to submit a pull request even if you don\u0026rsquo;t meet it if you would like your code or feature to be reviewed first; we do want to be mindful of your time and will review submissions before they are polished.\nDevelpment Mode To allow for easy deveopment, Rbcli has a development mode which allows a project to include rbcli from a local folder instead of the default gem path. To use it, add the following to your shell\u0026rsquo;s profile (typically ~/.bash_profile or ~/.profile):\nexport RBCLI_ENV=\u0026#39;development\u0026#39; export RBCLI_DEVPATH=\u0026#39;/path/to/rbcli/lib/rbcli\u0026#39; alias rbcli=\u0026#39;/path/to/rbcli/exe/rbcli\u0026#39; Code Acceptance Criteria Tabs, Not Spaces Please, and thanks. We all like to use different indentation levels and styles, and this will keep us consistent between editors.\nFor filetypes where tabs are not supported (such as YAML), please stick to using two (2) spaces.\nDocumentation for User Features For any modification that alters the way RBCli is used \u0026ndash; we\u0026rsquo;re talking additional features, options, keyword changes, major behavioral changes, and the like \u0026ndash; the documentation will need to be updated as well. You\u0026rsquo;ll be happy to know we designed it to make the process relatively painless.\nRBCli\u0026rsquo;s documentation is essentially a collection of markdown files that have been compiled into a static site using MkDocs. If you already have python and pip on your system, you can install it by running:\npip install mkdocs mkdocs-material You can find the source markdown files in the docs-src/docs folder, and the menu organization in docs-src/mkdocs.yml. To preview your changes on a live site, run:\nmkdocs serve Also, don\u0026rsquo;t forget to update the Quick Reference Guide in the README.md file (the main project one) with information about your changes.\nOnce you\u0026rsquo;ve completed your edits, run the makesite.sh command to build the actual HTML pages automatically in the docs folder, from where they will be served when live.\nDeprecations If a feature needs to be deprecated, RBCli has a built-in deprecation message feature. You can leverage it by calling the following code when a deprecated command is called:\nRbcli::DeprecationWarning.new deprecated_command, message, version_when_code_will_be_removed So, for example:\nRbcli::DeprecationWarning.new \u0026#39;Rbcli::Configurate.me--first_run\u0026#39;, \u0026#39;Please use `RBCli::Configurate.hooks` as the parent block instead.\u0026#39;, \u0026#39;0.3.0\u0026#39; will display the following message to the user, in red, any any time the application is run:\nDEPRECATION WRNING: The feature `Rbcli::Configurate.me--post_hook` has been deprecated. Please use `RBCli::Configurate.hooks` as the parent block instead. This feature will be removed in version 0.3.0. Additionally, it will place the same line in the logs using Rbcli.logger.warn if logging is enabled.\nIf a deprecation warning has been added, please remember to mention it in the pull request so that others can update it later.\nMaintainer\u0026rsquo;s Notes To install this gem onto your local machine from source, run bundle exec rake install.\nTo release a new version, follow theese steps:\nUpdate the version number in version.rb Run bundle exec rake install, which will update gemfile.lock with the correct version and all dependency changes Run docs-src/makesite.sh, which re-compiles the documentation and pulls in the changelog and quick reference automatically Commit the above changes to master with a commit message of \u0026ldquo;vX.X.X\u0026rdquo; (where X.X.X is the version number), but do not push Run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org. "
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/10-getting_started/",
|
25
|
-
"title": "Getting Started",
|
26
|
-
"tags": [],
|
27
|
-
"description": "",
|
28
|
-
"content": "Welcome to the RBCli getting started tutorial! In this tutorial we\u0026rsquo;re going to cover the basics of RBCli and get a simple application up and running. It should take you between 30-60 minutes to complete, depending on your skill level with Ruby.\nAs you go throught the tutorial, you can either use the Next and Back buttons on the page to navigate, or use the menu directly.\nSupported Ruby Versions You\u0026rsquo;ll need Ruby installed before you can use RBCli. If you don\u0026rsquo;t know how to install it, we recommend using either rbenv (our favorite) or rvm.\nRBCli officially supports Ruby versions 2.5.0 and above. It may work on earlier releases even though we haven\u0026rsquo;t tested them. If you do try it find any bugs that break compatibility, feel free to submit a github issue or pull request.\nInstallation RBCli is available on rubygems.org. You can add it to your application\u0026rsquo;s Gemfile or gemspec, or install it manually by running:\ngem install rbcli Then, cd to the folder you\u0026rsquo;d like to create your project under and run:\nrbcli init -n mytool -d \u0026#34;A simple CLI tool\u0026#34; where mytool can be replaced with any other command name you\u0026rsquo;d like. You should then see some output about generating a bunch of files. Once it finishes, run:\ncd mytool ls -ahl Congratulations! This is the beginning of your first project.\nNext Steps Next, you will learn about the layout of an RBCli project and how to code with it.\n"
|
29
|
-
},
|
30
|
-
{
|
31
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/",
|
32
|
-
"title": "Advanced",
|
33
|
-
"tags": [],
|
34
|
-
"description": "",
|
35
|
-
"content": "Advanced Features This section describes the more advanced feature of RBCli. Mastering them will make you a CLI tool Ninja.\n"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"uri": "https://akhoury6.github.io/rbcli/development/license/",
|
39
|
-
"title": "License Info",
|
40
|
-
"tags": [],
|
41
|
-
"description": "",
|
42
|
-
"content": "How RBCli is Licensed We want to help the developer community build tooling faster and with less work. That\u0026rsquo;s why RBCli was built. And let\u0026rsquo;s face it - most of us aren\u0026rsquo;t lawyers, and don\u0026rsquo;t want to worry about legal fine print when building awesome software. That\u0026rsquo;s why RBCli is released under the GPLv3 License. So you\u0026rsquo;re free to use RBCli as you see fit to write free software. If you wish to use RBCli in a commercial offering, please contact me at andrew@blacknex.us.\nThe License You can view the offical license for RBCli Here.\nFor more details about the GPLv3 License, see Here.\n"
|
43
|
-
},
|
44
|
-
{
|
45
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/20-project_layout/",
|
46
|
-
"title": "The Project Layout",
|
47
|
-
"tags": [],
|
48
|
-
"description": "",
|
49
|
-
"content": "Now we will learn about what an RBCli project looks like and how to start using it.\nProject Initialization Types RBCli can initialize a tool in three different modes:\nProject Mode (default) Mini Mode Micro Mode Project Mode If you\u0026rsquo;ve been following along with the tutorial, you\u0026rsquo;ve already seen Project Mode. An RBCli Project consists of several folders, each of which has a specific function. The RBCli framework handles loading and parsing the code automatically. To generate a standard, full-featured RBCli project, run:\nrbcli init -n mytool where mytool can be replaced with any other command name you\u0026rsquo;d like. (We will continue using mytool in this tutorial though!)\nInside the newly created mytool folder you will see a bunch of files and folders related to your project. We will go over the structure later.\nMini \u0026amp; Micro Modes If you need to write a CLI tool but project mode feels a bit overkill for you \u0026ndash; if you think a single-file script is all that is needed \u0026ndash; that\u0026rsquo;s where the Mini and Micro modes come in. Instead of generating a full directory tree, you get only a single file that contains most of the functionality of RBCli. To use it, run:\nrbcli init -n mytool -t mini # or rbcli init -n mytool -t micro The only difference between the two is that mini will show you all available options and some documentation to help you, while micro is for advanced users who just want the samllest file possible.\nAs far as documentation goes, every piece of code present in those files is identical to Project mode so it should be pretty easy to navigate.\nProject Mode Structure An RBCli project has the following structure:\n\u0026lt;name\u0026gt;/ |--- application/ | |--- commands/ | | |--- scripts/ | |--- options.rb |--- config/ |--- exe/ | |--- \u0026lt;name\u0026gt; |--- hooks/ |--- lib/ | |--- \u0026lt;name\u0026gt;/ | |--- \u0026lt;name\u0026gt;.rb |--- spec/ |--- userconf/ |--- .gitignore |--- .rbcli |--- .rspec |--- CODE_OF_CONDUCT.md |--- Gemfile |--- README.md |--- Rakefile |--- \u0026lt;name\u0026gt;.gemspec Git, RubyGems, and rspec A few files aren\u0026rsquo;t part of RBCli itself, but are provided for your convenience. If you\u0026rsquo;re experienced in Ruby and Git you can skip over this.\n.gitignore Specifies which files to ignore in git. If you don\u0026rsquo;t use git you can delete this file .rspec Configures Rspec for testing your code Gemfile Allows declaring dependencies for when your users install your application Gemspec Same as above, but also lets you fill in more information so that you can publish your application as a gem README.md A skeleton README file that will appear as a front page documentation to your code in most source control systems (i.e. Github, Bitbucket) CODE_OF_CONDUCT.md Taken directly from the contributor covenant for your convenience Rakefile So you can run rspec tests as a rake task There is a lot of controvesy online regarding using the gemfile vs the gemspec. If you are new to Ruby in general then I suggest declaring your dependencies in the gemspec and leaving the gemfile as-is. This keeps things simple and allows publishing and distributing your tool as a gem.\nAdditionally, note that a git repo is not created automatically. Using git is out of scope of this tutorial, but you can find tutorials here.\nRBCli Folders application/ This is where the core of your application will live. You will define CLI options, commands, scripts, and hooks within this folder. config/ This folder contains the configuration for RBCli\u0026rsquo;s features; such as storage, logging, and automatic updates. exe/ This folder contains the executable for your tool. You should not edit it; doing so may lead to unexpected behavior. hooks/ RBCli has several hooks that can be used to run code at different times, such as the \u0026lsquo;default\u0026rsquo; code that is run when no command is selected. This is where they are placed. lib/ This folder is for you to write any additional code as you see fit, for importing into your commands, scripts, and hooks. It is automatically added to the $LOAD_PATH for you, so you can just use require statements like require 'abc.rb' without worrying about where they are located on the filesystem. userconf/ This folder is for you to place the layout and defaults of any userspace config file. Acceptable formats are yaml and json, though we recommend YAML since it is by far easier to read and supports comments. spec/ This folder is for your rspec tests. .rbcli This file is for internal use by RBCli. It should not be modified or deleted. Next Steps For the purposes of getting started right now, you don\u0026rsquo;t actually need to edit any of the defaults already present.\nWe just finished going through what an RBCli project looks like. Now let\u0026rsquo;s create our first application with it!\n"
|
50
|
-
},
|
51
|
-
{
|
52
|
-
"uri": "https://akhoury6.github.io/rbcli/development/",
|
53
|
-
"title": "Development",
|
54
|
-
"tags": [],
|
55
|
-
"description": "",
|
56
|
-
"content": "Development Want to make RBCli even better? On behalf of all RBCli users everywhere, it\u0026rsquo;s much appreciated. Of course, even if you keep your changes to yourself and don\u0026rsquo;t contribute back, now that you\u0026rsquo;re a ninja you\u0026rsquo;ll likely want to pave your own road forward. This section will guide you how.\n"
|
57
|
-
},
|
58
|
-
{
|
59
|
-
"uri": "https://akhoury6.github.io/rbcli/development/code_of_conduct/",
|
60
|
-
"title": "Code of Conduct",
|
61
|
-
"tags": [],
|
62
|
-
"description": "",
|
63
|
-
"content": "The Contributor Covenant Code of Conduct\nOur Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.\nOur Standards Examples of behavior that contributes to creating a positive environment include:\nUsing welcoming and inclusive language Being respectful of differing viewpoints and experiences Gracefully accepting constructive criticism Focusing on what is best for the community Showing empathy towards other community members Examples of unacceptable behavior by participants include:\nThe use of sexualized language or imagery and unwelcome sexual attention or advances Trolling, insulting/derogatory comments, and personal or political attacks Public or private harassment Publishing others\u0026rsquo; private information, such as a physical or electronic address, without explicit permission Other conduct which could reasonably be considered inappropriate in a professional setting Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.\nScope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.\nEnforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at andrew@blacknex.us. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.\nProject maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project\u0026rsquo;s leadership.\nAttribution This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4\n"
|
64
|
-
},
|
65
|
-
{
|
66
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/30-your_first_command/",
|
67
|
-
"title": "Your First Command",
|
68
|
-
"tags": [],
|
69
|
-
"description": "",
|
70
|
-
"content": "Creating the Command Creating the command is straightforward:\nrbcli command --name=list #or rbcli command -n list And there you have it! Now you can try out your command by typing:\n./exe/mytool list Congrats! You should now see a generic output listing the values of several variables. We\u0026rsquo;ll get into what they mean in a bit, but first, let\u0026rsquo;s make the tool\u0026rsquo;s execution a bit easier.\nNow that you know your way around a project, its time to create your first command! But before we do, let\u0026rsquo;s make development just a little bit easier. Go to the base directory of the folder and type:\nalias mytool=\u0026#34;$(pwd)/exe/mytool\u0026#34; And now you\u0026rsquo;ll be able to execute your application as if it was already installed as a gem, without worrying about the working path. You can see this in action by running your application again, but without the path:\nmytool list So, now let\u0026rsquo;s take a more in-dpeth look at what the command code looks like.\nThe Command Declaration As mentioned in the previous section, you can find your commands listed under the application/commands/ directory. Each command will appear as its own unique file with some base code to work from. Let\u0026rsquo;s take a look at that code a little more in-depth:\nclass List \u0026lt; Rbcli::Command # Declare a new command by subclassing Rbcli::Command description \u0026#39;TODO: Description goes here\u0026#39; # (Required) Short description for the global help usage \u0026lt;\u0026lt;-EOF TODO: Usage text goes here EOF # (Required) Long description for the command-specific help parameter :force, \u0026#39;Force testing\u0026#39;, type: :boolean, default: false, required: false # (Optional, Multiple) Add a command-specific CLI parameter. Can be called multiple times config_default :myopt2, description: \u0026#39;My Option #2\u0026#39;, default: \u0026#39;Default Value Here\u0026#39; # (Optional, Multiple) Specify an individual configuration parameter and set a default value. These will also be included in generated user config. # Alternatively, you can simply create a yaml file in the `default_user_configs` directory in your project that specifies the default values of all options action do |params, args, global_opts, config| # (Required) Block to execute if the command is called. Rbcli::log.info { \u0026#39;These logs can go to STDERR, STDOUT, or a file\u0026#39; } # Example log. Interface is identical to Ruby\u0026#39;s logger puts \u0026#34;\\nArgs:\\n#{args}\u0026#34; # Arguments that came after the command on the CLI (i.e.: `mytool test bar baz` will yield args=[\u0026#39;bar\u0026#39;, \u0026#39;baz\u0026#39;]) puts \u0026#34;Params:\\n#{params}\u0026#34; # Parameters, as described through the option statements above puts \u0026#34;Global opts:\\n#{global_opts}\u0026#34; # Global Parameters, as descirbed in the Configurate section puts \u0026#34;Config:\\n#{config}\u0026#34; # Config file values puts \u0026#34;LocalState:\\n#{Rbcli.local_state}\u0026#34; # Local persistent state storage (when available) -- if unsure use Rbcli.local_state.nil? puts \u0026#34;RemoteState:\\n#{Rbcli.remote_state}\u0026#34; # Remote persistent state storage (when available) -- if unsure use Rbcli.remote_state.nil? puts \u0026#34;\\nDone!!!\u0026#34; end end Commands are declared to RBCli simply by subclassing them from Rbcli::Command as shown above. Then, you have a list of declarations that tell RBCli information about it. They are:\ndescription A short description of the command, which will appear in the top-level help (when the user runs mytool -h). usage A description of how the command is meant to be used. This description can be as long as you want, and can be as in-depth as you\u0026rsquo;d like. It will show up as a long, multi-line description when the user runs the command-sepcific help (mytool list -h). parameter Command-line tags that the user can enter that are specific to only this command. We will get into these in the next section on Options, Parameters, and Arguments config_default This sets a single item in the config file that will be made available to the user. More information can be found in the documentation on User Config Files action This loads the block of code that will run when the command is called. It brings in all of the CLI and user config data as variables. We will also get into these in the next section Options, Parameters, and Arguments There is an additional declaration not shown here, extern. You can find more information on it in the section on Advanced Command Types\nCreating the \u0026ldquo;list\u0026rdquo; Command Now we\u0026rsquo;re going to modify this command to list the contents of the current directory to the terminal. So let\u0026rsquo;s change the code in that file to:\nclass List \u0026lt; Rbcli::Command description %q{List files in current directory} usage \u0026lt;\u0026lt;-EOF Ever wanted to see your files? Now you can! EOF action do |params, args, global_opts, config| filelist = [] # We store a list of the files in an array, including dotfiles if specified Dir.glob \u0026#34;./*\u0026#34; do |filename| outname = filename.split(\u0026#39;/\u0026#39;)[1] outname += \u0026#39;/\u0026#39; if File.directory? filename filelist.append outname end # Apply color filelist.map! do |filename| if File.directory? filename filename.light_blue elsif File.executable? filename filename.light_green else filename end end if global_opts[:color] puts filelist end end Go ahead and test it out! The output doesn\u0026rsquo;t show much obviously, just a list of names and nothing else. Don\u0026rsquo;t worry though, we\u0026rsquo;ll fix that in the next secion.\nNext Steps Next we\u0026rsquo;re going to take a look at options, parameters, and arguments, and we\u0026rsquo;ll clean up our list command by using them. If you\u0026rsquo;d like to learn more about the additional command types in RBCli before continuing, see the Advanced Command Types documentation.\n"
|
71
|
-
},
|
72
|
-
{
|
73
|
-
"uri": "https://akhoury6.github.io/rbcli/whoami/",
|
74
|
-
"title": "My Letter To You",
|
75
|
-
"tags": [],
|
76
|
-
"description": "",
|
77
|
-
"content": "My Fellow Coder,\nI\u0026rsquo;m glad to see you are interested in RBCli. I\u0026rsquo;d like to introduce myself. My name is Andrew, and I\u0026rsquo;ve been a technologist since 1992 when my father bought our first family computer \u0026ndash; a 486DX2 which ran at 66Mhz (33Mhz if you turned off the \u0026rsquo;turbo\u0026rsquo; button) and came with MS DOS 5.0, QBasic, and a game already coded in it called Nibbles (if you care to see the code, die 5 times and don\u0026rsquo;t play again). I didn\u0026rsquo;t like that the game forced my name to be \u0026ldquo;Sammy\u0026rdquo;, and thought, \u0026ldquo;hey, if I can see the code, can\u0026rsquo;t I change it?\u0026rdquo;. So I did what any annoyed child would do and learned to code so I could do just that. I\u0026rsquo;d tell you what I changed it to, but I was so proud of myself for this simple feat that I changed it every 30 seconds and couldn\u0026rsquo;t settle on just one name. Then I performed my first ever hack, and figured out how to go through walls without dying. All of a sudden the world seemed limitless.\nI was only a child at the time, but on that day I learned that every \u0026ldquo;rule\u0026rdquo; in computing was an artifical construct and could be changed to suit your needs. Thus began my career in tech and my obsession to change the world with it. This is why RBCli was born.\nRBCli started as a collection of code that I would copy-paste between projects, until one day when I wondered if I could just find a framework that suited me. I couldn\u0026rsquo;t - in case you hadn\u0026rsquo;t guessed - so I decided to build my own and give it to the world. I would not have accomplished even half of what I have without the open source community, and this is to be the first of hopefully many contributions back.\nThe features in RBCli have been chosen from over 25 years of experience writing applications, building features that 3rd parties left out, managing large scale infrastructure, designing embedded systems, integrating enterprise systems, automating CI/CD, scripting my own computers, and so much more. I hope that you can find as much use out of it as I have.\nIf you\u0026rsquo;d like to get in touch with me at any time, feel free to email me at akhoury@live.com.\nAll the best,\nAndrew\nP.S.: If you really liked RBCli and want to support it, any amount you can help out with goes a long way.\n"
|
78
|
-
},
|
79
|
-
{
|
80
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/40-options_parameters_and_arguments/",
|
81
|
-
"title": "Options, Parameters, and Arguments",
|
82
|
-
"tags": [],
|
83
|
-
"description": "",
|
84
|
-
"content": "If you\u0026rsquo;re already an experienced coder, you can jump to the last section of this document, the Simplified Reference (TLDR)\nCommand Line Structure In the previous section, you saw two parts of the RBCli command line structure - the executable followed by the command. However, RBCli is capable of more complex interaction. The structure is as follows:\ntoolname [options] command [parameters] argument1 argument2... Options are command line parameters such as -f, or --force. These are available globally to every command. You can create your own, though several are already built-in and reserved for RBCli: --config-file=\u0026lt;filename\u0026gt; allows specifying a config file location manually. --generate-config generates a config file for the user by writing out the defaults to a YAML file. This option will only appear if a config file has been set. The location is configurable, with more on that in the documentation on User Config Files). -v / --version shows the version. -h / --help shows the help. Command represents the subcommands that you will create, such as list, test, or apply. Parameters are the same as options, but only apply to the specific subcommand being executed. In this case only the -h / --help parameter is provided automatically. Arguments are strings that don\u0026rsquo;t begin with a \u0026lsquo;-\u0026rsquo;, and are passed to the command\u0026rsquo;s code as an array. These can be used as subcommands or additional parameters for your command. So a valid command could look something like these:\nmytool -n load --filename=foo.txt mytool parse foo.txt mytool show -l Note that all options and parameters will have both a short and long version of the parameter available for use.\nSo let\u0026rsquo;s take a look at how we define them.\nOptions You can find the options declarations under application/options.rb. You\u0026rsquo;ll see the example in the code:\noption :name, \u0026#39;Give me your name\u0026#39;, short: \u0026#39;n\u0026#39;, type: :string, default: \u0026#39;Jack\u0026#39;, required: false, permitted: [\u0026#39;Jack\u0026#39;, \u0026#39;Jill\u0026#39;] This won\u0026rsquo;t do for our tool, so let\u0026rsquo;s change it. Remember that these options will be applicable to all of our commands, so lets make it something appropriate:\noption :color, \u0026#39;Enable color output\u0026#39;, short: \u0026#39;c\u0026#39;, type: :boolean, default: false So now, let\u0026rsquo;s take advantage of this flag in our list command. Let\u0026rsquo;s change our block to:\naction do |params, args, global_opts, config| Dir.glob \u0026#34;./*\u0026#34; do |filename| outname = filename.split(\u0026#39;/\u0026#39;)[1] outname += \u0026#39;/\u0026#39; if File.directory? filename # We change the color based on the kind of file shown if global_opts[:color] if File.directory? filename outname = outname.light_blue elsif File.executable? filename outname = outname.light_green end end puts outname end end Notice how we referenced the value by using global_opts[:color]. It\u0026rsquo;s that simple. To see it in action, run:\nmytool -c list Parameters Parameters work the same way as options, but they are localized to only the selected command. They are declared - as you probably guessed by now - in the command\u0026rsquo;s class. So let\u0026rsquo;s add the following lines to our list command within the class declaration:\nparameter :sort, \u0026#39;Sort output alphabetically\u0026#39;, type: :boolean, default: false parameter :all, \u0026#39;Show hidden files\u0026#39;, type: :boolean, default: false parameter :directoriesfirst, \u0026#39;Show directories on top\u0026#39;, type: :boolean, default: false And let\u0026rsquo;s modify our action block to utilize them:\naction do |params, args, global_opts, config| filelist = [] # We include dotfiles if specified include_dotfiles = (params[:all]) ? File::FNM_DOTMATCH : 0 # We store a list of the files in an array, including dotfiles if specified Dir.glob \u0026#34;./*\u0026#34;, include_dotfiles do |filename| outname = filename.split(\u0026#39;/\u0026#39;)[1] outname += \u0026#39;/\u0026#39; if File.directory? filename filelist.append outname end # Sort alphabetically if specified filelist.sort! if params[:sort] # Put directories first if specified if params[:directoriesfirst] files = []; dirs = [] filelist.each do |filename| if File.directory? filename dirs.append(filename) else files.append(filename) end end filelist = dirs + files end # Apply color. We do this at the end now because color codes can alter the sorting. filelist.map! do |filename| if File.directory? filename filename.light_blue elsif File.executable? filename filename.light_green else filename end end if global_opts[:color] puts filelist end You should be able to run it now:\nmytool -c list -asd Note how the parameters come after the list command in the syntax above. As you create more commands, each will have its own unique set of parameters, while the options remain before the command and are available to all of them.\nUser Prompting There is an additional option when declaring parameters to prompt the user for a value if not entered on the command line. This can be done with the prompt: keyword. Let\u0026rsquo;s change one of our parameters to utilize it:\nparameter :sort, \u0026#39;Sort output alphabetically\u0026#39;, type: :boolean, default: false, prompt: \u0026#34;Sort output alphabetically?\u0026#34; Now, let\u0026rsquo;s run the tool while omitting the --sort parameter, as such:\nmytool -c list -ad This should give you the prompt:\nSort output alphabetically? (y/N): Because we set the parameter to default to false the default here is N, which is used if the user hits enter without entering a letter. If the default was set to true, then the Y would be capitalized and be the default.\nFor more information, see the documentation on Interactive Commands.\nArguments Lastly on the command line, there are arguments. Arguments are simply strings without the - character in front, and automatically get passed into an array in your applicaiton. Let\u0026rsquo;s take a look at how we can use them.\nUnlike options and parameters, arguments require no setup. So let\u0026rsquo;s assume that we want any arguments passed to the list command to be filenames that you want to display, and that you can pass multiple ones. Since arguments aren\u0026rsquo;t listed automatically by the help function, this is a good example of what to put in your usage text. Let\u0026rsquo;s take a look at what our class looks like now:\nclass List \u0026lt; Rbcli::Command description %q{List files in current directory} usage \u0026lt;\u0026lt;-EOF To list only specific files, you can enter filenames as arguments mytool list filename1 filename2... EOF parameter :sort, \u0026#39;Sort output alphabetically\u0026#39;, type: :boolean, default: false parameter :all, \u0026#39;Show hidden files\u0026#39;, type: :boolean, default: false parameter :directoriesfirst, \u0026#39;Show directories on top\u0026#39;, type: :boolean, default: false action do |params, args, global_opts, config| filelist = [] # We include dotfiles if specified include_dotfiles = (params[:all]) ? File::FNM_DOTMATCH : 0 # We store a list of the files in an array, including dotfiles if specified Dir.glob \u0026#34;./*\u0026#34;, include_dotfiles do |filename| outname = filename.split(\u0026#39;/\u0026#39;)[1] next unless args.include? outname if args.length \u0026gt; 0 outname += \u0026#39;/\u0026#39; if File.directory? filename filelist.append outname end # Sort alphabetically if specified filelist.sort! if params[:sort] # Put directories first if specified if params[:directoriesfirst] files = []; dirs = [] filelist.each do |filename| if File.directory? filename dirs.append(filename) else files.append(filename) end end filelist = dirs + files end # Apply color. We do this at the end because color codes can alter the sorting filelist.map! do |filename| if File.directory? filename filename.light_blue elsif File.executable? filename filename.light_green else filename end end if global_opts[:color] puts filelist end end Simplified Reference (TLDR) RBCli enforces a CLI structure of:\ntoolname [options] command [parameters] argument1 argument2... Options are declared in application/options.rb file.\nParameters are declared in the respective command\u0026rsquo;s class declaration.\nArguments don\u0026rsquo;t need to be declared, and are passed in as an array to your commands. It is helpful to describe the argument purpose in the usage text declaration so that the user can see what to do in the help.\nOptions and parameters both use the same format:\noption :\u0026lt;name\u0026gt;, \u0026#34;\u0026lt;description_string\u0026gt;\u0026#34;, short: \u0026#39;\u0026lt;character\u0026gt;\u0026#39;, type: \u0026lt;variable_type\u0026gt;, default: \u0026lt;default_value\u0026gt;, permitted: [\u0026lt;array_of_permitted_values] parameter :\u0026lt;name\u0026gt;, \u0026#34;\u0026lt;description_string\u0026gt;\u0026#34;, short: \u0026#39;\u0026lt;character\u0026gt;\u0026#39;, type: \u0026lt;variable_type\u0026gt;, default: \u0026lt;default_value\u0026gt;, permitted: [\u0026lt;array_of_permitted_values] name (Required) The long name of the option, as a symbol. This will be represented as --name on the command line description_string (Required) A short description of the command that will appear in the help text for the user type (Required) The following types are supported: :string, :boolean or :flag, :integer, and :float default (Optional) A default value for the option if one isn\u0026rsquo;t entered (default: nil) short (Optional) A letter that acts as a shortcut for the option. This will allow users to apply the command as -n To not have a short value, set this to :none (default: the first letter of the long name) required (Optional) Specify whether the option is required from the user (default: false) permitted (Optional) An array of whitelisted values for the option (default: nil) Next Steps Next, we\u0026rsquo;re going to take a quick look at how to publish and distribute your application, both publicly and within your organization.\n"
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"uri": "https://akhoury6.github.io/rbcli/tutorial/50-publishing/",
|
88
|
-
"title": "Publishing Your Application",
|
89
|
-
"tags": [],
|
90
|
-
"description": "",
|
91
|
-
"content": "RBCli creates projects designed to be easily distributed via either source control or as a gem. We\u0026rsquo;ll go over both methods.\nCommon Tasks Regardless of where you are publishing, certain tasks need to be accomplished. Namely, preparing the gemspec and the README.\nIn both files the items that need changing are pretty obvious \u0026ndash; you\u0026rsquo;ll need to fill out your name, email, etc, and replace the placeholder text in the README with something useful to your users.\nThen, for every release, you\u0026rsquo;ll need to update the version number in config/version.rb. This number is automatically used by the gemspec when versioning the gem in the system, and by RBCli when displaying help to the user and checking for automatic updates if you enable that feature (see Automatic Updates for more information).\nSource Control Distribution With Source Control distribution your users will be cloning the source code directly from your repository, and building and installing the gem locally. Thankfully, the process is pretty simple:\ngit clone \u0026lt;your_repo_here\u0026gt; gem build mytool.gemspec gem install mytool-*.gem Note that he README\u0026rsquo;s placeholder text has these commands already listed for your users, which you can leave as instructions.\nWhen using this method, we highly recommend using a git flow where you only merge to master when you are ready to release, this way your users don\u0026rsquo;t inadvertently download a buggy commit.\nRubygems.org Distribution If you\u0026rsquo;re distributing as a gem via Rubygems.org, you\u0026rsquo;ll need to follow a specific release process.\nUpdate the version number in config/version.rb Commit the change locally Run bundle exec rake release This will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.\nRecommended Platforms As far as RBCli is concerned, all Git hosts and gem platforms work equally well, and as long as the code reaches your users in one piece it\u0026rsquo;s all the same. That said, if you\u0026rsquo;d like to take advantage of automatic update notifications for your users, please see the documentation for Automatic Updates for a list of supported platforms for that feature.\nNext Steps Congratulations! You\u0026rsquo;ve completed the tutorial on RBCli and should be able to make all sorts of CLI applications and tools with what you learned. That said, there are still many features in RBCli that we didn\u0026rsquo;t explore, which you can find in the Advanced section of this site. If you aren\u0026rsquo;t sure where to start, we recommend looking at User Config Files and going from there.\n"
|
92
|
-
},
|
93
|
-
{
|
94
|
-
"uri": "https://akhoury6.github.io/rbcli/development/changelog/",
|
95
|
-
"title": "Changelog",
|
96
|
-
"tags": [],
|
97
|
-
"description": "",
|
98
|
-
"content": "0.3.3 (April 24, 2024) Improvements Tested with Ruby 3.3.0 Updated dependencies for Ruby 3.3.0 Updated dependnecies for Sekeleton projects Added a bundler/inline gemfile on mini and micro skeleton projects to simplify their use Replaced deprecated Trollop gem with its replacement, ManageIQ/Optimist Bugfixes Updated deprecated ERB call for skeleton generation to use new format 0.3.2 (October 28, 2023) Bugfixes Replaced several calls to the deprecated .exists? method with .exist? for compatibility with Ruby 3.2.0 Updated dependencies to latest versions Standardized on version locking to the latest Major version of dependencies rather than the latest Minor ones 0.3.1 (October 19, 2021) Bugfixes Fixed prompt for option value to ignore nil defaults instead of displaying an empty string Skeleton script command script.sh updated to function correctly when development mode is enabled Updated Github Pages links to point to github.io instead of github.com which are being deprecated Updated dependencies, closing the security hole of the gem addressable \u0026lt;= 1.7.0 0.3 (July 31, 2020) Improvements Deprecated Ruby code has been updated to be compatible with Ruby 2.7.x All depedencies have been updated to their latest versions and tested to ensure continued compatibility Old-style execution hooks have been fully deprecated in favor of declaring them in the Rbcli::Configurate.hooks block. To ensure compatibility, save your current hooks and generate new ones using the command rbcli hook Skeleton gemspec now includes spec.required_ruby_version, which matches Rbcli\u0026rsquo;s requirement Documentation updated to support latest Hugo and theme versions (Hugo 0.74.3 and hugo-theme-learn 2.5.0) Features Rbcli Deprecation Warnings now show the offending line of code to ease updating The $libdir global variable is defined by default in the skeleton project, allwoing easy access to the project\u0026rsquo;s lib folder 0.2.12 (July 29, 2019) Improvements The base project skeleton now includes an improved structure for the lib/ folder Documentation now uses Hugo instead of MkDocs for site generation. Updated dependencies in project skeleton to latest versions Features Development mode can be enabled by setting the environment variables: RBCLI_ENV=development and RBCLI_DEVPATH=[path to local Rbcli folder] to simplify changes to Rbcli during development. Combined with setting alias rbcli='/path/to/rbcli/exe/rbcli', gem installation is not required for development work 0.2.11 (Feb 27, 2019) Improvements Updated the dependent gem verions to use the latest available versions Bugfixes Fixed the nested triggers of the message I/O system 0.2.8 (Nov 7, 2018) Features Added a standardized message I/O system Improvements Enabled the safe usage of anchors in YAML config files Improved the method of determining the script name to be more portable across OS\u0026rsquo;es Bugfixes Fixed an error which caused RBCli to crash when using local_state Fixed a bug which caused the rbcli init command to occassionally fail for mini and micro projects Changes Changed the rbcli init helptext to match the order of complexity of projects (standard -\u0026gt; mini -\u0026gt; micro) 0.2.7 (Oct 17, 2018) Improvements Added a dev mode for scripts that allows using a local RBCli copy instead of requiring the gem to be installed Bugfixes Fixed a bug that caused the rbcli tool not to detect project folders correctly. Command parameter prompt: now works when required is set to true. Changes The rbcli init command now initializes into the current working directory instead of creating a new one. Fixed erroneous documentation about the \u0026lsquo;merge\u0026rsquo; setting on userspace config. 0.2.5 (Oct 8, 2018) Improvements Added a useful error message when local or remote state is used but not initialized. Bugfixes Fixed a bug in the Github Updater where RBCli crashed when a version tag was not present in the repo. Fixed a bug where deleting a state key would crash Rbcli Fixed a bug where remote state crashed with certain configurations 0.2.4 (Sep 4, 2018) This is a dummy release required to update the License in the Gemspec file. The license has not changed (GPLv3). 0.2.3 (Sep 4, 2018) Features Interactive Commands \u0026ndash; Prompt the user for parameters with a given value Improvements Added documentation on logging 0.2.2 (Aug 22, 2018) Features Bugfixes Fixed a bug that caused the logger\u0026rsquo;s target and level not to be configured properly via the Configurate block. Improvements Lazy-loading has been implemented in optional modules such as autoupdates, remote storage, etc. This means that if you do not enable them in the code, they will not be loaded into memory. This significantly improves loding times for applications. Abstraction system created for configuration. This has significantly simplified the existing codebase and makes future development easier. Deprecation warning system added. This allows for RBCli contributors to notify users of breaking changes that may impact their code. Folder structure has been simplified to ease development. Much of the code has been refactored. Deprecations/Changes The Rbcli module is now RBCli to better match the branding. The original Rbcli module will still work for this current release, with a warning, but future releases will require code changes. Hooks are now defined under the RBCli.Configurate.hooks block instead of RBCli.Configurate.me. The logger is now silent by default. To enable it, it must be configured either via the Configurate block or via the user\u0026rsquo;s config file. 0.2.1 (Aug 8, 2018) Features Remote Execution added for Script and External commands Bugfixes Fixed a bug that caused RBCli to crash if a direct path mode script\u0026rsquo;s environment variables were declared as symbols 0.2.0 (Aug 5, 2018) Features CLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer. Official documentation created and hosted with Github Pages RBCli released under GPLv3 Copyright/License notice displayed via RBCli tool with rbcli license in accordance with GPLv3 guidelines Bugfixes Fixed version number loading for projects Cleaned up command usage help output Fixed script and external command generation Improvements A quick reference guide can now be found in README.md Autoupdate feature now allows supplying a custom message Direct Path Mode for External Commands now Added support for a lib folder in projects, as a place for custom code, which is automatically added to $LOAD_PATH for developers Improved language regarding external commands: Documentation now differentiates between Standard, Scripted, and External Commands Improved language regarding user config files: Now called Userspace Config Options and Parameters now allow specifying the letter to be used for the short version, or to disable it altogether Userspace config can now be disabled by setting the path to nil or removing the declaration Deprecations/Changes Removed deprecated and broken examples from the examples folder "
|
99
|
-
},
|
100
|
-
{
|
101
|
-
"uri": "https://akhoury6.github.io/rbcli/",
|
102
|
-
"title": "",
|
103
|
-
"tags": [],
|
104
|
-
"description": "",
|
105
|
-
"content": "This is RBCli As technologists today, we work with the command line a lot. We script a lot. We write tools to share with each other to make our lives easier. We even write applications to make up for missing features in the 3rd party software that we buy. Unfortunately, when writing CLI tools, this process has typically been very painful. We\u0026rsquo;ve been working with low-level frameworks for decades; frameworks like getopt (1980) and curses (1977). They fit their purpose well; they were both computationally lightweight for the computers of the day, and they gave engineers full control and flexibility when it came to how things were built. Over the years, we\u0026rsquo;ve used them to settle on several design patterns that we know work well. Patterns as to what a CLI command looks like, what a config file looks like, what remote execution looks like, and even how to use locks (mutexes, semaphores, etc) to control application flow and data atomicity. Yet we\u0026rsquo;re stuck writing the same low-level code anytime we want to write our tooling. Not anymore.\nEnter RBCli. RBCli is a framework to quickly develop advanced command-line tools in Ruby. It has been written from the ground up with the needs of the modern technologist in mind, designed to make advanced CLI tool development as painless as possible. In RBCli, low-level code has been wrapped and/or replaced with higher-level methods. Much of the functionality has even been reduced to single methods: for example, it takes just one declaration to define, load, and generate a user\u0026rsquo;s config file at the appropriate times. Many other features are automated and require no work by the engineer. These make RBCli a fundamental re-thining of how we develop CLI tools, enabling the rapid development of applications for everyone from hobbyists to enterprises.\nSome of its key features include:\nSimple DSL Interface: To cut down on the amount of code that needs to be written, RBCli has a DSL that is designed to cut to the chase. This makes the work a lot less tedious.\nMultiple Levels of Parameters and Arguments: Forget about writing parsers for command-line options, or about having to differentiate between parameters and arguments. All of that work is taken care of.\nConfig File Generation: Easily piece together a default configuration even with declarations in different parts of the code. Then the user can generate their own configuration, and it gets stored in whatever location you\u0026rsquo;d like.\nMultiple Hooks and Entry Points: Define commands, pre-execution hooks, post-execution hooks, and first_run hooks to quickly and easily customize the flow of your application code.\nLogging: Keep track of all instances of your tool through logging. Logs can go to STDOUT, STDERR, or a given file, making them compatible with log aggregators such as Splunk, Logstash, and many others.\nLocal State Storage: Easily manage a set of data that persists between runs. You get access to a hash that is automatically kept in-sync with a file on disk.\nRemote State: It works just like Local State Storage, but store the data on a remote server! It can be used in tandem with Local State Storage or on its own. Currently supports AWS DyanmoDB.\nState Locking and Sharing: Share remote state safely between users with built-in locking! When enabled, it makes sure that only one user is accessing the data at any given time.\nAutomatic Update Notifications: Just provide the gem name or git repo, and RBCli will take care of notifying users!\nExternal Script Wrapping: High-level wrapping for Bash scripts, or any other applcication you\u0026rsquo;d like to wrap into a command.\nProject Structure and Generators: Create a well-defined project directory structure which organizes your code and allows you to package and distribute your application as a Gem. Generators can also help speed up the process of creating new commands, scripts, and hooks!\nRemote Execution: Automatically execute commands on remote machines via SSH\nInteractive Commands: Automatically prompt users for paramter values if not given on the command line. This pattern allows for easy user interaction while still allowing scripting without the use of expect.\nIf you\u0026rsquo;re just getting started with RBCli, take a look at the Tutorial. Or take a look at the Advanced menu to look through RBCli\u0026rsquo;s additional featureset.\n"
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/automatic_updates/",
|
109
|
-
"title": "Automatic Updates",
|
110
|
-
"tags": [],
|
111
|
-
"description": "",
|
112
|
-
"content": "RBCli can automatically notify users when an update is available. If force_update is set (see below), RBCli can halt execution until the user updates their application.\nTwo sources are currently supported: Github (including Enterprise) and RubyGems.\nGitHub Update Check The GitHub update check works best when paired with GitHub\u0026rsquo;s best practices on releases, where new releases are tagged on master with the format vX.X.X. See Github\u0026rsquo;s release documentation to learn more.\nRBCli will check your github repo\u0026rsquo;s tags and compare that version number with one specified in your application at config/version.rb.\nautoupdate github_repo: \u0026#39;\u0026lt;your_user\u0026gt;/\u0026lt;your_repo\u0026gt;\u0026#39;, access_token: nil, enterprise_hostname: nil, force_update: false, message: nil The github_repo should point to the repo using the user/repo syntax.\nThe access_token can be overridden by the user via their config file, so it can be left as nil if you enable Userspace Configuration. The token is not needed at all if using a public repo. For instructions on generating a new access token, see here.\nThe enterprise_hostname setting allows you to point RBCli at a local GitHub Enterprise server.\nSetting force_update: true will halt execution if an update is available, forcing the user to update.\nThe message parameter allows setting a custom message that will be displayed when an update is available. Leaving it as nil will use the default message provided by RBCli.\nRubygems.org Update Check The Rubygems update check will check if there is a new published version of the gem on Rubygems.org. The latest published version is compared to the version number you configured RBCli with.\nautoupdate gem: \u0026#39;\u0026lt;your_gem\u0026gt;\u0026#39;, force_update: false, message: nil The gem parameter should simply state the name of the gem.\nSetting force_update: true will halt execution if an update is available, forcing the user to update.\nThe message parameter allows setting a custom message that will be displayed when an update is available. Leaving it as nil will use the default message provided by RBCli.\n"
|
113
|
-
},
|
114
|
-
{
|
115
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/command_types/",
|
116
|
-
"title": "Command Types",
|
117
|
-
"tags": [],
|
118
|
-
"description": "",
|
119
|
-
"content": "RBCli has three different command types:\nStandard Commands (Ruby-based) Scripted Commands (Ruby+Bash based) External Commands (Wrapping a 3rd party application) This document is provided to be a reference. If you would like an in-depth tutorial, please see Your First Command.\nGeneral Command Structure Commands in RBCli are created by subclassing Rbcli::Command. All commands share a certain common structure:\nclass List \u0026lt; Rbcli::Command # Declare a new command by subclassing Rbcli::Command description \u0026#39;TODO: Description goes here\u0026#39; # (Required) Short description for the global help usage \u0026lt;\u0026lt;-EOF TODO: Usage text goes here EOF # (Required) Long description for the command-specific help parameter :force, \u0026#39;Force testing\u0026#39;, type: :boolean, default: false, required: false # (Optional, Multiple) Add a command-specific CLI parameter. Can be called multiple times config_default :myopt2, description: \u0026#39;My Option #2\u0026#39;, default: \u0026#39;Default Value Here\u0026#39; # (Optional, Multiple) Specify an individual configuration parameter and set a default value. These will also be included in generated user config. # Alternatively, you can simply create a yaml file in the `default_user_configs` directory in your project that specifies the default values of all options end description A short description of the command, which will appear in the top-level help (when the user runs mytool -h). usage A description of how the command is meant to be used. This description can be as long as you want, and can be as in-depth as you\u0026rsquo;d like. It will show up as a long, multi-line description when the user runs the command-sepcific help (mytool list -h). parameter Command-line tags that the user can enter that are specific to only this command. We will get into these in the next section on Options, Parameters, and Arguments config_default This sets a single item in the config file that will be made available to the user. More information can be found in the documentation on User Config Files Standard Commands Standard commands are written as ruby code. To create a standard command called list, run:\nrbcli command --name=list #or rbcli command -n list A standard command can be identified by the presence of an action block in the definition:\nclass List \u0026lt; Rbcli::Command action do |params, args, global_opts, config| # Code goes here end end Your application\u0026rsquo;s parameters, arguments, options, and config are available in the variables passed into the block. For more information on these, see Options, Parameters, and Arguments.\nScripted Commands Scripted commands are part Ruby, part Bash scripting. They are a good choice to use if you feel something might be easier or more performant to script with Bash, or if you already have a Bash script you\u0026rsquo;d like to use in your project. You can create one with:\nrbcli script -n list This will create two files in your RBCli project: a Ruby file with the common command declaration (see General Command Structure), and a bash script in the folder application/commands/scripts/.\nYou can tell a command is a script by the line:\nclass List \u0026lt; Rbcli::Command script end RBCli will pass along your applications config and CLI parameters through JSON environment variables. To make things easy, a Bash library is provided that makes retrieving and parsing these variables easy. It is already imported when you generate the command, with the line:\nsource $(echo $(cd \u0026#34;$(dirname $(gem which rbcli))/../lib-sh\u0026#34; \u0026amp;\u0026amp; pwd)/lib-rbcli.sh) This will find the library which is stored on the system as part of the RBCli gem.\nYou can then retrieve the values present in your variables like such:\nrbcli params rbcli args rbcli global_opts rbcli config rbcli myvars echo \u0026#34;Usage Examples:\u0026#34; echo \u0026#34;Log Level: $(rbcli config .logger.log_level)\u0026#34; echo \u0026#34;Log Target: $(rbcli config .logger.log_target)\u0026#34; echo \u0026#34;First Argument (if passed): $(rbcli args .[0])\u0026#34; For your convenience, the script will have all the instructions needed there. For more instructions on how to use JQ syntax to parse values, see the JQ documentation.\nExternal Commands External Commands are used to wrap 3rd party applications. RBCli accomplishes this by allowing you to set environment variables and command line parameters based on your input variables.\nRBCli provides this feature through the extern keyword. It provides two modes \u0026ndash; direct path and variable path \u0026ndash; which work similarly.\nDirect Path Mode Direct path mode is the simpler mode of the two External Command modes. It allows you to provide a specific command with environment variables set, though it does not allow using RBCli parameters, arguments, options, and config.\nclass List \u0026lt; Rbcli::Command extern path: \u0026#39;path/to/application\u0026#39;, envvars: {MYVAR: \u0026#39;some_value\u0026#39;} # (Required) Runs a given application, with optional environment variables, when the user runs the command. end Here, we supply a string to run the command. We can optioanlly provide environment variables which will be set for the external application.\nVariable Path Mode Variable Path mode works the same as Direct Path Mode, only instead of providing a string we provide a block that returns a string (which will be the command executed). This allows us to generate different commands based on the CLI parameters that the user passed, or pass configuration as CLI parameters to the external application:\nclass Test \u0026lt; Rbcli::Command extern envvars: {MY_OTHER_VAR: \u0026#39;another_value\u0026#39;} do |params, args, global_opts, config| # Alternate usage. Supplying a block instead of a path allows us to modify the command based on the arguments and configuration supplied by the user. This allows passing config settings as command line arguments to external applications. The block must return a string, which is the command to be executed. cmd = \u0026#39;/path/to/application\u0026#39; cmd += \u0026#39; --test-script foo --ignore-errors\u0026#39; if params[:force] cmd end end NOTE: Passing user-supplied data as part of the command string may be a security risk (example: /path/to/application --name #{params[:name]}). It is highly recommended to provide the fixed strings yourself, and only select which strings are used based on the variables provided. This is demonstrated in the example above.\n"
|
120
|
-
},
|
121
|
-
{
|
122
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/distributed_state_locking/",
|
123
|
-
"title": "Distributed State and Locking",
|
124
|
-
"tags": [],
|
125
|
-
"description": "",
|
126
|
-
"content": "Distributed Locking allows a Remote State to be shared among multiple users of the application to make writes appear atomic between sessions. To use it, simply set the locking: parameter to true when enabling remote state.\nThis is how locking works:\nThe application attempts to acquire a lock on the remote state when you first access it If the backend is locked by a different application, wait and try again If it succeeds, the lock is held and refreshed periodically When the application exits, the lock is released If the application does not refresh its lock, or fails to release it when it exits, the lock will automatically expire within 60 seconds If another application steals the lock (unlikely but possible), and the application tries to save data, a StandardError will be thrown You can manually attempt to lock/unlock by calling Rbcli.remote_state.lock or Rbcli.remote_state.unlock, respectively. Manual Locking Remember: all state in Rbcli is lazy-loaded. Therefore, RBCli wll only attempt to lock the data when you first try to access it. If you need to make sure that the data is locked before executing a block of code, use:\nRbcli.remote_state.refresh to force the lock and retrieve the latest data. You can force an unlock by calling:\nRbcli.remote_state.disconnect Even if you do not want to store any data, you can leverage manual locking to control access to a different shared resource, such as a stateful API. For example, if you write a cloud deployment toolkit, you can ensure that only one user is attempting to modify a deployment at any given time.\n"
|
127
|
-
},
|
128
|
-
{
|
129
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/hooks/",
|
130
|
-
"title": "Execution Hooks",
|
131
|
-
"tags": [],
|
132
|
-
"description": "",
|
133
|
-
"content": "RBCli provides you with hooks that can be used to have code execute at certain places in the execution chain. These hooks are optional, and do not have to be defined for your application to run.\nAll hooks will be created in the hooks/ folder in your project.\nThe Defailt Action Hook The Default hook is called when a user calls your application without providing a command. If the hook is not provided, the application will automatically display the help text (the same as running it with -h).\nTo create it in your project, run:\nrbcli hook --default # or rbcli hook -d You will then find the hook under hooks/default_action.rb.\nThe Pre-Execution Hook The Pre-Execution hook is called after the global command line options are parsed and before a command is executed.\nTo create it in your project, run:\nrbcli hook --pre # or rbcli hook -p You will then find the hook under hooks/pre_execution.rb.\nThe Post-Execution Hook The Pre-Execution hook is called after a command is executed.\nTo create it in your project, run:\nrbcli hook --post # or rbcli hook -o You will then find the hook under hooks/post_execution.rb.\nThe First-Run Hook The First-Run hook is called the first time a user executes your application. Using the first-run hook requires enabling Local State Storage for persistence.\nTo create it in your project, run:\nrbcli hook --firstrun # or rbcli hook -f You will then find the hook under hooks/first_run.rb.\n"
|
134
|
-
},
|
135
|
-
{
|
136
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/interactive_commands/",
|
137
|
-
"title": "Interactive Commands",
|
138
|
-
"tags": [],
|
139
|
-
"description": "",
|
140
|
-
"content": "Why interactive commands? When catering to an audience of users who are not accustomed to scripting, you may want to prompt them for the information directly (the typical CS-101 \u0026lsquo;puts\u0026rsquo; and \u0026lsquo;gets\u0026rsquo; pattern). This can be a lot more straightforward than having to read the help texts of your tool, and trying multiple times to enter all of the required data.\nOf course, we want to make sure that scripting with the tool still works well (headless interaction). We accomplish this by extending our parameters with a prompt option; RBCli will continue to accept the parameter as usual, but if the parameter is omitted then it will prompt the user with the given text.\nHow to do it with Rbcli There is an option when declaring a command\u0026rsquo;s parameters to prompt the user for a value if not entered on the command line. This can be done with the prompt: keyword. For example:\nclass Mycmd \u0026lt; Rbcli::Command parameter :sort, \u0026#39;Sort output alphabetically\u0026#39;, type: :boolean, default: false, prompt: \u0026#34;Sort output alphabetically?\u0026#34; action do |params, args, global_opts, config| puts params[:sort] end end Now, if we run the command while omitting the --sort parameter, as such:\nmytool mycmd That should give you the prompt:\nSort output alphabetically? (y/N): Because we set the parameter to default to false the default here is N, which is used if the user hits enter without entering a letter. If the default was set to true, then the Y would be capitalized and be the default.\nString parameters behave similarly, but default to the string defined instead of a boolean value.\n"
|
141
|
-
},
|
142
|
-
{
|
143
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/logging/",
|
144
|
-
"title": "Logging",
|
145
|
-
"tags": [],
|
146
|
-
"description": "",
|
147
|
-
"content": "Logging with RBCli is straightforward - it looks at the config file for logging settings, and instantiates a single, globally accessible Logger object. You can access it within a standard command like this:\nRbcli::log.info { \u0026#39;These logs can go to STDERR, STDOUT, or a file\u0026#39; } Enabling Logging To enable logging, simply set the default values in the config/logging.rb file:\nlog_level :info log_target \u0026#39;stderr\u0026#39; log_level You can set the default log level using either numeric or standard Ruby logger levels: 0-5, or DEBUG \u0026lt; INFO \u0026lt; WARN \u0026lt; ERROR \u0026lt; FATAL \u0026lt; UNKNOWN log_target This specifies where the logs will be placed. Valid values are nil (disables logging), \u0026lsquo;STDOUT\u0026rsquo;, \u0026lsquo;STDERR\u0026rsquo;, or a file path (all as strings). Userspace Config Overrides If Userspace Configuration is enabled, these options will also be present in the user\u0026rsquo;s config file to override defaults:\n# Log Settings logger: log_level: warn # 0-5, or DEBUG \u0026lt; INFO \u0026lt; WARN \u0026lt; ERROR \u0026lt; FATAL \u0026lt; UNKNOWN log_target: stderr # STDOUT, STDERR, or a file path "
|
148
|
-
},
|
149
|
-
{
|
150
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/remote_execution/",
|
151
|
-
"title": "Remote Execution",
|
152
|
-
"tags": [],
|
153
|
-
"description": "",
|
154
|
-
"content": "RBCli can be configured to execute commands on a remote machine via SSH instead of locally.\nCurrently, only script and extern commands are supported.\nConfiguration To allow remote execution, go to config/general.rb and change the following line to true:\nremote_execution permitted: false Then, for each command that you would like to enable remote execution for, add the following directive to the command class declaration:\nremote_permitted Usage Your end users can now execute a command remotely by specifying the connection string and credentials on the command line as follows:\nmytool --remote-exec [user@]host[:port] --identity (/path/to/private/ssh/key or password) \u0026lt;command\u0026gt; # or mytool -r [user@]host[:port] -i (/path/to/private/ssh/key or password) \u0026lt;command\u0026gt; Some valid examples are:\nmytool -r example.com -i myPassword showuserfiles -u MyUser mytool -r root@server.local -i ~/.ssh/id_rsa update mytool -r admin@172.16.0.1:2202 -i ~/.ssh/mykey cleartemp If the end user is unsure of which commands can or can not be executed remotely, they can check by running mytool -h. Commands that have remote execution enabled will have an asterisk (*) by their name:\n$ mytool -h A simple command line tool. For more information on individual commands, run `mytool \u0026lt;command\u0026gt; -h`. Usage: foo [options] command [parameters] Commands: bar TODO: Description goes here * baz TODO: Description goes here ... In this example, the command baz is available for remote execution\n"
|
155
|
-
},
|
156
|
-
{
|
157
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/state_storage/",
|
158
|
-
"title": "State Storage",
|
159
|
-
"tags": [],
|
160
|
-
"description": "",
|
161
|
-
"content": "RBCli supports both local and remote state storage. This is done by synchronizing a Hash with either the local disk or a remote database.\nLocal State RBCli\u0026rsquo;s local state storage gives you access to a hash that is automatically persisted to disk when changes are made.\nConfiguration You can configure it in config/storage.rb.\nlocal_state \u0026#39;/var/mytool/localstate\u0026#39;, force_creation: true, halt_on_error: true There are three parameters to configure it with:\nThe path as a string (self-explanatory) force_creation This will attempt to create the path and file if it does not exist (equivalent to an mkdir -p and touch in linux) halt_on_error RBCli\u0026rsquo;s default behavior is to raise an exception if the file can not be created, read, or updated at any point in time If this is set to false, RBCli will silence any errors pertaining to file access and will fall back to whatever data is available. Note that if this is enabled, changes made to the state may not be persisted to disk. If creation fails and file does not exist, you start with an empty hash If file exists but can\u0026rsquo;t be read, you will have an empty hash If file can be read but not written, the hash will be populated with the data. Writes will be stored in memory while the application is running, but will not be persisted to disk. Access and Usage Once configured you can access it with a standard hash syntax in your Standard Commands:\nRbcli.local_state[:yourkeyhere] The methods available for use at the top level are as follows:\nHash native methods:\n[] (Regular hash syntax. Keys are accessed via either symbols or strings indifferently.) []= (Assignment operator) delete each key? Additional methods:\ncommit Every assignment to the top level of the hash will result in a write to disk (for example: Rbcli.local_state[:yourkey] = 'foo'). However, if you are manipulating nested hashes, these saves will not be triggered. You can trigger them manually by calling commit. clear Resets the data back to an empty hash. refresh Loads the most current version of the data from the disk disconnect Removes the data from memory and sets Rbcli.local_state = nil. Data will be read from disk again on next access. Every assignment will result in a write to disk, so if an operation will require a large number of assignments/writes it should be performed to a different hash before beign assigned to this one.\nRemote State RBCli\u0026rsquo;s remote state storage gives you access to a hash that is automatically persisted to a remote storage location when changes are made. It has optional locking built-in, meaning that multiple users may share remote state without any data consistency issues.\nCurrently, this feature requires AWS DynamoDB, though other backend systems will be added in the future.\nConfiguration Before DynamoDB can be used, AWS API credentials have to be created and made available. RBCli will attempt to find credentials from the following locations in order:\nUser\u0026rsquo;s config file Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY User\u0026rsquo;s AWSCLI configuration at ~/.aws/credentials For more information about generating and storing AWS credentials, see Configuring the AWS SDK for Ruby. Please make sure that your users are aware that they will need to provide their own credentials to use this feature.\nYou can configure it in config/storage.rb.\nremote_state_dynamodb table_name: \u0026#39;mytable\u0026#39;, region: \u0026#39;us-east-1\u0026#39;, force_creation: true, halt_on_error: true, locking: false These are the parameters:\ntable_name The name of the DynamoDB table to use. region The AWS region that the database is located force_creation Creates the DynamoDB table if it does not already exist halt_on_error Similar to the way Local State works, setting this to false will silence any errors in connecting to the DynamoDB table. Instead, your application will simply have access to an empty hash that does not get persisted anywhere. This is good for use cases that involve using this storage as a cache, where a connection error might mean the feature doesn\u0026rsquo;t work but its not important enough to interrupt the user. locking Setting this to true enables locking, meaning only one instance of your application can access the shared data at any given time. For more information see Distributed State Locking. Access and Usage Once configured you can access it with a standard hash syntax:\nRbcli.remote_state[:yourkeyhere] This works the same way that Local State does, with the same performance caveats (try not to write too frequently).\nNote that all state in Rbcli is lazy-loaded, so no connections will be made until your code attempts to access the data even if the feature is enabled.\nFor more information on the available commands, see the documentation on Local State\n"
|
162
|
-
},
|
163
|
-
{
|
164
|
-
"uri": "https://akhoury6.github.io/rbcli/advanced/user_config_files/",
|
165
|
-
"title": "User Configuration Files",
|
166
|
-
"tags": [],
|
167
|
-
"description": "",
|
168
|
-
"content": "RBCli provides built-in support for creating and managing userspace configuration files. It does this through two chains: the defaults chain and the user chain.\nDefaults chain The defaults chain allows you to specify sane defaults for your CLI tool throughout your code. This gives you the ability to declare configuration alongside the code, and allows RBCli to generate a user config automatically given your defaults. There are two ways to set them:\nYAML Files You can store your defaults in one or more YAML files and RBCli will import and combine them. Note that when generating the user config, RBCli will use the YAML text as-is, so comments are transferred as well. This allows you to write descriptions for the options directly in the file that the user can see. This is good for tools with large or complex configuration that needs user documentation written inline These YAML files should be placed in the userconf/ directory in your project and they will automatically be loaded DSL Statements In the DSL, you can specify options individually by providing a name, description, and default value This is good for simpler configuration, as the descriptions provided are written out as comments in the generated user config You can put global configuration options in config/userspace.rb Command-specific confiugration can be placed in the command declarations in application/commands/*.rb DSL statements appear in both of the above locations as the following:\nconfig_default :name, description: \u0026#39;\u0026lt;description_help_text\u0026gt;\u0026#39;, default: \u0026#39;\u0026lt;default_value\u0026gt;\u0026#39; User chain The user chain has two functions: generating and loading configuration from a YAML file on the end user\u0026rsquo;s machine.\nRbcli will determine the correct location to locate the user configuration based on two factors:\nThe default location set in config/userspace.rb The location specified on the command line using the --config-file=\u0026lt;filename\u0026gt; option (overrides #1) To configure the default location, edit config/userspace.rb:\nconfig_userfile \u0026#39;~/.mytool\u0026#39;, merge_defaults: true, required: false path/to/config/file Self explanatory. Recommended locations are a dotfile in the user\u0026rsquo;s home directory, or a file under /etc such as /etc/mytool/userconf.yaml merge_defaults If set to true, default settings override user settings. If set to false, default settings are not loaded at all and the user is required to have all values specified in their config. required If set to true the application will not run if the file does not exist. A message will be displayed to the user to run your application with the --generate-config option to generate the file given your specified defaults. Users can generate configs by running yourclitool --generate-config. This will generate a config file at the tool\u0026rsquo;s default location specified in the DSL. This location can be overridden via the --config-file=\u0026lt;filename\u0026gt; option.\n"
|
169
|
-
},
|
170
|
-
{
|
171
|
-
"uri": "https://akhoury6.github.io/rbcli/categories/",
|
172
|
-
"title": "Categories",
|
173
|
-
"tags": [],
|
174
|
-
"description": "",
|
175
|
-
"content": ""
|
176
|
-
},
|
177
|
-
{
|
178
|
-
"uri": "https://akhoury6.github.io/rbcli/tags/",
|
179
|
-
"title": "Tags",
|
180
|
-
"tags": [],
|
181
|
-
"description": "",
|
182
|
-
"content": ""
|
183
|
-
}]
|
data/docs/index.xml
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
2
|
-
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
3
|
-
<channel>
|
4
|
-
<title>RBCli Documentation</title>
|
5
|
-
<link>https://akhoury6.github.io/rbcli/</link>
|
6
|
-
<description>Recent content on RBCli Documentation</description>
|
7
|
-
<generator>Hugo 0.125.1</generator>
|
8
|
-
<language>en-us</language>
|
9
|
-
<lastBuildDate>Thu, 20 Jun 2019 15:07:21 -0400</lastBuildDate>
|
10
|
-
<atom:link href="https://akhoury6.github.io/rbcli/index.xml" rel="self" type="application/rss+xml" />
|
11
|
-
<item>
|
12
|
-
<title>Contribution Guide</title>
|
13
|
-
<link>https://akhoury6.github.io/rbcli/development/contributing/</link>
|
14
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
15
|
-
<guid>https://akhoury6.github.io/rbcli/development/contributing/</guid>
|
16
|
-
<description>Contributing to RBCli is the same as most open source projects:
Fork the repository Create your own branch Submit a pull request when ready That&rsquo;s all there is to it! We&rsquo;ve also kept our acceptance criteria pretty simple, as you&rsquo;ll see below. Feel free to submit a pull request even if you don&rsquo;t meet it if you would like your code or feature to be reviewed first; we do want to be mindful of your time and will review submissions before they are polished.</description>
|
17
|
-
</item>
|
18
|
-
<item>
|
19
|
-
<title>Getting Started</title>
|
20
|
-
<link>https://akhoury6.github.io/rbcli/tutorial/10-getting_started/</link>
|
21
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
22
|
-
<guid>https://akhoury6.github.io/rbcli/tutorial/10-getting_started/</guid>
|
23
|
-
<description>Welcome to the RBCli getting started tutorial! In this tutorial we&rsquo;re going to cover the basics of RBCli and get a simple application up and running. It should take you between 30-60 minutes to complete, depending on your skill level with Ruby.
As you go throught the tutorial, you can either use the Next and Back buttons on the page to navigate, or use the menu directly.
Supported Ruby Versions You&rsquo;ll need Ruby installed before you can use RBCli.</description>
|
24
|
-
</item>
|
25
|
-
<item>
|
26
|
-
<title>License Info</title>
|
27
|
-
<link>https://akhoury6.github.io/rbcli/development/license/</link>
|
28
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
29
|
-
<guid>https://akhoury6.github.io/rbcli/development/license/</guid>
|
30
|
-
<description>How RBCli is Licensed We want to help the developer community build tooling faster and with less work. That&rsquo;s why RBCli was built. And let&rsquo;s face it - most of us aren&rsquo;t lawyers, and don&rsquo;t want to worry about legal fine print when building awesome software. That&rsquo;s why RBCli is released under the GPLv3 License. So you&rsquo;re free to use RBCli as you see fit to write free software. If you wish to use RBCli in a commercial offering, please contact me at andrew@blacknex.</description>
|
31
|
-
</item>
|
32
|
-
<item>
|
33
|
-
<title>The Project Layout</title>
|
34
|
-
<link>https://akhoury6.github.io/rbcli/tutorial/20-project_layout/</link>
|
35
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
36
|
-
<guid>https://akhoury6.github.io/rbcli/tutorial/20-project_layout/</guid>
|
37
|
-
<description>Now we will learn about what an RBCli project looks like and how to start using it.
Project Initialization Types RBCli can initialize a tool in three different modes:
Project Mode (default) Mini Mode Micro Mode Project Mode If you&rsquo;ve been following along with the tutorial, you&rsquo;ve already seen Project Mode. An RBCli Project consists of several folders, each of which has a specific function. The RBCli framework handles loading and parsing the code automatically.</description>
|
38
|
-
</item>
|
39
|
-
<item>
|
40
|
-
<title>Code of Conduct</title>
|
41
|
-
<link>https://akhoury6.github.io/rbcli/development/code_of_conduct/</link>
|
42
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
43
|
-
<guid>https://akhoury6.github.io/rbcli/development/code_of_conduct/</guid>
|
44
|
-
<description>The Contributor Covenant Code of Conduct
Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards Examples of behavior that contributes to creating a positive environment include:</description>
|
45
|
-
</item>
|
46
|
-
<item>
|
47
|
-
<title>Your First Command</title>
|
48
|
-
<link>https://akhoury6.github.io/rbcli/tutorial/30-your_first_command/</link>
|
49
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
50
|
-
<guid>https://akhoury6.github.io/rbcli/tutorial/30-your_first_command/</guid>
|
51
|
-
<description>Creating the Command Creating the command is straightforward:
rbcli command --name=list #or rbcli command -n list And there you have it! Now you can try out your command by typing:
./exe/mytool list Congrats! You should now see a generic output listing the values of several variables. We&rsquo;ll get into what they mean in a bit, but first, let&rsquo;s make the tool&rsquo;s execution a bit easier.
Now that you know your way around a project, its time to create your first command!</description>
|
52
|
-
</item>
|
53
|
-
<item>
|
54
|
-
<title>Options, Parameters, and Arguments</title>
|
55
|
-
<link>https://akhoury6.github.io/rbcli/tutorial/40-options_parameters_and_arguments/</link>
|
56
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
57
|
-
<guid>https://akhoury6.github.io/rbcli/tutorial/40-options_parameters_and_arguments/</guid>
|
58
|
-
<description>If you&rsquo;re already an experienced coder, you can jump to the last section of this document, the Simplified Reference (TLDR)
Command Line Structure In the previous section, you saw two parts of the RBCli command line structure - the executable followed by the command. However, RBCli is capable of more complex interaction. The structure is as follows:
toolname [options] command [parameters] argument1 argument2... Options are command line parameters such as -f, or --force.</description>
|
59
|
-
</item>
|
60
|
-
<item>
|
61
|
-
<title>Publishing Your Application</title>
|
62
|
-
<link>https://akhoury6.github.io/rbcli/tutorial/50-publishing/</link>
|
63
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
64
|
-
<guid>https://akhoury6.github.io/rbcli/tutorial/50-publishing/</guid>
|
65
|
-
<description>RBCli creates projects designed to be easily distributed via either source control or as a gem. We&rsquo;ll go over both methods.
Common Tasks Regardless of where you are publishing, certain tasks need to be accomplished. Namely, preparing the gemspec and the README.
In both files the items that need changing are pretty obvious &ndash; you&rsquo;ll need to fill out your name, email, etc, and replace the placeholder text in the README with something useful to your users.</description>
|
66
|
-
</item>
|
67
|
-
<item>
|
68
|
-
<title>Changelog</title>
|
69
|
-
<link>https://akhoury6.github.io/rbcli/development/changelog/</link>
|
70
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
71
|
-
<guid>https://akhoury6.github.io/rbcli/development/changelog/</guid>
|
72
|
-
<description>0.3.3 (April 24, 2024) Improvements Tested with Ruby 3.3.0 Updated dependencies for Ruby 3.3.0 Updated dependnecies for Sekeleton projects Added a bundler/inline gemfile on mini and micro skeleton projects to simplify their use Replaced deprecated Trollop gem with its replacement, ManageIQ/Optimist Bugfixes Updated deprecated ERB call for skeleton generation to use new format 0.3.2 (October 28, 2023) Bugfixes Replaced several calls to the deprecated .exists? method with .exist? for compatibility with Ruby 3.</description>
|
73
|
-
</item>
|
74
|
-
<item>
|
75
|
-
<title>Automatic Updates</title>
|
76
|
-
<link>https://akhoury6.github.io/rbcli/advanced/automatic_updates/</link>
|
77
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
78
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/automatic_updates/</guid>
|
79
|
-
<description>RBCli can automatically notify users when an update is available. If force_update is set (see below), RBCli can halt execution until the user updates their application.
Two sources are currently supported: Github (including Enterprise) and RubyGems.
GitHub Update Check The GitHub update check works best when paired with GitHub&rsquo;s best practices on releases, where new releases are tagged on master with the format vX.X.X. See Github&rsquo;s release documentation to learn more.</description>
|
80
|
-
</item>
|
81
|
-
<item>
|
82
|
-
<title>Command Types</title>
|
83
|
-
<link>https://akhoury6.github.io/rbcli/advanced/command_types/</link>
|
84
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
85
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/command_types/</guid>
|
86
|
-
<description>RBCli has three different command types:
Standard Commands (Ruby-based) Scripted Commands (Ruby+Bash based) External Commands (Wrapping a 3rd party application) This document is provided to be a reference. If you would like an in-depth tutorial, please see Your First Command.
General Command Structure Commands in RBCli are created by subclassing Rbcli::Command. All commands share a certain common structure:
class List &lt; Rbcli::Command # Declare a new command by subclassing Rbcli::Command description &#39;TODO: Description goes here&#39; # (Required) Short description for the global help usage &lt;&lt;-EOF TODO: Usage text goes here EOF # (Required) Long description for the command-specific help parameter :force, &#39;Force testing&#39;, type: :boolean, default: false, required: false # (Optional, Multiple) Add a command-specific CLI parameter.</description>
|
87
|
-
</item>
|
88
|
-
<item>
|
89
|
-
<title>Distributed State and Locking</title>
|
90
|
-
<link>https://akhoury6.github.io/rbcli/advanced/distributed_state_locking/</link>
|
91
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
92
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/distributed_state_locking/</guid>
|
93
|
-
<description>Distributed Locking allows a Remote State to be shared among multiple users of the application to make writes appear atomic between sessions. To use it, simply set the locking: parameter to true when enabling remote state.
This is how locking works:
The application attempts to acquire a lock on the remote state when you first access it If the backend is locked by a different application, wait and try again If it succeeds, the lock is held and refreshed periodically When the application exits, the lock is released If the application does not refresh its lock, or fails to release it when it exits, the lock will automatically expire within 60 seconds If another application steals the lock (unlikely but possible), and the application tries to save data, a StandardError will be thrown You can manually attempt to lock/unlock by calling Rbcli.</description>
|
94
|
-
</item>
|
95
|
-
<item>
|
96
|
-
<title>Execution Hooks</title>
|
97
|
-
<link>https://akhoury6.github.io/rbcli/advanced/hooks/</link>
|
98
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
99
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/hooks/</guid>
|
100
|
-
<description>RBCli provides you with hooks that can be used to have code execute at certain places in the execution chain. These hooks are optional, and do not have to be defined for your application to run.
All hooks will be created in the hooks/ folder in your project.
The Defailt Action Hook The Default hook is called when a user calls your application without providing a command. If the hook is not provided, the application will automatically display the help text (the same as running it with -h).</description>
|
101
|
-
</item>
|
102
|
-
<item>
|
103
|
-
<title>Interactive Commands</title>
|
104
|
-
<link>https://akhoury6.github.io/rbcli/advanced/interactive_commands/</link>
|
105
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
106
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/interactive_commands/</guid>
|
107
|
-
<description>Why interactive commands? When catering to an audience of users who are not accustomed to scripting, you may want to prompt them for the information directly (the typical CS-101 &lsquo;puts&rsquo; and &lsquo;gets&rsquo; pattern). This can be a lot more straightforward than having to read the help texts of your tool, and trying multiple times to enter all of the required data.
Of course, we want to make sure that scripting with the tool still works well (headless interaction).</description>
|
108
|
-
</item>
|
109
|
-
<item>
|
110
|
-
<title>Logging</title>
|
111
|
-
<link>https://akhoury6.github.io/rbcli/advanced/logging/</link>
|
112
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
113
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/logging/</guid>
|
114
|
-
<description>Logging with RBCli is straightforward - it looks at the config file for logging settings, and instantiates a single, globally accessible Logger object. You can access it within a standard command like this:
Rbcli::log.info { &#39;These logs can go to STDERR, STDOUT, or a file&#39; } Enabling Logging To enable logging, simply set the default values in the config/logging.rb file:
log_level :info log_target &#39;stderr&#39; log_level You can set the default log level using either numeric or standard Ruby logger levels: 0-5, or DEBUG &lt; INFO &lt; WARN &lt; ERROR &lt; FATAL &lt; UNKNOWN log_target This specifies where the logs will be placed.</description>
|
115
|
-
</item>
|
116
|
-
<item>
|
117
|
-
<title>Remote Execution</title>
|
118
|
-
<link>https://akhoury6.github.io/rbcli/advanced/remote_execution/</link>
|
119
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
120
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/remote_execution/</guid>
|
121
|
-
<description>RBCli can be configured to execute commands on a remote machine via SSH instead of locally.
Currently, only script and extern commands are supported.
Configuration To allow remote execution, go to config/general.rb and change the following line to true:
remote_execution permitted: false Then, for each command that you would like to enable remote execution for, add the following directive to the command class declaration:
remote_permitted Usage Your end users can now execute a command remotely by specifying the connection string and credentials on the command line as follows:</description>
|
122
|
-
</item>
|
123
|
-
<item>
|
124
|
-
<title>State Storage</title>
|
125
|
-
<link>https://akhoury6.github.io/rbcli/advanced/state_storage/</link>
|
126
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
127
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/state_storage/</guid>
|
128
|
-
<description>RBCli supports both local and remote state storage. This is done by synchronizing a Hash with either the local disk or a remote database.
Local State RBCli&rsquo;s local state storage gives you access to a hash that is automatically persisted to disk when changes are made.
Configuration You can configure it in config/storage.rb.
local_state &#39;/var/mytool/localstate&#39;, force_creation: true, halt_on_error: true There are three parameters to configure it with:
The path as a string (self-explanatory) force_creation This will attempt to create the path and file if it does not exist (equivalent to an mkdir -p and touch in linux) halt_on_error RBCli&rsquo;s default behavior is to raise an exception if the file can not be created, read, or updated at any point in time If this is set to false, RBCli will silence any errors pertaining to file access and will fall back to whatever data is available.</description>
|
129
|
-
</item>
|
130
|
-
<item>
|
131
|
-
<title>User Configuration Files</title>
|
132
|
-
<link>https://akhoury6.github.io/rbcli/advanced/user_config_files/</link>
|
133
|
-
<pubDate>Thu, 20 Jun 2019 15:07:21 -0400</pubDate>
|
134
|
-
<guid>https://akhoury6.github.io/rbcli/advanced/user_config_files/</guid>
|
135
|
-
<description>RBCli provides built-in support for creating and managing userspace configuration files. It does this through two chains: the defaults chain and the user chain.
Defaults chain The defaults chain allows you to specify sane defaults for your CLI tool throughout your code. This gives you the ability to declare configuration alongside the code, and allows RBCli to generate a user config automatically given your defaults. There are two ways to set them:</description>
|
136
|
-
</item>
|
137
|
-
</channel>
|
138
|
-
</rss>
|
data/docs/js/auto-complete.js
DELETED
@@ -1,3 +0,0 @@
|
|
1
|
-
// JavaScript autoComplete v1.0.4
|
2
|
-
// https://github.com/Pixabay/JavaScript-autoComplete
|
3
|
-
var autoComplete=function(){function e(e){function t(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function o(e,t,o){e.attachEvent?e.attachEvent("on"+t,o):e.addEventListener(t,o)}function s(e,t,o){e.detachEvent?e.detachEvent("on"+t,o):e.removeEventListener(t,o)}function n(e,s,n,l){o(l||document,s,function(o){for(var s,l=o.target||o.srcElement;l&&!(s=t(l,e));)l=l.parentElement;s&&n.call(l,o)})}if(document.querySelector){var l={selector:0,source:0,minChars:3,delay:150,offsetLeft:0,offsetTop:1,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" data-val="'+e+'">'+e.replace(o,"<b>$1</b>")+"</div>"},onSelect:function(){}};for(var c in e)e.hasOwnProperty(c)&&(l[c]=e[c]);for(var a="object"==typeof l.selector?[l.selector]:document.querySelectorAll(l.selector),u=0;u<a.length;u++){var i=a[u];i.sc=document.createElement("div"),i.sc.className="autocomplete-suggestions "+l.menuClass,i.autocompleteAttr=i.getAttribute("autocomplete"),i.setAttribute("autocomplete","off"),i.cache={},i.last_val="",i.updateSC=function(e,t){var o=i.getBoundingClientRect();if(i.sc.style.left=Math.round(o.left+(window.pageXOffset||document.documentElement.scrollLeft)+l.offsetLeft)+"px",i.sc.style.top=Math.round(o.bottom+(window.pageYOffset||document.documentElement.scrollTop)+l.offsetTop)+"px",i.sc.style.width=Math.round(o.right-o.left)+"px",!e&&(i.sc.style.display="block",i.sc.maxHeight||(i.sc.maxHeight=parseInt((window.getComputedStyle?getComputedStyle(i.sc,null):i.sc.currentStyle).maxHeight)),i.sc.suggestionHeight||(i.sc.suggestionHeight=i.sc.querySelector(".autocomplete-suggestion").offsetHeight),i.sc.suggestionHeight))if(t){var s=i.sc.scrollTop,n=t.getBoundingClientRect().top-i.sc.getBoundingClientRect().top;n+i.sc.suggestionHeight-i.sc.maxHeight>0?i.sc.scrollTop=n+i.sc.suggestionHeight+s-i.sc.maxHeight:0>n&&(i.sc.scrollTop=n+s)}else i.sc.scrollTop=0},o(window,"resize",i.updateSC),document.body.appendChild(i.sc),n("autocomplete-suggestion","mouseleave",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&setTimeout(function(){e.className=e.className.replace("selected","")},20)},i.sc),n("autocomplete-suggestion","mouseover",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&(e.className=e.className.replace("selected","")),this.className+=" selected"},i.sc),n("autocomplete-suggestion","mousedown",function(e){if(t(this,"autocomplete-suggestion")){var o=this.getAttribute("data-val");i.value=o,l.onSelect(e,o,this),i.sc.style.display="none"}},i.sc),i.blurHandler=function(){try{var e=document.querySelector(".autocomplete-suggestions:hover")}catch(t){var e=0}e?i!==document.activeElement&&setTimeout(function(){i.focus()},20):(i.last_val=i.value,i.sc.style.display="none",setTimeout(function(){i.sc.style.display="none"},350))},o(i,"blur",i.blurHandler);var r=function(e){var t=i.value;if(i.cache[t]=e,e.length&&t.length>=l.minChars){for(var o="",s=0;s<e.length;s++)o+=l.renderItem(e[s],t);i.sc.innerHTML=o,i.updateSC(0)}else i.sc.style.display="none"};i.keydownHandler=function(e){var t=window.event?e.keyCode:e.which;if((40==t||38==t)&&i.sc.innerHTML){var o,s=i.sc.querySelector(".autocomplete-suggestion.selected");return s?(o=40==t?s.nextSibling:s.previousSibling,o?(s.className=s.className.replace("selected",""),o.className+=" selected",i.value=o.getAttribute("data-val")):(s.className=s.className.replace("selected",""),i.value=i.last_val,o=0)):(o=40==t?i.sc.querySelector(".autocomplete-suggestion"):i.sc.childNodes[i.sc.childNodes.length-1],o.className+=" selected",i.value=o.getAttribute("data-val")),i.updateSC(0,o),!1}if(27==t)i.value=i.last_val,i.sc.style.display="none";else if(13==t||9==t){var s=i.sc.querySelector(".autocomplete-suggestion.selected");s&&"none"!=i.sc.style.display&&(l.onSelect(e,s.getAttribute("data-val"),s),setTimeout(function(){i.sc.style.display="none"},20))}},o(i,"keydown",i.keydownHandler),i.keyupHandler=function(e){var t=window.event?e.keyCode:e.which;if(!t||(35>t||t>40)&&13!=t&&27!=t){var o=i.value;if(o.length>=l.minChars){if(o!=i.last_val){if(i.last_val=o,clearTimeout(i.timer),l.cache){if(o in i.cache)return void r(i.cache[o]);for(var s=1;s<o.length-l.minChars;s++){var n=o.slice(0,o.length-s);if(n in i.cache&&!i.cache[n].length)return void r([])}}i.timer=setTimeout(function(){l.source(o,r)},l.delay)}}else i.last_val=o,i.sc.style.display="none"}},o(i,"keyup",i.keyupHandler),i.focusHandler=function(e){i.last_val="\n",i.keyupHandler(e)},l.minChars||o(i,"focus",i.focusHandler)}this.destroy=function(){for(var e=0;e<a.length;e++){var t=a[e];s(window,"resize",t.updateSC),s(t,"blur",t.blurHandler),s(t,"focus",t.focusHandler),s(t,"keydown",t.keydownHandler),s(t,"keyup",t.keyupHandler),t.autocompleteAttr?t.setAttribute("autocomplete",t.autocompleteAttr):t.removeAttribute("autocomplete"),document.body.removeChild(t.sc),t=null}}}}return e}();!function(){"function"==typeof define&&define.amd?define("autoComplete",function(){return autoComplete}):"undefined"!=typeof module&&module.exports?module.exports=autoComplete:window.autoComplete=autoComplete}();
|
data/docs/js/clipboard.min.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* clipboard.js v2.0.4
|
3
|
-
* https://zenorocha.github.io/clipboard.js
|
4
|
-
*
|
5
|
-
* Licensed MIT © Zeno Rocha
|
6
|
-
*/
|
7
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}t.exports=l},function(t,e,n){"use strict";var o,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])});
|
data/docs/js/featherlight.min.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Featherlight - ultra slim jQuery lightbox
|
3
|
-
* Version 1.7.13 - http://noelboss.github.io/featherlight/
|
4
|
-
*
|
5
|
-
* Copyright 2018, Noël Raoul Bossart (http://www.noelboss.com)
|
6
|
-
* MIT Licensed.
|
7
|
-
**/
|
8
|
-
// Modified by OZ -> https://github.com/noelboss/featherlight/issues/317
|
9
|
-
!function(u){"use strict";if(void 0!==u)if(u.fn.jquery.match(/-ajax/))"console"in window&&window.console.info("Featherlight needs regular jQuery, not the slim version.");else{var r=[],i=function(t){return r=u.grep(r,function(e){return e!==t&&0<e.$instance.closest("body").length})},o={allow:1,allowfullscreen:1,frameborder:1,height:1,longdesc:1,marginheight:1,marginwidth:1,mozallowfullscreen:1,name:1,referrerpolicy:1,sandbox:1,scrolling:1,src:1,srcdoc:1,style:1,webkitallowfullscreen:1,width:1},n={keyup:"onKeyUp",resize:"onResize"},a=function(e){u.each(c.opened().reverse(),function(){if(!e.isDefaultPrevented()&&!1===this[n[e.type]](e))return e.preventDefault(),e.stopPropagation(),!1})},s=function(e){if(e!==c._globalHandlerInstalled){c._globalHandlerInstalled=e;var t=u.map(n,function(e,t){return t+"."+c.prototype.namespace}).join(" ");u(window)[e?"on":"off"](t,a)}};c.prototype={constructor:c,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",persist:!1,otherClose:null,beforeOpen:u.noop,beforeContent:u.noop,beforeClose:u.noop,afterOpen:u.noop,afterContent:u.noop,afterClose:u.noop,onKeyUp:u.noop,onResize:u.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(e,t){"object"!=typeof e||e instanceof u!=!1||t||(t=e,e=void 0);var n=u.extend(this,t,{target:e}),r=n.resetCss?n.namespace+"-reset":n.namespace,i=u(n.background||['<div class="'+r+"-loading "+r+'">','<div class="'+r+'-content">','<button class="'+r+"-close-icon "+n.namespace+'-close" aria-label="Close">',n.closeIcon,"</button>",'<div class="'+n.namespace+'-inner">'+n.loading+"</div>","</div>","</div>"].join("")),o="."+n.namespace+"-close"+(n.otherClose?","+n.otherClose:"");return n.$instance=i.clone().addClass(n.variant),n.$instance.on(n.closeTrigger+"."+n.namespace,function(e){if(!e.isDefaultPrevented()){var t=u(e.target);("background"===n.closeOnClick&&t.is("."+n.namespace)||"anywhere"===n.closeOnClick||t.closest(o).length)&&(n.close(e),e.preventDefault())}}),this},getContent:function(){if(!1!==this.persist&&this.$content)return this.$content;var t=this,e=this.constructor.contentFilters,n=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},r=n(t.targetAttr),i=t.target||r||"",o=e[t.type];if(!o&&i in e&&(o=e[i],i=t.target&&r),i=i||n("href")||"",!o)for(var a in e)t[a]&&(o=e[a],i=t[a]);if(!o){var s=i;if(i=null,u.each(t.contentFilters,function(){return(o=e[this]).test&&(i=o.test(s)),!i&&o.regex&&s.match&&s.match(o.regex)&&(i=s),!i}),!i)return"console"in window&&window.console.error("Featherlight: no content filter found "+(s?' for "'+s+'"':" (no target specified)")),!1}return o.process.call(t,i)},setContent:function(e){return this.$instance.removeClass(this.namespace+"-loading"),this.$instance.toggleClass(this.namespace+"-iframe",e.is("iframe")),this.$instance.find("."+this.namespace+"-inner").not(e).slice(1).remove().end().replaceWith(u.contains(this.$instance[0],e[0])?"":e),this.$content=e.addClass(this.namespace+"-inner"),this},open:function(t){var n=this;if(n.$instance.hide().appendTo(n.root),!(t&&t.isDefaultPrevented()||!1===n.beforeOpen(t))){t&&t.preventDefault();var e=n.getContent();if(e)return r.push(n),s(!0),n.$instance.fadeIn(n.openSpeed),n.beforeContent(t),u.when(e).always(function(e){n.setContent(e),n.afterContent(t)}).then(n.$instance.promise()).done(function(){n.afterOpen(t)})}return n.$instance.detach(),u.Deferred().reject().promise()},close:function(e){var t=this,n=u.Deferred();return!1===t.beforeClose(e)?n.reject():(0===i(t).length&&s(!1),t.$instance.fadeOut(t.closeSpeed,function(){t.$instance.detach(),t.afterClose(e),n.resolve()})),n.promise()},resize:function(e,t){if(e&&t&&(this.$content.css("width","").css("height",""),this.$content.parent().width()<e||this.$content.parent().height()<t)){var n=Math.max(e/(this.$content.parent().width()-1),t/(this.$content.parent().height()-1));1<n&&(n=t/Math.floor(t/n),this.$content.css("width",e/n+"px").css("height",t/n+"px"))}},chainCallbacks:function(e){for(var t in e)this[t]=u.proxy(e[t],this,u.proxy(this[t],this))}},u.extend(c,{id:0,autoBind:"[data-featherlight]",defaults:c.prototype,contentFilters:{jquery:{regex:/^[#.]\w/,test:function(e){return e instanceof u&&e},process:function(e){return!1!==this.persist?u(e):u(e).clone(!0)}},image:{regex:/\.(png|jpg|jpeg|gif|tiff?|bmp|svg)(\?\S*)?$/i,process:function(e){var t=u.Deferred(),n=new Image,r=u('<img src="'+e+'" alt="" class="'+this.namespace+'-image" />');return n.onload=function(){r.naturalWidth=n.width,r.naturalHeight=n.height,t.resolve(r)},n.onerror=function(){t.reject(r)},n.src=e,t.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(e){return u(e)}},ajax:{regex:/./,process:function(e){var n=u.Deferred(),r=u("<div></div>").load(e,function(e,t){"error"!==t&&n.resolve(r.contents()),n.fail()});return n.promise()}},iframe:{process:function(e){var t=new u.Deferred,n=u("<iframe/>"),r=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var o=i.match(r);o&&(n[(o[1]+o[2].replace(/([A-Z])/g,"-$1")).toLowerCase()]=e[i])}return n}(this,"iframe"),i=function(e,t){var n={};for(var r in e)r in t&&(n[r]=e[r],delete e[r]);return n}(r,o);return n.hide().attr("src",e).attr(i).css(r).on("load",function(){t.resolve(n.show())}).appendTo(this.$instance.find("."+this.namespace+"-content")),t.promise()}},text:{process:function(e){return u("<div>",{text:e})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(e,t){var r=this,i=new RegExp("^data-"+t+"-(.*)"),o={};return e&&e.attributes&&u.each(e.attributes,function(){var e=this.name.match(i);if(e){var t=this.value,n=u.camelCase(e[1]);if(0<=u.inArray(n,r.functionAttributes))t=new Function(t);else try{t=JSON.parse(t)}catch(e){}o[n]=t}}),o},extend:function(e,t){var n=function(){this.constructor=e};return n.prototype=this.prototype,e.prototype=new n,e.__super__=this.prototype,u.extend(e,this,t),e.defaults=e.prototype,e},attach:function(i,o,a){var s=this;"object"!=typeof o||o instanceof u!=!1||a||(a=o,o=void 0);var c,e=(a=u.extend({},a)).namespace||s.defaults.namespace,l=u.extend({},s.defaults,s.readElementConfig(i[0],e),a),t=function(e){var t=u(e.currentTarget),n=u.extend({$source:i,$currentTarget:t},s.readElementConfig(i[0],l.namespace),s.readElementConfig(e.currentTarget,l.namespace),a),r=c||t.data("featherlight-persisted")||new s(o,n);"shared"===r.persist?c=r:!1!==r.persist&&t.data("featherlight-persisted",r),n.$currentTarget.blur&&n.$currentTarget.blur(),r.open(e)};return i.on(l.openTrigger+"."+l.namespace,l.filter,t),{filter:l.filter,handler:t}},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return i(),u.grep(r,function(e){return e instanceof t})},close:function(e){var t=this.current();if(t)return t.close(e)},_onReady:function(){var r=this;if(r.autoBind){var i=u(r.autoBind);i.each(function(){r.attach(u(this))}),u(document).on("click",r.autoBind,function(e){if(!e.isDefaultPrevented()){var t=u(e.currentTarget);if(i.length!==(i=i.add(t)).length){var n=r.attach(t);(!n.filter||0<u(e.target).parentsUntil(t,n.filter).length)&&n.handler(e)}}})}},_callbackChain:{onKeyUp:function(e,t){return 27===t.keyCode?(this.closeOnEsc&&u.featherlight.close(t),!1):e(t)},beforeOpen:function(e,t){return u(document.documentElement).addClass("with-featherlight"),this._previouslyActive=document.activeElement,this._$previouslyTabbable=u("a, input, select, textarea, iframe, button, iframe, [contentEditable=true]").not("[tabindex]").not(this.$instance.find("button")),this._$previouslyWithTabIndex=u("[tabindex]").not('[tabindex="-1"]'),this._previousWithTabIndices=this._$previouslyWithTabIndex.map(function(e,t){return u(t).attr("tabindex")}),this._$previouslyWithTabIndex.add(this._$previouslyTabbable).attr("tabindex",-1),document.activeElement.blur&&document.activeElement.blur(),e(t)},afterClose:function(e,t){var n=e(t),r=this;return this._$previouslyTabbable.removeAttr("tabindex"),this._$previouslyWithTabIndex.each(function(e,t){u(t).attr("tabindex",r._previousWithTabIndices[e])}),this._previouslyActive.focus(),0===c.opened().length&&u(document.documentElement).removeClass("with-featherlight"),n},onResize:function(e,t){return this.resize(this.$content.naturalWidth,this.$content.naturalHeight),e(t)},afterContent:function(e,t){var n=e(t);return this.$instance.find("[autofocus]:not([disabled])").focus(),this.onResize(t),n}}}),u.featherlight=c,u.fn.featherlight=function(e,t){return c.attach(this,e,t),this},u(document).ready(function(){c._onReady()})}else"console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery.");function c(e,t){if(!(this instanceof c)){var n=new c(e,t);return n.open(),n}this.id=c.id++,this.setup(e,t),this.chainCallbacks(c._callbackChain)}}(jQuery);
|