gli 2.13.2 → 2.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gli/app_support.rb +1 -1
- data/lib/gli/commands/initconfig.rb +2 -1
- data/lib/gli/version.rb +1 -1
- data/test/config.yaml +1 -0
- data/test/tc_gli.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf6367c06fcaf096c1ba22d33d398bff9e3e9e6
|
4
|
+
data.tar.gz: d762d428d2c191b899508f5dd638194cf89b0c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5bb0ff0818e637796e2eccd9d9553e387dff7f144bee93ba7b44b1007a0289bd54e917ff50a158b5619e201cf0f2e9a72fc978bd79f8857157db9f209c384c9
|
7
|
+
data.tar.gz: eb5368dcf5ab2261d62bf2630dcdc303c592eca19efb41c4a63642e9dfec6f79679e6b3f0755313a99a786001ff1a03487ea84b914d315266eb48d21fc89ed64
|
data/lib/gli/app_support.rb
CHANGED
@@ -35,7 +35,8 @@ module GLI
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def create_config(global_options,options,arguments)
|
38
|
-
config = Hash[
|
38
|
+
config = Hash[(@app_switches.keys + @app_flags.keys).map { |option_name|
|
39
|
+
option_value = global_options[option_name]
|
39
40
|
if option_value.kind_of?(String) && option_value.respond_to?(:force_encoding)
|
40
41
|
[option_name,option_value.force_encoding("utf-8")]
|
41
42
|
else
|
data/lib/gli/version.rb
CHANGED
data/test/config.yaml
CHANGED
data/test/tc_gli.rb
CHANGED
@@ -145,6 +145,8 @@ class TC_testGLI < Clean::Test::TestCase
|
|
145
145
|
@app.flag :f
|
146
146
|
@app.switch :s
|
147
147
|
@app.flag :g
|
148
|
+
@app.default_value true
|
149
|
+
@app.switch :t
|
148
150
|
called = false
|
149
151
|
@app.command :command do |c|
|
150
152
|
c.flag :f
|
@@ -159,6 +161,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
159
161
|
assert !o[:f]
|
160
162
|
assert !g[:s]
|
161
163
|
assert o[:s]
|
164
|
+
assert !g[:t]
|
162
165
|
rescue Exception => ex
|
163
166
|
failure = ex
|
164
167
|
end
|
@@ -229,9 +232,9 @@ class TC_testGLI < Clean::Test::TestCase
|
|
229
232
|
@app.reset
|
230
233
|
@app.config_file(@config_file)
|
231
234
|
@app.flag :f
|
232
|
-
@app.switch :s
|
235
|
+
@app.switch :s, :salias
|
233
236
|
@app.switch :w
|
234
|
-
@app.flag :bigflag
|
237
|
+
@app.flag :bigflag, :bigalias
|
235
238
|
@app.flag :biggestflag
|
236
239
|
@app.command :foo do |c|
|
237
240
|
end
|
@@ -249,7 +252,9 @@ class TC_testGLI < Clean::Test::TestCase
|
|
249
252
|
|
250
253
|
assert_equal 'foo',written_config[:f]
|
251
254
|
assert_equal 'bleorgh',written_config[:bigflag]
|
255
|
+
assert !written_config[:bigalias]
|
252
256
|
assert written_config[:s]
|
257
|
+
assert !written_config[:salias]
|
253
258
|
assert !written_config[:w]
|
254
259
|
assert_nil written_config[:biggestflag]
|
255
260
|
assert written_config[GLI::InitConfig::COMMANDS_KEY]
|
@@ -515,7 +520,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
515
520
|
end
|
516
521
|
@switch_value = nil
|
517
522
|
|
518
|
-
assert_raises(RuntimeError) do
|
523
|
+
assert_raises(RuntimeError) do
|
519
524
|
@app.command [:foo] do |c|
|
520
525
|
c.switch :switch, :default_value => true, :negatable => false
|
521
526
|
end
|
@@ -770,7 +775,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
770
775
|
}
|
771
776
|
end
|
772
777
|
|
773
|
-
def assert_switch_was_made(object,switch)
|
778
|
+
def assert_switch_was_made(object,switch)
|
774
779
|
lambda {
|
775
780
|
assert object.switches[switch]
|
776
781
|
assert_equal @description,object.switches[switch].description,"For switch #{switch}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Copeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|