commander 4.4.4 → 4.4.5

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
- SHA256:
3
- metadata.gz: 44969cb91e63472555ff36e2d39513cb5ac4c0f8f9c626f8b85bcd836e1a8227
4
- data.tar.gz: '00957023e0b9d380efab260b267082dd15c11c8a7f5e9b536f65bd8a0719b370'
2
+ SHA1:
3
+ metadata.gz: 3a1cbc50f621accf022cc6ff4e1d753c897014b8
4
+ data.tar.gz: e43562746b1399a48c7e106fdddff3a504659b23
5
5
  SHA512:
6
- metadata.gz: 0c71a8f9f030be8c93267a75027cfeac2712d31cc8907bfcfc1534f190d3f4615a930e13fbc0f1cb7cbbd7eae73cffa6136b2d63657193639064a4fde6d95f7c
7
- data.tar.gz: 12e7152d828da458b7ca79a10ce08d8a8ef00d815feaf86a394b68da8892b64ce8422df0530a6c470a2784fcd23ae561abefbeb33e6e7ddddd47ea64c0cd4545
6
+ metadata.gz: 1102742dbd50e6d51804db0856a17311d34204c3131d66f8e11a53e7f3cee9ef564c3e093721118118ee44c1d327e67f8a7b5bf96b1e73a8a8c6104b10d23c24
7
+ data.tar.gz: e0b816eb1a4bc45348c317455939e548d5386e0d20fa79380ec00ed265552f8cb030d316702dac5a0463741e0fcce90701c3202fa4a21c2f68011e7fd5168574
@@ -1,3 +1,7 @@
1
+ === 4.4.5 / 2018-05-22
2
+
3
+ * Make internal command state less mutable. (@doriantaylor)
4
+
1
5
  === 4.4.4 / 2018-01-18
2
6
 
3
7
  * Fix deprecated constant warnings on Ruby 2.5. (@mattbrictson)
@@ -171,9 +171,13 @@ module Commander
171
171
  # Call the commands when_called block with _args_.
172
172
 
173
173
  def call(args = [])
174
- object = @when_called.shift
175
- meth = @when_called.shift || :call
174
+ object, meth = @when_called[0, 2]
175
+ meth ||= :call
176
176
  options = proxy_option_struct
177
+
178
+ # empty the proxy option stack before the next invocation
179
+ proxy_options.clear
180
+
177
181
  case object
178
182
  when Proc then object.call(args, options)
179
183
  when Class then meth != :call ? object.new.send(meth, args, options) : object.new(args, options)
@@ -1,3 +1,3 @@
1
1
  module Commander
2
- VERSION = '4.4.4'.freeze
2
+ VERSION = '4.4.5'.freeze
3
3
  end
@@ -74,6 +74,16 @@ describe Commander::Command do
74
74
  it 'should raise an error when no handler is present' do
75
75
  expect { @command.when_called }.to raise_error(ArgumentError)
76
76
  end
77
+
78
+ it 'should be able to be run more than once' do
79
+ expect(@command.run('once')).to eql('test once')
80
+ expect(@command.run('twice')).to eql('test twice')
81
+ end
82
+
83
+ it 'should empty @proxy_options after running' do
84
+ expect(@command.run('--verbose')).to eql('test ')
85
+ expect(@command.proxy_options.empty?).to be true
86
+ end
77
87
  end
78
88
 
79
89
  describe 'should populate options with' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.4
4
+ version: 4.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-18 00:00:00.000000000 Z
12
+ date: 2018-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.7.4
160
+ rubygems_version: 2.6.11
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: The complete solution for Ruby command-line executables