rbcli 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +12 -12
- data/LICENSE.txt +674 -21
- data/README.md +80 -443
- data/bin/console +19 -0
- data/bin/setup +20 -0
- data/docs/404.html +639 -0
- data/docs/advanced/automatic_updates/index.html +791 -0
- data/docs/advanced/command_types/index.html +946 -0
- data/docs/advanced/distributed_state_locking/index.html +777 -0
- data/docs/advanced/hooks/index.html +836 -0
- data/docs/advanced/state_storage/index.html +957 -0
- data/docs/advanced/user_config_files/index.html +818 -0
- data/docs/assets/fonts/font-awesome.css +4 -0
- data/docs/assets/fonts/material-icons.css +13 -0
- data/docs/assets/fonts/specimen/FontAwesome.ttf +0 -0
- data/docs/assets/fonts/specimen/FontAwesome.woff +0 -0
- data/docs/assets/fonts/specimen/FontAwesome.woff2 +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
- data/docs/assets/images/favicon.png +0 -0
- data/docs/assets/images/icons/bitbucket.1b09e088.svg +20 -0
- data/docs/assets/images/icons/github.f0b8504a.svg +18 -0
- data/docs/assets/images/icons/gitlab.6dd19c00.svg +38 -0
- data/docs/assets/javascripts/application.a59e2a89.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.da.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.de.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.du.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.es.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.fi.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.fr.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.hu.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.it.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.jp.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.multi.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.no.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.pt.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.ro.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.ru.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.sv.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.tr.js +1 -0
- data/docs/assets/javascripts/lunr/tinyseg.js +1 -0
- data/docs/assets/javascripts/modernizr.1aa3b519.js +1 -0
- data/docs/assets/stylesheets/application-palette.6079476c.css +2 -0
- data/docs/assets/stylesheets/application.ba0fd1a6.css +2 -0
- data/docs/development/code_of_conduct/index.html +883 -0
- data/docs/development/contributing/index.html +744 -0
- data/docs/development/license/index.html +715 -0
- data/docs/imported/changelog/index.html +853 -0
- data/docs/imported/quick_reference/index.html +1057 -0
- data/docs/index.html +732 -0
- data/docs/search/search_index.json +569 -0
- data/docs/sitemap.xml +93 -0
- data/docs/tutorial/10-getting_started/index.html +806 -0
- data/docs/tutorial/20-project_layout/index.html +972 -0
- data/docs/tutorial/30-your_first_command/index.html +906 -0
- data/docs/tutorial/40-options_parameters_and_arguments/index.html +1049 -0
- data/docs/tutorial/50-publishing/index.html +838 -0
- data/docs/whoami/index.html +709 -0
- data/docs-src/docs/advanced/automatic_updates.md +42 -0
- data/docs-src/docs/advanced/command_types.md +144 -0
- data/docs-src/docs/advanced/distributed_state_locking.md +33 -0
- data/docs-src/docs/advanced/hooks.md +65 -0
- data/docs-src/docs/advanced/logging.md +35 -0
- data/docs-src/docs/advanced/state_storage.md +117 -0
- data/docs-src/docs/advanced/user_config_files.md +47 -0
- data/docs-src/docs/development/code_of_conduct.md +74 -0
- data/docs-src/docs/development/contributing.md +49 -0
- data/docs-src/docs/development/license.md +10 -0
- data/docs-src/docs/imported/changelog.md +31 -0
- data/docs-src/docs/imported/quick_reference.md +150 -0
- data/docs-src/docs/index.md +38 -0
- data/docs-src/docs/tutorial/10-getting_started.md +41 -0
- data/docs-src/docs/tutorial/20-project_layout.md +115 -0
- data/docs-src/docs/tutorial/30-your_first_command.md +126 -0
- data/docs-src/docs/tutorial/40-options_parameters_and_arguments.md +251 -0
- data/docs-src/docs/tutorial/50-publishing.md +47 -0
- data/docs-src/docs/whoami.md +28 -0
- data/docs-src/makesite.sh +14 -0
- data/docs-src/mkdocs.yml +76 -0
- data/docs-src/runsite.sh +3 -0
- data/exe/rbcli +76 -5
- data/lib/rbcli/autoupdate/autoupdate.rb +24 -4
- data/lib/rbcli/autoupdate/gem_updater.rb +23 -2
- data/lib/rbcli/autoupdate/github_updater.rb +22 -1
- data/lib/rbcli/configuration/config.rb +22 -1
- data/lib/rbcli/configuration/configurate.rb +24 -2
- data/lib/rbcli/engine/command.rb +26 -6
- data/lib/rbcli/engine/load_project.rb +29 -3
- data/lib/rbcli/engine/parser.rb +25 -4
- data/lib/rbcli/logging/logging.rb +21 -0
- data/lib/rbcli/scriptwrapping/scriptwrapper.rb +30 -11
- data/lib/rbcli/stateful_systems/configuratestorage.rb +20 -0
- data/lib/rbcli/stateful_systems/state_storage.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/localstate.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/remote_state_connectors/dynamodb.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb +20 -0
- data/lib/rbcli/util/hash_deep_symbolize.rb +43 -22
- data/lib/rbcli/util/string_colorize.rb +20 -0
- data/lib/rbcli/version.rb +21 -1
- data/lib/rbcli-tool/generators.rb +20 -0
- data/lib/rbcli-tool/mdless_fix.rb +20 -0
- data/lib/rbcli-tool/project.rb +27 -2
- data/lib/rbcli-tool/util.rb +20 -0
- data/lib/rbcli-tool.rb +20 -0
- data/lib/rbcli.rb +20 -0
- data/lib-sh/lib-rbcli.sh +19 -0
- data/rbcli.gemspec +22 -3
- data/skeletons/project/CODE_OF_CONDUCT.md +1 -1
- data/skeletons/project/README.md +17 -2
- data/skeletons/project/application/commands/command.erb +10 -8
- data/skeletons/project/application/commands/script.erb +3 -1
- data/skeletons/project/application/commands/scripts/script.sh +2 -2
- data/skeletons/project/application/options.rb +12 -3
- data/skeletons/project/config/autoupdate.rb +5 -2
- data/skeletons/project/config/storage.rb +7 -6
- data/skeletons/project/config/userspace.rb +6 -1
- data/skeletons/project/exe/executable +1 -1
- data/skeletons/project/lib/.keep +0 -0
- data/skeletons/project/untitled.gemspec +4 -4
- data/skeletons/project/{default_user_configs → userconf}/user_defaults.yml +0 -0
- metadata +85 -9
- data/examples/defaults.yml +0 -4
- data/examples/myscript.sh +0 -23
- data/examples/mytool +0 -95
@@ -1,3 +1,23 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
20
|
+
|
1
21
|
require 'mdless'
|
2
22
|
|
3
23
|
def class_exists?(class_name)
|
data/lib/rbcli-tool/project.rb
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
20
|
+
|
1
21
|
module RBCliTool
|
2
22
|
class Project
|
3
23
|
|
@@ -22,10 +42,11 @@ module RBCliTool
|
|
22
42
|
application/commands
|
23
43
|
application/commands/scripts
|
24
44
|
config
|
25
|
-
|
45
|
+
userconf
|
26
46
|
exe
|
27
47
|
hooks
|
28
48
|
spec
|
49
|
+
lib
|
29
50
|
).each do |folder|
|
30
51
|
FileUtils.mkdir_p "#{@dest}/#{folder}"
|
31
52
|
FileUtils.touch "#{@dest}/#{folder}/.keep"
|
@@ -38,7 +59,11 @@ module RBCliTool
|
|
38
59
|
# Create files for Gem package
|
39
60
|
Dir.entries(src).each do |file|
|
40
61
|
next if File.directory? "#{src}/#{file}"
|
41
|
-
|
62
|
+
if file == "untitled.gemspec"
|
63
|
+
RBCliTool.cp_file "#{src}/#{file}", "#{@dest}/#{@template_vars[:cmdname]}.gemspec", @template_vars
|
64
|
+
else
|
65
|
+
RBCliTool.cp_file "#{src}/#{file}", "#{@dest}/", @template_vars
|
66
|
+
end
|
42
67
|
end
|
43
68
|
|
44
69
|
# Create default config
|
data/lib/rbcli-tool/util.rb
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
20
|
+
|
1
21
|
require 'erb'
|
2
22
|
|
3
23
|
module RBCliTool
|
data/lib/rbcli-tool.rb
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
20
|
+
|
1
21
|
###########
|
2
22
|
## RBCLI ##
|
3
23
|
###########
|
data/lib/rbcli.rb
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
20
|
+
|
1
21
|
###########
|
2
22
|
## RBCLI ##
|
3
23
|
###########
|
data/lib-sh/lib-rbcli.sh
CHANGED
@@ -1,4 +1,23 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
+
##################################################################################
|
3
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
4
|
+
# Copyright (C) 2018 Andrew Khoury #
|
5
|
+
# #
|
6
|
+
# This program is free software: you can redistribute it and/or modify #
|
7
|
+
# it under the terms of the GNU General Public License as published by #
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
9
|
+
# (at your option) any later version. #
|
10
|
+
# #
|
11
|
+
# This program is distributed in the hope that it will be useful, #
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
14
|
+
# GNU General Public License for more details. #
|
15
|
+
# #
|
16
|
+
# You should have received a copy of the GNU General Public License #
|
17
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
18
|
+
# #
|
19
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
20
|
+
##################################################################################
|
2
21
|
|
3
22
|
## Log message
|
4
23
|
function message {
|
data/rbcli.gemspec
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
##################################################################################
|
2
|
+
# RBCli -- A framework for developing command line applications in Ruby #
|
3
|
+
# Copyright (C) 2018 Andrew Khoury #
|
4
|
+
# #
|
5
|
+
# This program is free software: you can redistribute it and/or modify #
|
6
|
+
# it under the terms of the GNU General Public License as published by #
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or #
|
8
|
+
# (at your option) any later version. #
|
9
|
+
# #
|
10
|
+
# This program is distributed in the hope that it will be useful, #
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
13
|
+
# GNU General Public License for more details. #
|
14
|
+
# #
|
15
|
+
# You should have received a copy of the GNU General Public License #
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
17
|
+
# #
|
18
|
+
# For questions regarding licensing, please contact andrew@blacknex.us #
|
19
|
+
##################################################################################
|
1
20
|
|
2
21
|
lib = File.expand_path("../lib", __FILE__)
|
3
22
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -7,10 +26,10 @@ Gem::Specification.new do |spec|
|
|
7
26
|
spec.name = 'rbcli'
|
8
27
|
spec.version = Rbcli::VERSION
|
9
28
|
spec.authors = ['Andrew Khoury']
|
10
|
-
spec.email = ['
|
29
|
+
spec.email = ['andrew@blacknex.us']
|
11
30
|
|
12
|
-
spec.summary = %q{A CLI Framework for Ruby}
|
13
|
-
spec.description = %q{RBCli is a framework to quickly develop command-line tools.}
|
31
|
+
spec.summary = %q{A CLI Application/Tooling Framework for Ruby}
|
32
|
+
spec.description = %q{RBCli is a framework to quickly develop command-line tools and applications.}
|
14
33
|
spec.homepage = 'https://github.com/akhoury6/rbcli'
|
15
34
|
spec.license = 'MIT'
|
16
35
|
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at andrew@blacknex.us. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/skeletons/project/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# <%= @vars[:cmdname] %>
|
2
2
|
|
3
|
-
Welcome to your new
|
3
|
+
Welcome to your new application! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem.
|
4
4
|
|
5
5
|
You'll find your gem's Command Line entrypoint under the file `exe/<%= @vars[:cmdname] %>`, although you shouldn't need to edit this file. Instead, follow these steps to get up and running quickly:
|
6
6
|
|
@@ -18,6 +18,21 @@ TODO: Delete the text above and write your README!
|
|
18
18
|
|
19
19
|
<%= @vars[:description] %>
|
20
20
|
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
To install this application from source, clone this repo and run:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
gem build <%= @vars[:cmdname] %>.gemspec
|
27
|
+
gem install <%= @vars[:cmdname] %>-*.gem
|
28
|
+
```
|
29
|
+
|
30
|
+
To install this application from Rubygems.org, run:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
gem install <%= @vars[:cmdname] %>
|
34
|
+
```
|
35
|
+
|
21
36
|
## Development
|
22
37
|
|
23
38
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `config/version.rb`, and then 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](https://rubygems.org).
|
@@ -28,4 +43,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
28
43
|
|
29
44
|
## Code of Conduct
|
30
45
|
|
31
|
-
Everyone interacting in the Untitled project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]
|
46
|
+
Everyone interacting in the Untitled project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/<%= @vars[:cmdname] %>/blob/master/CODE_OF_CONDUCT.md).
|
@@ -5,16 +5,18 @@
|
|
5
5
|
# from Rbcli::Command. The name of the class will be
|
6
6
|
# the command that is available to the user.
|
7
7
|
#########################
|
8
|
-
class <%= @vars[:name].capitalize %> < Rbcli::Command
|
9
|
-
description '<%= @vars[:description] %>'
|
10
|
-
usage
|
11
|
-
|
8
|
+
class <%= @vars[:name].capitalize %> < Rbcli::Command # Declare a new command by subclassing Rbcli::Command
|
9
|
+
description '<%= @vars[:description] %>' # (Required) Short description for the global help
|
10
|
+
usage <<-EOF
|
11
|
+
<%= @vars[:usage_text] %>
|
12
|
+
EOF # (Required) Long description for the command-specific help
|
13
|
+
parameter :force, 'Force testing', short: 'f', type: :boolean, default: false, required: false # (Optional, Multiple) Add a command-specific CLI parameter. Uses the same format as options (see application/options.rb for help)
|
12
14
|
|
13
|
-
config_default :myopt2, description: 'My Option #2', default: 'Default Value Here'
|
14
|
-
|
15
|
+
config_default :myopt2, description: 'My Option #2', default: 'Default Value Here' # (Optional, Multiple) Specify an individual configuration parameter and set a default value. These will also be included in generated user config.
|
16
|
+
# 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
|
15
17
|
|
16
|
-
action do |params, args, global_opts, config|
|
17
|
-
Rbcli::log.info { 'These logs can go to STDERR, STDOUT, or a file' }
|
18
|
+
action do |params, args, global_opts, config| # (Required) Block to execute if the command is called.
|
19
|
+
Rbcli::log.info { 'These logs can go to STDERR, STDOUT, or a file' } # Example log. Interface is identical to Ruby's logger
|
18
20
|
puts "\nArgs:\n#{args}" # Arguments that came after the command on the CLI (i.e.: `mytool test bar baz` will yield args=['bar', 'baz'])
|
19
21
|
puts "Params:\n#{params}" # Parameters, as described through the option statements above
|
20
22
|
puts "Global opts:\n#{global_opts}" # Global Parameters, as descirbed in the Configurate section
|
@@ -16,7 +16,9 @@ class <%= @vars[:name].capitalize %> < Rbcli::Command
|
|
16
16
|
<% if @vars[:no_script] -%>
|
17
17
|
extern path: 'path/to/application', envvars: {MYVAR: 'some_value'} # (Required) Runs a given application, with optional environment variables, when the user runs the command.
|
18
18
|
#extern envvars: {MY_OTHER_VAR: 'another_value'} 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.
|
19
|
-
#
|
19
|
+
# cmd = '/path/to/application'
|
20
|
+
# cmd += ' --test-script foo --ignore-errors' if params[:force]
|
21
|
+
# cmd
|
20
22
|
#end
|
21
23
|
<% else -%>
|
22
24
|
extern path: :default # (Required): Do not edit this line. Do delete it if you wish to manually specify a script path and set environment variables.
|
@@ -8,8 +8,8 @@
|
|
8
8
|
source $(echo $(cd "$(dirname $(gem which rbcli))/../lib-sh" && pwd)/lib-rbcli.sh)
|
9
9
|
#
|
10
10
|
# The `rbcli` function is actually a wrapper around `jq` (https://stedolan.github.io/jq/). It can automatically
|
11
|
-
# jq on users' machines if running Linux or OSX, and users have sudo access. If not, users
|
12
|
-
#
|
11
|
+
# jq on users' machines if running Linux or OSX, and users have sudo access. If not, users will be prompted to install
|
12
|
+
# it. RBCli passes in the variable data by populating evironment variables with JSON, and requires JQ to parse them.
|
13
13
|
#
|
14
14
|
# You can view the entire JSON structures with:
|
15
15
|
#
|
@@ -10,9 +10,18 @@ Rbcli::Configurate.me do
|
|
10
10
|
# Here you are defining the [options]. The parameters and lineitms (subcommands) are
|
11
11
|
# defined under their command blocks.
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# Options are defined in the follwoing format:
|
14
|
+
# option :<name>, "<description_string>", short: '<character>', type: <variable_type>, default: <default_value>, permitted: [<array_of_permitted_values]
|
14
15
|
#
|
15
|
-
#
|
16
|
+
# name: (Required) The long name of the option, as a symbol. This will be represented as `--name` on the command line
|
17
|
+
# description_string: (Required) A short description of the command that will appear in the help text for the user
|
18
|
+
# type: (Required) The following types are supported: `:string`, `:boolean` or `:flag`, `:integer`, and `:float`
|
19
|
+
# default: (Optional) A default value for the option if one isn't entered (default: nil)
|
20
|
+
# short: (Optional) A letter that acts as a shortcut for the option. This will allow users to apply the command as `-n`
|
21
|
+
# To not have a short value, set this to :none
|
22
|
+
# (default: the first letter of the long name)
|
23
|
+
# required: (Optional) Specify whether the option is required from the user (default: false)
|
24
|
+
# permitted: (Optional) An array of whitelisted values for the option (default: nil)
|
16
25
|
#
|
17
26
|
# To specify multiple options, simply copy the line and modify as desired.
|
18
27
|
#
|
@@ -26,5 +35,5 @@ Rbcli::Configurate.me do
|
|
26
35
|
description %q{<%= @vars[:description] %>}
|
27
36
|
|
28
37
|
## Option -- (Optional, Multiple) -- Add a global CLI Option
|
29
|
-
option :name, 'Give me your name', type: :string, default: '
|
38
|
+
option :name, 'Give me your name', short: 'n', type: :string, default: 'Jack', required: false, permitted: ['Jack', 'Jill']
|
30
39
|
end
|
@@ -19,14 +19,17 @@ Rbcli::Configurate.me do
|
|
19
19
|
# The `enterprise_hostname` setting allows you to point RBCli at a local GitHub Enterprise server.
|
20
20
|
#
|
21
21
|
# Setting `force_update: true` will halt execution if an update is available, forcing the user to update.
|
22
|
+
#
|
23
|
+
# The `message` parameter allows setiting a custom message. Leave as nil to use the default message provided by RBCli.
|
24
|
+
#
|
22
25
|
# Uncomment the line below to enable
|
23
26
|
|
24
|
-
#autoupdate github_repo: '<your_user>/<your_repo>', access_token: nil, enterprise_hostname: nil, force_update: false
|
27
|
+
#autoupdate github_repo: '<your_user>/<your_repo>', access_token: nil, enterprise_hostname: nil, force_update: false, message: nil
|
25
28
|
|
26
29
|
|
27
30
|
## Autoupdate, Rubygems.org -- (Optional) -- Check for updates to this application on Rubygems.org
|
28
31
|
# Uncomment the line below to enable
|
29
32
|
|
30
|
-
#autoupdate gem: '<your_gem>', force_update: false
|
33
|
+
#autoupdate gem: '<your_gem>', force_update: false, message: nil
|
31
34
|
|
32
35
|
end
|
@@ -6,29 +6,30 @@
|
|
6
6
|
###############################
|
7
7
|
Rbcli::Configurate.storage do
|
8
8
|
###
|
9
|
-
# Local State Storage
|
9
|
+
# Local State Storage -- (Optional)
|
10
10
|
###
|
11
11
|
# Local state storage creates a hash that is automatically saved to a file locally for state persistance.
|
12
12
|
# It is accessible to all commands at: Rbcli.localstate[:yourkeyhere]
|
13
13
|
#
|
14
14
|
# Note that every update to the top level of this hash will trigger a save, and updating nested hashes will not.
|
15
15
|
# If you need to update nested hashes, you can trigger a save manually by calling `Rbcli.localstate.commit`.
|
16
|
+
# It is accessible to all commands at: Rbcli.localstate[:yourkeyhere]
|
16
17
|
# Please see the documentation for full usage details.
|
17
18
|
###
|
18
19
|
|
19
|
-
#local_state '/var/mytool/localstate', force_creation: true, halt_on_error: true
|
20
|
+
#local_state '/var/mytool/localstate', force_creation: true, halt_on_error: true
|
20
21
|
|
21
22
|
|
22
23
|
###
|
23
|
-
# Remote State Storage
|
24
|
+
# Remote State Storage -- (Optional)
|
24
25
|
###
|
25
26
|
# Remote state storage creates a hash that is automatically saved to a remote database for state persistence.
|
26
27
|
# This state can be made unique to each user, or can be shared across different users of the tool.
|
27
28
|
#
|
28
|
-
# When sharing, locking should be set to `true
|
29
|
-
# only be acquired when absolutely needed. This behavior can be overridden manually if desired.
|
29
|
+
# When sharing, locking should be set to `true` to prevent data corruption. Note that RBCli uses lazy-loaded,
|
30
|
+
# meaning the lock will only be acquired when absolutely needed. This behavior can be overridden manually if desired.
|
30
31
|
# For full usage details, see the documentation.
|
31
32
|
###
|
32
33
|
|
33
|
-
#remote_state_dynamodb table_name: 'mytable', region: 'us-east-1', force_creation: true, halt_on_error: true, locking:
|
34
|
+
#remote_state_dynamodb table_name: 'mytable', region: 'us-east-1', force_creation: true, halt_on_error: true, locking: false
|
34
35
|
end
|
@@ -14,7 +14,11 @@ Rbcli::Configurate.me do
|
|
14
14
|
# If merge_defaults=true, user settings override default settings.
|
15
15
|
# If false, defaults set here are not loaded at all, and the user is required to set them.
|
16
16
|
# If required=true, application will not run if file does not exist.
|
17
|
-
|
17
|
+
#
|
18
|
+
# If the path is set to nil, the config file is disabled
|
19
|
+
|
20
|
+
#config_userfile '~/.<%= @vars[:cmdname] %>', merge_defaults: true, required: false
|
21
|
+
config_userfile nil
|
18
22
|
|
19
23
|
## Config Defaults -- (Optional, Multiple) -- Load a YAML file as part of the default config.
|
20
24
|
# This can be called multiple times, and the YAML files will be merged. User config is generated from these files.
|
@@ -24,5 +28,6 @@ Rbcli::Configurate.me do
|
|
24
28
|
|
25
29
|
## Config Default -- (Optional, Multiple) -- Specify an individual configuration parameter and set a default value.
|
26
30
|
# These will be included in generated user config.
|
31
|
+
|
27
32
|
config_default :myopt, description: 'Testing this', default: true
|
28
33
|
end
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
config = File.expand_path("../config", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(config) unless $LOAD_PATH.include?(config)
|
4
|
-
require '
|
4
|
+
require 'version.rb'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "<%= @vars[:cmdname] %>"
|
@@ -9,10 +9,10 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["TODO: Your Name Here"]
|
10
10
|
spec.email = ["TODO: Your Email Here"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{<%= @vars[:description] %>}
|
13
13
|
spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
14
|
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
15
|
-
spec.license =
|
15
|
+
spec.license = "None"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
end
|
31
31
|
spec.bindir = "exe"
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
-
spec.require_paths = ["application", "config", "default_user_configs", "hooks"]
|
33
|
+
spec.require_paths = ["application", "config", "default_user_configs", "hooks", "lib"]
|
34
34
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 1.16"
|
36
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Khoury
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,9 +150,9 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.0'
|
153
|
-
description: RBCli is a framework to quickly develop command-line tools.
|
153
|
+
description: RBCli is a framework to quickly develop command-line tools and applications.
|
154
154
|
email:
|
155
|
-
-
|
155
|
+
- andrew@blacknex.us
|
156
156
|
executables:
|
157
157
|
- rbcli
|
158
158
|
extensions: []
|
@@ -160,6 +160,7 @@ extra_rdoc_files: []
|
|
160
160
|
files:
|
161
161
|
- ".gitignore"
|
162
162
|
- ".travis.yml"
|
163
|
+
- CHANGELOG.md
|
163
164
|
- CODE_OF_CONDUCT.md
|
164
165
|
- Gemfile
|
165
166
|
- Gemfile.lock
|
@@ -168,9 +169,83 @@ files:
|
|
168
169
|
- Rakefile
|
169
170
|
- bin/console
|
170
171
|
- bin/setup
|
171
|
-
-
|
172
|
-
-
|
173
|
-
-
|
172
|
+
- docs-src/docs/advanced/automatic_updates.md
|
173
|
+
- docs-src/docs/advanced/command_types.md
|
174
|
+
- docs-src/docs/advanced/distributed_state_locking.md
|
175
|
+
- docs-src/docs/advanced/hooks.md
|
176
|
+
- docs-src/docs/advanced/logging.md
|
177
|
+
- docs-src/docs/advanced/state_storage.md
|
178
|
+
- docs-src/docs/advanced/user_config_files.md
|
179
|
+
- docs-src/docs/development/code_of_conduct.md
|
180
|
+
- docs-src/docs/development/contributing.md
|
181
|
+
- docs-src/docs/development/license.md
|
182
|
+
- docs-src/docs/imported/changelog.md
|
183
|
+
- docs-src/docs/imported/quick_reference.md
|
184
|
+
- docs-src/docs/index.md
|
185
|
+
- docs-src/docs/tutorial/10-getting_started.md
|
186
|
+
- docs-src/docs/tutorial/20-project_layout.md
|
187
|
+
- docs-src/docs/tutorial/30-your_first_command.md
|
188
|
+
- docs-src/docs/tutorial/40-options_parameters_and_arguments.md
|
189
|
+
- docs-src/docs/tutorial/50-publishing.md
|
190
|
+
- docs-src/docs/whoami.md
|
191
|
+
- docs-src/makesite.sh
|
192
|
+
- docs-src/mkdocs.yml
|
193
|
+
- docs-src/runsite.sh
|
194
|
+
- docs/404.html
|
195
|
+
- docs/advanced/automatic_updates/index.html
|
196
|
+
- docs/advanced/command_types/index.html
|
197
|
+
- docs/advanced/distributed_state_locking/index.html
|
198
|
+
- docs/advanced/hooks/index.html
|
199
|
+
- docs/advanced/state_storage/index.html
|
200
|
+
- docs/advanced/user_config_files/index.html
|
201
|
+
- docs/assets/fonts/font-awesome.css
|
202
|
+
- docs/assets/fonts/material-icons.css
|
203
|
+
- docs/assets/fonts/specimen/FontAwesome.ttf
|
204
|
+
- docs/assets/fonts/specimen/FontAwesome.woff
|
205
|
+
- docs/assets/fonts/specimen/FontAwesome.woff2
|
206
|
+
- docs/assets/fonts/specimen/MaterialIcons-Regular.ttf
|
207
|
+
- docs/assets/fonts/specimen/MaterialIcons-Regular.woff
|
208
|
+
- docs/assets/fonts/specimen/MaterialIcons-Regular.woff2
|
209
|
+
- docs/assets/images/favicon.png
|
210
|
+
- docs/assets/images/icons/bitbucket.1b09e088.svg
|
211
|
+
- docs/assets/images/icons/github.f0b8504a.svg
|
212
|
+
- docs/assets/images/icons/gitlab.6dd19c00.svg
|
213
|
+
- docs/assets/javascripts/application.a59e2a89.js
|
214
|
+
- docs/assets/javascripts/lunr/lunr.da.js
|
215
|
+
- docs/assets/javascripts/lunr/lunr.de.js
|
216
|
+
- docs/assets/javascripts/lunr/lunr.du.js
|
217
|
+
- docs/assets/javascripts/lunr/lunr.es.js
|
218
|
+
- docs/assets/javascripts/lunr/lunr.fi.js
|
219
|
+
- docs/assets/javascripts/lunr/lunr.fr.js
|
220
|
+
- docs/assets/javascripts/lunr/lunr.hu.js
|
221
|
+
- docs/assets/javascripts/lunr/lunr.it.js
|
222
|
+
- docs/assets/javascripts/lunr/lunr.jp.js
|
223
|
+
- docs/assets/javascripts/lunr/lunr.multi.js
|
224
|
+
- docs/assets/javascripts/lunr/lunr.no.js
|
225
|
+
- docs/assets/javascripts/lunr/lunr.pt.js
|
226
|
+
- docs/assets/javascripts/lunr/lunr.ro.js
|
227
|
+
- docs/assets/javascripts/lunr/lunr.ru.js
|
228
|
+
- docs/assets/javascripts/lunr/lunr.stemmer.support.js
|
229
|
+
- docs/assets/javascripts/lunr/lunr.sv.js
|
230
|
+
- docs/assets/javascripts/lunr/lunr.tr.js
|
231
|
+
- docs/assets/javascripts/lunr/tinyseg.js
|
232
|
+
- docs/assets/javascripts/modernizr.1aa3b519.js
|
233
|
+
- docs/assets/stylesheets/application-palette.6079476c.css
|
234
|
+
- docs/assets/stylesheets/application.ba0fd1a6.css
|
235
|
+
- docs/development/code_of_conduct/index.html
|
236
|
+
- docs/development/contributing/index.html
|
237
|
+
- docs/development/license/index.html
|
238
|
+
- docs/imported/changelog/index.html
|
239
|
+
- docs/imported/quick_reference/index.html
|
240
|
+
- docs/index.html
|
241
|
+
- docs/search/search_index.json
|
242
|
+
- docs/sitemap.xml
|
243
|
+
- docs/tutorial/10-getting_started/index.html
|
244
|
+
- docs/tutorial/20-project_layout/index.html
|
245
|
+
- docs/tutorial/30-your_first_command/index.html
|
246
|
+
- docs/tutorial/40-options_parameters_and_arguments/index.html
|
247
|
+
- docs/tutorial/50-publishing/index.html
|
248
|
+
- docs/whoami/index.html
|
174
249
|
- exe/rbcli
|
175
250
|
- lib-sh/lib-rbcli.sh
|
176
251
|
- lib/rbcli-tool.rb
|
@@ -217,15 +292,16 @@ files:
|
|
217
292
|
- skeletons/project/config/storage.rb
|
218
293
|
- skeletons/project/config/userspace.rb
|
219
294
|
- skeletons/project/config/version.rb
|
220
|
-
- skeletons/project/default_user_configs/user_defaults.yml
|
221
295
|
- skeletons/project/exe/executable
|
222
296
|
- skeletons/project/hooks/default_action.rb
|
223
297
|
- skeletons/project/hooks/first_run.rb
|
224
298
|
- skeletons/project/hooks/post_execution.rb
|
225
299
|
- skeletons/project/hooks/pre_execution.rb
|
300
|
+
- skeletons/project/lib/.keep
|
226
301
|
- skeletons/project/spec/spec_helper.rb
|
227
302
|
- skeletons/project/spec/untitled_spec.rb
|
228
303
|
- skeletons/project/untitled.gemspec
|
304
|
+
- skeletons/project/userconf/user_defaults.yml
|
229
305
|
homepage: https://github.com/akhoury6/rbcli
|
230
306
|
licenses:
|
231
307
|
- MIT
|
@@ -249,5 +325,5 @@ rubyforge_project:
|
|
249
325
|
rubygems_version: 2.7.3
|
250
326
|
signing_key:
|
251
327
|
specification_version: 4
|
252
|
-
summary: A CLI Framework for Ruby
|
328
|
+
summary: A CLI Application/Tooling Framework for Ruby
|
253
329
|
test_files: []
|
data/examples/defaults.yml
DELETED