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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94f421bf818175143af61b7b8e7ae0a4f9d79254
4
- data.tar.gz: 7edaeb9e3d2c98c0c9c5e15ca3688bcfd40acd57
3
+ metadata.gz: bbf6367c06fcaf096c1ba22d33d398bff9e3e9e6
4
+ data.tar.gz: d762d428d2c191b899508f5dd638194cf89b0c14
5
5
  SHA512:
6
- metadata.gz: 30444e8c7f15e1eef0c2ea2c1761dfdcf7a3b307cfa965b4722d22eb0b7dcb3a1939b73119faaa81e3e4b67c8c04978e637311c48aee82314fba9d524be9913b
7
- data.tar.gz: 039e7d4cf7331f676ed7bfc61f39d9f988a075758c1529760d5826af5f6b7dd2e33c10ae12363ed235ba6a55a2961fbcd5362fc45e517052ec8916ba2e35ff08
6
+ metadata.gz: e5bb0ff0818e637796e2eccd9d9553e387dff7f144bee93ba7b44b1007a0289bd54e917ff50a158b5619e201cf0f2e9a72fc978bd79f8857157db9f209c384c9
7
+ data.tar.gz: eb5368dcf5ab2261d62bf2630dcdc303c592eca19efb41c4a63642e9dfec6f79679e6b3f0755313a99a786001ff1a03487ea84b914d315266eb48d21fc89ed64
@@ -201,7 +201,7 @@ module GLI
201
201
 
202
202
  def override_default(tokens,config)
203
203
  tokens.each do |name,token|
204
- token.default_value=config[name] if config[name]
204
+ token.default_value=config[name] unless config[name].nil?
205
205
  end
206
206
  end
207
207
 
@@ -35,7 +35,8 @@ module GLI
35
35
  private
36
36
 
37
37
  def create_config(global_options,options,arguments)
38
- config = Hash[global_options.map { |option_name,option_value|
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
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.13.2'
3
+ VERSION = '2.13.3'
4
4
  end
5
5
  end
@@ -8,3 +8,4 @@ commands:
8
8
  :f: barfoo
9
9
  :f: foo
10
10
  :bleorgh: true
11
+ :t: false
@@ -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.2
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-08-28 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake