rake-commander 0.2.11 → 0.2.12

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
  SHA256:
3
- metadata.gz: '068822ca0ec4b9745dd946c64e851284cb4ebfb6103cc6d0f31dedac26247c7a'
4
- data.tar.gz: 2e3978181bf2aaf9499275e31940faf95f0c7d8e6b62301dcd9ad26185cb8d4f
3
+ metadata.gz: 00c13e58c8b9c78ac538ca0100d714a7c3f72ca98a655ae564ebbca13cacf2f6
4
+ data.tar.gz: bfbf686120c4245ba541605db6fbb46e14455b77553948827946fb1417cb376b
5
5
  SHA512:
6
- metadata.gz: a2087733ac4cf2c9c343e06fdb5b9674292df27469714f439ba1424eb7fdfb80f90113db74ae5ddbfddcd696a2455249e0a2abb8cfd30752fb4ca6ab5b4a0f6f
7
- data.tar.gz: dad19cb129abb66464092887c8bc7845dc5268ab1df0cd409d8a86994d69af59e5e27fac41889338c617de015afbcaf53b481b863e0f0f76846ca6bf0913fa12
6
+ metadata.gz: 1d7941181f5ea5b4bd1210bcb3e5a1307bbedbd0a503636144af350a320a6a7ed4a5d8948d2212c81b401513bb383c37ad4645825e544cb952a73bbdf3d62110
7
+ data.tar.gz: 41a29e32b0536d073c4481df467ff65351bd84c5782db961398ea6ac66c73d6652d623df7d1c363e321130182f32db78368528996b7331478c16505b1b059c76
data/CHANGELOG.md CHANGED
@@ -32,12 +32,18 @@ All notable changes to this project will be documented in this file.
32
32
  - Option to globally enable/disable the 2nd patch?
33
33
  * That would make this gem completely useless.
34
34
 
35
- ## [0.2.12] - 2023-05-xx
35
+ ## [0.2.13] - 2023-05-xx
36
36
 
37
37
  ### Added
38
38
  ### Fixed
39
39
  ### Changed
40
40
 
41
+ ## [0.2.12] - 2023-05-xx
42
+
43
+ ### Fixed
44
+ - `RakeCommander::Option#type_coercion` wasn't correctly captured.
45
+
46
+
41
47
  ## [0.2.11] - 2023-05-01
42
48
 
43
49
  ### Fixed
@@ -7,6 +7,7 @@ class RakeCommander::Custom::ChainedPlus < RakeCommander::Custom::Chained
7
7
  option :e, '--exit-on-error', TrueClass, desc: 'If it should just exit on "missing argument" error or raise an exception'
8
8
  # Move option to the end, make **required** the argument (SOMETHING) as well as the option itself.
9
9
  option :s, '--say SOMETHING', "It says 'something'", required: true
10
+ option :y, '--no-way', FalseClass, "It returns 'true' when used"
10
11
 
11
12
  error_on_options error: RakeCommander::Options::Error::MissingArgument do |err, _argv, results, _leftovers|
12
13
  msg = "Parsed results when 'missing argument' error was raised"
@@ -92,7 +92,9 @@ class RakeCommander
92
92
 
93
93
  # @return [Class, NilClass]
94
94
  def type_coercion
95
- @type_coercion || (default? && default.class)
95
+ value = @type_coercion || (default? && default.class)
96
+ return nil unless value.is_a?(Class)
97
+ value
96
98
  end
97
99
 
98
100
  # @return [Boolean]
@@ -230,14 +232,14 @@ class RakeCommander
230
232
 
231
233
  # It consumes `other_args`, to prevent direct overrides to be overriden by it.
232
234
  def configure_other
233
- @type_coertion ||= fetch_type_from_other
235
+ @type_coercion ||= fetch_type_from_other
234
236
  @desc ||= fetch_desc_from_other
235
237
  nil
236
238
  end
237
239
 
238
240
  def fetch_type_from_other
239
241
  return nil unless type = other_args.find {|arg| arg.is_a?(Class)}
240
- other_args.delete(type)
242
+ type.tap { other_args.delete(type) }
241
243
  end
242
244
 
243
245
  def fetch_desc_from_other
@@ -1,3 +1,3 @@
1
1
  class RakeCommander
2
- VERSION = '0.2.11'.freeze
2
+ VERSION = '0.2.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura Samper