cli_helper 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/cli_helper.gemspec +2 -2
- data/example/cli_stub.rb +2 -2
- data/lib/cli_helper.rb +4 -4
- data/tests/cli_helper_test.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c26800bd031cdd8dc5cb7e27d0772377797a2a19
|
4
|
+
data.tar.gz: bcc1dbb15015453061e049813c8d050b521919bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6ed5a90d9aea36b026a68603facfb02117724fb585c711eaf46d2b092e8914302b23bcb5d7891d35560c011813f0d350791487556fc92b739cf5b5ebb76c2f
|
7
|
+
data.tar.gz: ae39b8892ef01b65d529cd852ac1fc5e5a24903a14008ffcc95edd6b110160c95eea4454409b4abf3970c545eda08d12bfdc145d910bf4075cd0e85186d823e2
|
data/README.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# cli_helper
|
2
2
|
|
3
|
+
## Most recent changes
|
4
|
+
|
5
|
+
### v0.1.2
|
6
|
+
|
7
|
+
* replaced the parseconfig gem with the inifile gem -- this now enables the use of ERB in *.ini and *.txt config files
|
8
|
+
* changed support_config_files to enable_config_files -- cpmsisten terminology
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
3
12
|
If you write lots of command-line utility programs, or
|
4
13
|
even if you don't the cli_helper gem can be a helper
|
5
14
|
to you. It integrates several common gems to give
|
@@ -106,7 +115,7 @@ To enable the support for config files do this before
|
|
106
115
|
calling the #cli_helger() method:
|
107
116
|
|
108
117
|
```ruby
|
109
|
-
configatron.
|
118
|
+
configatron.enable_config_files = true
|
110
119
|
```
|
111
120
|
|
112
121
|
To disable any of the other common options do this before
|
data/cli_helper.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "cli_helper"
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.2'
|
8
8
|
spec.authors = ["Dewayne VanHoozer"]
|
9
9
|
spec.email = ["dvanhoozer@gmail.com"]
|
10
10
|
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
with the slop, nenv, inifile and configatron gems for quick and dirty
|
15
15
|
development of
|
16
16
|
command-line based utility programs. Slop parses ARGV; Nenv parses ENV;
|
17
|
-
|
17
|
+
inifile parses INI; Configatron keeps it all together. YAML and ERB
|
18
18
|
preprocessing is also available. Ruby configuration files are also supported.
|
19
19
|
and you can specify multiple config files of mixed types at once.
|
20
20
|
}
|
data/example/cli_stub.rb
CHANGED
@@ -13,7 +13,7 @@ require 'cli_helper'
|
|
13
13
|
include CliHelper
|
14
14
|
|
15
15
|
configatron.version = '0.0.1' # the version of this utility program
|
16
|
-
configatron.
|
16
|
+
configatron.enable_config_files = true # default is false
|
17
17
|
configatron.disable_help = false # default is false set true to remove the option
|
18
18
|
configatron.disable_verbose = false # ditto
|
19
19
|
configatron.disable_debug = false # ditto
|
@@ -42,7 +42,7 @@ EOHELP
|
|
42
42
|
# the definition of program-specific options.
|
43
43
|
#
|
44
44
|
# Default options for help, debug, verbose, and version are automatically inserted
|
45
|
-
# by cli_helper. If configatron.
|
45
|
+
# by cli_helper. If configatron.enable_config_files is TRUE then a '--config' parameter
|
46
46
|
# will also be presented. '--config' takes a comma-separated list of file paths. Each
|
47
47
|
# config file is processed within cli_helper and results combined within the configatron
|
48
48
|
# structure.
|
data/lib/cli_helper.rb
CHANGED
@@ -49,7 +49,7 @@ module CliHelper
|
|
49
49
|
verbose: false,
|
50
50
|
debug: false,
|
51
51
|
help: false,
|
52
|
-
|
52
|
+
enable_config_files: false,
|
53
53
|
disable_help: false,
|
54
54
|
disable_debug: false,
|
55
55
|
disable_verbose: false,
|
@@ -156,7 +156,7 @@ module CliHelper
|
|
156
156
|
|
157
157
|
yield(param) if block_given?
|
158
158
|
|
159
|
-
if configatron.
|
159
|
+
if configatron.enable_config_files
|
160
160
|
param.paths '--config', 'read config file(s) [*.rb, *.yml, *.ini]'
|
161
161
|
end
|
162
162
|
|
@@ -164,7 +164,7 @@ module CliHelper
|
|
164
164
|
configatron.cli = parser.parse(ARGV)
|
165
165
|
|
166
166
|
# TODO: DRY this conditional block
|
167
|
-
if configatron.
|
167
|
+
if configatron.enable_config_files
|
168
168
|
|
169
169
|
configatron.cli[:config].each do |cf|
|
170
170
|
unless cf.exist? || cf.directory?
|
@@ -216,7 +216,7 @@ module CliHelper
|
|
216
216
|
end # case type_type
|
217
217
|
end # unless cf.exist? || cf.directory?
|
218
218
|
end # configatron.cli.config.each do |cf|
|
219
|
-
end # if configatron.
|
219
|
+
end # if configatron.enable_config_files
|
220
220
|
|
221
221
|
configatron.configure_from_hash(configatron.cli.to_hash)
|
222
222
|
configatron.arguments = configatron.cli.arguments
|
data/tests/cli_helper_test.rb
CHANGED
@@ -21,7 +21,7 @@ require 'debug_me'
|
|
21
21
|
include DebugMe
|
22
22
|
|
23
23
|
|
24
|
-
configatron.
|
24
|
+
configatron.enable_config_files = true
|
25
25
|
|
26
26
|
#describe 'how it works' do
|
27
27
|
|
@@ -34,7 +34,7 @@ configatron.support_config_files = true
|
|
34
34
|
assert usage.include?('--version')
|
35
35
|
refute usage.include?('--xyzzy')
|
36
36
|
|
37
|
-
if configatron.
|
37
|
+
if configatron.enable_config_files
|
38
38
|
assert usage.include?('--config')
|
39
39
|
else
|
40
40
|
refute usage.include?('--config')
|
@@ -208,7 +208,7 @@ Where:
|
|
208
208
|
Do you need some HELP?
|
209
209
|
EOS
|
210
210
|
|
211
|
-
if configatron.
|
211
|
+
if configatron.enable_config_files
|
212
212
|
assert_equal a_string_with_config, usage
|
213
213
|
else
|
214
214
|
assert_equal a_string, usage
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dewayne VanHoozer
|
@@ -153,9 +153,9 @@ dependencies:
|
|
153
153
|
description: "\n An encapsulation of a convention I have been using\n with
|
154
154
|
the slop, nenv, inifile and configatron gems for quick and dirty\n development
|
155
155
|
of\n command-line based utility programs. Slop parses ARGV; Nenv parses ENV;\n
|
156
|
-
\
|
157
|
-
|
158
|
-
|
156
|
+
\ inifile parses INI; Configatron keeps it all together. YAML and ERB\n preprocessing
|
157
|
+
is also available. Ruby configuration files are also supported.\n and you can
|
158
|
+
specify multiple config files of mixed types at once.\n "
|
159
159
|
email:
|
160
160
|
- dvanhoozer@gmail.com
|
161
161
|
executables: []
|