rake-commander 0.2.11 → 0.2.12
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/CHANGELOG.md +7 -1
- data/examples/03_b_chained_plus_example.rb +1 -0
- data/lib/rake-commander/option.rb +5 -3
- data/lib/rake-commander/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c13e58c8b9c78ac538ca0100d714a7c3f72ca98a655ae564ebbca13cacf2f6
|
4
|
+
data.tar.gz: bfbf686120c4245ba541605db6fbb46e14455b77553948827946fb1417cb376b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
@
|
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
|