commander 4.4.4 → 4.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/History.rdoc +4 -0
- data/lib/commander/command.rb +6 -2
- data/lib/commander/version.rb +1 -1
- data/spec/command_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a1cbc50f621accf022cc6ff4e1d753c897014b8
|
4
|
+
data.tar.gz: e43562746b1399a48c7e106fdddff3a504659b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1102742dbd50e6d51804db0856a17311d34204c3131d66f8e11a53e7f3cee9ef564c3e093721118118ee44c1d327e67f8a7b5bf96b1e73a8a8c6104b10d23c24
|
7
|
+
data.tar.gz: e0b816eb1a4bc45348c317455939e548d5386e0d20fa79380ec00ed265552f8cb030d316702dac5a0463741e0fcce90701c3202fa4a21c2f68011e7fd5168574
|
data/History.rdoc
CHANGED
data/lib/commander/command.rb
CHANGED
@@ -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
|
175
|
-
meth
|
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)
|
data/lib/commander/version.rb
CHANGED
data/spec/command_spec.rb
CHANGED
@@ -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
|
+
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-
|
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.
|
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
|