commander-fastlane 4.4.5 → 4.4.6
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 +4 -4
- data/.travis.yml +5 -3
- data/README.md +1 -1
- data/commander.gemspec +1 -1
- data/lib/commander/runner.rb +1 -1
- data/lib/commander/user_interaction.rb +35 -12
- data/lib/commander/version.rb +1 -1
- data/spec/methods_spec.rb +43 -2
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1acebe7b301cf71ef0f7eff8892ed12b88141cc
|
|
4
|
+
data.tar.gz: 16626d950688e20d17bc622eccd547a6f596f9e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ed0298cd50d03ce6270ff0861e6851b1bf8e8e72cf08b25ecf208b80e02178536b722cd96d576490ceaa4ce525eaeef64a171b90998f596cde819658a3b2439
|
|
7
|
+
data.tar.gz: 42e12d399600e729efbeeda880271bea06529a1b0ba25dccd856ff3c5c46114fef7e83f3c2cbc963df2806233e85d0454d5d44ee259e33218f55dc6eca48b4ef
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/commander.gemspec
CHANGED
|
@@ -25,6 +25,6 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.add_development_dependency('rubocop', '~> 0.41.1')
|
|
26
26
|
s.add_development_dependency('json', '< 2.0')
|
|
27
27
|
else
|
|
28
|
-
s.add_development_dependency('rubocop', '~> 0.
|
|
28
|
+
s.add_development_dependency('rubocop', '~> 0.49.1')
|
|
29
29
|
end
|
|
30
30
|
end
|
data/lib/commander/runner.rb
CHANGED
|
@@ -324,22 +324,45 @@ module Commander
|
|
|
324
324
|
# Implements ask_for_CLASS methods.
|
|
325
325
|
|
|
326
326
|
module AskForClass
|
|
327
|
-
DEPRECATED_CONSTANTS = [:Config, :TimeoutError, :MissingSourceFile, :NIL, :TRUE, :FALSE, :Fixnum, :Bignum].freeze
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
# All Classes that respond to #parse
|
|
332
|
-
# Ignore constants that trigger deprecation warnings
|
|
333
|
-
(Object.constants - DEPRECATED_CONSTANTS).map do |const|
|
|
334
|
-
Object.const_get(const)
|
|
335
|
-
end.select do |const|
|
|
336
|
-
const.class == Class && const.respond_to?(:parse)
|
|
337
|
-
end
|
|
338
|
-
).each do |klass|
|
|
327
|
+
DEPRECATED_CONSTANTS = [:Config, :TimeoutError, :MissingSourceFile, :NIL, :TRUE, :FALSE, :Fixnum, :Bignum, :Data].freeze
|
|
328
|
+
|
|
329
|
+
# define methods for common classes
|
|
330
|
+
[Float, Integer, String, Symbol, Regexp, Array, File, Pathname].each do |klass|
|
|
339
331
|
define_method "ask_for_#{klass.to_s.downcase}" do |prompt|
|
|
340
332
|
$terminal.ask(prompt, klass)
|
|
341
333
|
end
|
|
342
334
|
end
|
|
335
|
+
|
|
336
|
+
def method_missing(method_name, *arguments, &block)
|
|
337
|
+
if method_name.to_s =~ /^ask_for_(.*)/
|
|
338
|
+
if arguments.count != 1
|
|
339
|
+
fail ArgumentError, "wrong number of arguments (given #{arguments.count}, expected 1)"
|
|
340
|
+
end
|
|
341
|
+
prompt = arguments.first
|
|
342
|
+
requested_class = Regexp.last_match[1]
|
|
343
|
+
|
|
344
|
+
# All Classes that respond to #parse
|
|
345
|
+
# Ignore constants that trigger deprecation warnings
|
|
346
|
+
available_classes = (Object.constants - DEPRECATED_CONSTANTS).map do |const|
|
|
347
|
+
Object.const_get(const)
|
|
348
|
+
end.select do |const|
|
|
349
|
+
const.class == Class && const.respond_to?(:parse)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
klass = available_classes.find { |k| k.to_s.downcase == requested_class }
|
|
353
|
+
if klass
|
|
354
|
+
$terminal.ask(prompt, klass)
|
|
355
|
+
else
|
|
356
|
+
super
|
|
357
|
+
end
|
|
358
|
+
else
|
|
359
|
+
super
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
364
|
+
method_name.to_s.start_with?('ask_for_') || super
|
|
365
|
+
end
|
|
343
366
|
end
|
|
344
367
|
|
|
345
368
|
##
|
data/lib/commander/version.rb
CHANGED
data/spec/methods_spec.rb
CHANGED
|
@@ -6,8 +6,49 @@ describe Commander::Methods do
|
|
|
6
6
|
expect(subject.ancestors).to include(Commander::UI)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
describe 'AskForClass' do
|
|
10
|
+
it 'includes Commander::UI::AskForClass' do
|
|
11
|
+
expect(subject.ancestors).to include(Commander::UI::AskForClass)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'defining methods' do
|
|
15
|
+
let(:terminal) { double }
|
|
16
|
+
|
|
17
|
+
before do
|
|
18
|
+
allow(terminal).to receive(:ask)
|
|
19
|
+
$_old_terminal = $terminal
|
|
20
|
+
$terminal = terminal
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
after do
|
|
24
|
+
$terminal = $_old_terminal
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
subject do
|
|
28
|
+
Class.new do
|
|
29
|
+
include Commander::UI::AskForClass
|
|
30
|
+
end.new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'defines common "ask_for_*" methods' do
|
|
34
|
+
expect(subject.respond_to?(:ask_for_float)).to be_truthy
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'responds to "ask_for_*" methods for classes that implement #parse' do
|
|
38
|
+
expect(subject.respond_to?(:ask_for_datetime)).to be_truthy
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'fails "ask_for_*" method invocations without a prompt' do
|
|
42
|
+
expect do
|
|
43
|
+
subject.ask_for_datetime
|
|
44
|
+
end.to raise_error(ArgumentError)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'implements "ask_for_*"' do
|
|
48
|
+
expect(terminal).to receive(:ask)
|
|
49
|
+
subject.ask_for_datetime('hi')
|
|
50
|
+
end
|
|
51
|
+
end
|
|
11
52
|
end
|
|
12
53
|
|
|
13
54
|
it 'includes Commander::Delegates' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: commander-fastlane
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.4.
|
|
4
|
+
version: 4.4.6
|
|
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:
|
|
12
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: highline
|
|
@@ -73,14 +73,14 @@ dependencies:
|
|
|
73
73
|
requirements:
|
|
74
74
|
- - "~>"
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version:
|
|
76
|
+
version: 0.49.1
|
|
77
77
|
type: :development
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
81
|
- - "~>"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version:
|
|
83
|
+
version: 0.49.1
|
|
84
84
|
description: The complete solution for Ruby command-line executables. Commander bridges
|
|
85
85
|
the gap between other terminal related libraries you know and love (OptionParser,
|
|
86
86
|
HighLine), while providing many new features, and an elegant API.
|
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
156
156
|
version: '0'
|
|
157
157
|
requirements: []
|
|
158
158
|
rubyforge_project:
|
|
159
|
-
rubygems_version: 2.6.
|
|
159
|
+
rubygems_version: 2.6.10
|
|
160
160
|
signing_key:
|
|
161
161
|
specification_version: 4
|
|
162
162
|
summary: The complete solution for Ruby command-line executables
|
|
@@ -171,4 +171,3 @@ test_files:
|
|
|
171
171
|
- spec/runner_spec.rb
|
|
172
172
|
- spec/spec_helper.rb
|
|
173
173
|
- spec/ui_spec.rb
|
|
174
|
-
has_rdoc:
|