gli 2.17.0 → 2.17.1

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: f63a411c5190a93b4b9d1b8e1516a2eadbb219e7
4
- data.tar.gz: 56b7d99d7b11c9e03818f3b8a72b160a61d9a6ed
3
+ metadata.gz: 7a448f8a1c652b6ad37a81580150ffed9ac987cc
4
+ data.tar.gz: 8f56c2d35469a6a256d9d47742a7cc5bb0328570
5
5
  SHA512:
6
- metadata.gz: 3e9081d9bfed8dd504d2b377641222d7b721a777e811bca6151da19ab37c50fcadfc97cc7bee0cc36652a94d482bd5f57ca0564488f4d00b20cd30a4726abb45
7
- data.tar.gz: 2ac18e6236e208bb0113fdac94176b60274857f4df86c4c917ff730145119f51d79b3d33a2994b033346e3e9bed0dab75598ccca405c9ddf7bcf0b3da2c81c6f
6
+ metadata.gz: 792cb23e23fdcc8eccb0397bc3ee194c57f4512f40d2bf9b1ca078579aef3522d5759c19d948a101eec6df8fc464d19307ed0a2c5f557d85616ce052f395ef4b
7
+ data.tar.gz: 9a60484551e346cf98c32b786d7955211125bc936cfd131e57ccd828cecb13613b82a53b9d08a1e1e3edcfbd78ff7ee9452d92d00dcbcaa31b0c755901023552
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ Gemfile.lock
12
12
  results.html
13
13
  .rbx
14
14
  .DS_Store
15
+ Session.vim
@@ -30,8 +30,16 @@ module GLI
30
30
  include DSL
31
31
  include CommandSupport
32
32
 
33
- # Key in an options hash to find the parent's parsed options
34
- PARENT = Object.new
33
+ class ParentKey
34
+ def to_sym
35
+ "__parent__".to_sym
36
+ end
37
+ end
38
+
39
+ # Key in an options hash to find the parent's parsed options. Note that if you are
40
+ # using openstruct, e.g. via `use_openstruct true` in your app setup, you will need
41
+ # to use the method `__parent__` to access parent parsed options.
42
+ PARENT = ParentKey.new
35
43
 
36
44
  # Create a new command.
37
45
  #
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.17.0'
3
+ VERSION = '2.17.1'
4
4
  end
5
5
  end
@@ -40,8 +40,6 @@ class TC_testCommand < Clean::Test::TestCase
40
40
 
41
41
  def test_basic_command
42
42
  [false,true].each do |openstruct|
43
- end
44
- [true].each do |openstruct|
45
43
  create_app(openstruct)
46
44
  openstruct_message = openstruct ? ", with use_openstruct" : ""
47
45
  args_args = [%w(-g basic -v -c foo bar baz quux), %w(-g basic -v --configure=foo bar baz quux)]
@@ -61,6 +59,12 @@ class TC_testCommand < Clean::Test::TestCase
61
59
  end
62
60
  end
63
61
 
62
+ def test_openstruct_with_nested_commands
63
+ create_app(true)
64
+ @app.run(["top","nested"])
65
+ assert(!@error_called,"Error block should not have been called: #{@exception_caught.inspect}")
66
+ end
67
+
64
68
  def test_around_filter
65
69
  @around_block_called = false
66
70
  @app.around do |global_options, command, options, arguments, code|
@@ -459,9 +463,10 @@ class TC_testCommand < Clean::Test::TestCase
459
463
  @pre_called = false
460
464
  @post_called = false
461
465
  @error_called = false
466
+ @exception_caught = nil
462
467
  @app.pre { |g,c,o,a| @pre_called = true }
463
468
  @app.post { |g,c,o,a| @post_called = true }
464
- @app.on_error { |g,c,o,a| @error_called = true }
469
+ @app.on_error { |exception| @error_called = true; @exception_caught = exception }
465
470
  @glob = nil
466
471
  @verbose = nil
467
472
  @glob_verbose = nil
@@ -503,6 +508,14 @@ class TC_testCommand < Clean::Test::TestCase
503
508
  @app.command [:test_wrap] do |c|
504
509
  c.action {}
505
510
  end
511
+
512
+ @app.desc "A top-level command"
513
+ @app.command [:top] do |c|
514
+ c.desc "A nested command"
515
+ c.command [:nested] do |nested|
516
+ nested.action {}
517
+ end
518
+ end
506
519
  end
507
520
 
508
521
  end
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.17.0
4
+ version: 2.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-22 00:00:00.000000000 Z
11
+ date: 2017-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake