commander-fastlane 4.4.5 → 4.4.6

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: d28d59a6cc9f6f509e7dd975c6e9810f79d68168
4
- data.tar.gz: a95fa24aec357f85c10f69dc93fe7e4553317c8a
3
+ metadata.gz: c1acebe7b301cf71ef0f7eff8892ed12b88141cc
4
+ data.tar.gz: 16626d950688e20d17bc622eccd547a6f596f9e0
5
5
  SHA512:
6
- metadata.gz: 90c988f320592c8ab3751eb768bdf6531b4d0aee84f1c9b90ce925760d9a59a111fe92ed9805ebd282500f903c7d746b1531abd993abc084a2e466107c86623a
7
- data.tar.gz: fee955eb147ce3009f1c8c5eccf1c595b32e0efe26aec732f1a503287fe9cad0c94d740e80386ae19b21953e134d1dea26c50b02b2b4bc4a12da03ccaeeb2b25
6
+ metadata.gz: 9ed0298cd50d03ce6270ff0861e6851b1bf8e8e72cf08b25ecf208b80e02178536b722cd96d576490ceaa4ce525eaeef64a171b90998f596cde819658a3b2439
7
+ data.tar.gz: 42e12d399600e729efbeeda880271bea06529a1b0ba25dccd856ff3c5c46114fef7e83f3c2cbc963df2806233e85d0454d5d44ee259e33218f55dc6eca48b4ef
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
  before_install:
3
4
  - gem update --system
4
5
  - gem update bundler
@@ -6,7 +7,8 @@ rvm:
6
7
  - 1.9.3
7
8
  - 2.0.0
8
9
  - 2.1.10
9
- - 2.2.6
10
- - 2.3.3
11
- - 2.4.0
10
+ - 2.2.9
11
+ - 2.3.6
12
+ - 2.4.3
13
+ - 2.5.0
12
14
  - jruby-19mode
data/README.md CHANGED
@@ -11,7 +11,7 @@ To ship a new release, just do the following
11
11
 
12
12
  - Increment the version number in `version.rb`
13
13
  - Run `bundle update && rake install`
14
- - Run `gem push pkg/commander-fastlane-[version].gem`
14
+ - Run `gem push ./pkg/....pkg`
15
15
 
16
16
  💥
17
17
 
@@ -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.46')
28
+ s.add_development_dependency('rubocop', '~> 0.49.1')
29
29
  end
30
30
  end
@@ -76,7 +76,7 @@ module Commander
76
76
  OptionParser::InvalidOption,
77
77
  OptionParser::InvalidArgument,
78
78
  OptionParser::MissingArgument => e
79
- abort e.to_s
79
+ # abort e.to_s
80
80
  rescue => e
81
81
  if @never_trace
82
82
  abort "error: #{e}."
@@ -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
- # All special cases in HighLine::Question#convert, except those that implement #parse
329
- (
330
- [Float, Integer, String, Symbol, Regexp, Array, File, Pathname] +
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
  ##
@@ -1,3 +1,3 @@
1
1
  module Commander
2
- VERSION = '4.4.5'.freeze
2
+ VERSION = '4.4.6'.freeze
3
3
  end
@@ -6,8 +6,49 @@ describe Commander::Methods do
6
6
  expect(subject.ancestors).to include(Commander::UI)
7
7
  end
8
8
 
9
- it 'includes Commander::UI::AskForClass' do
10
- expect(subject.ancestors).to include(Commander::UI::AskForClass)
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.5
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: 2017-06-27 00:00:00.000000000 Z
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: '0.46'
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: '0.46'
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.8
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: