rake-commander 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/rake-commander/option.rb +19 -12
- 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: ba9099907341e84e8420c7df7eca7f1b8f5279e454f73e031f01f982285ff583
|
4
|
+
data.tar.gz: 5263523e7800afd7a1a172eeafb5ae65e48a5b535c0ec6467b52656b90778c58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5bdc0bcd00a882f0526e354f0a9a39b6efb0864748ffc088409ba7c2759f01ea2001d4f6eced4f56aaad2976d2ae5874a059e4e1cf434488243242e426444dd
|
7
|
+
data.tar.gz: 4fe1f53c6885a8b35b2193d96313c0f2e570cff131285def889a425110b8743a3fb792b2e7ae5646514870bfe15055cf529a0e49020219e5032f97a3f1315f96
|
data/CHANGELOG.md
CHANGED
@@ -32,11 +32,17 @@ 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.7] - 2023-05-xx
|
36
36
|
|
37
37
|
### Added
|
38
38
|
### Fixed
|
39
39
|
### Changed
|
40
|
+
- `RakeCommander::Option` configure_other should only apply when the instance vars are not defined.
|
41
|
+
|
42
|
+
## [0.2.6] - 2023-05-01
|
43
|
+
|
44
|
+
### Changed
|
45
|
+
- `RakeCommander::Option` configure_other should only apply when the instance vars are not defined.
|
40
46
|
|
41
47
|
## [0.2.5] - 2023-05-01
|
42
48
|
|
@@ -125,11 +125,12 @@ class RakeCommander
|
|
125
125
|
|
126
126
|
# @return [Hash] keyed arguments to create a new object
|
127
127
|
def dup_key_arguments
|
128
|
+
configure_other
|
128
129
|
{}.tap do |kargs|
|
129
130
|
kargs.merge!(short: short.dup.freeze) if short
|
130
131
|
kargs.merge!(name: name_full.dup.freeze) if name_full
|
131
|
-
kargs.merge!(desc: desc.dup)
|
132
|
-
kargs.merge!(default: default.dup)
|
132
|
+
kargs.merge!(desc: @desc.dup) if @desc
|
133
|
+
kargs.merge!(default: @default.dup) if default?
|
133
134
|
kargs.merge!(type: @type_coercion) if @type_coercion.is_a?(Class)
|
134
135
|
kargs.merge!(required: required?)
|
135
136
|
end
|
@@ -228,17 +229,23 @@ class RakeCommander
|
|
228
229
|
|
229
230
|
# It consumes `other_args`, to prevent direct overrides to be overriden by it.
|
230
231
|
def configure_other
|
231
|
-
|
232
|
-
|
233
|
-
other_args.delete(type)
|
234
|
-
end
|
235
|
-
if value = other_args.find {|arg| arg.is_a?(String)}
|
236
|
-
@desc = value
|
237
|
-
other_args.dup.each do |val|
|
238
|
-
other_args.delete(val) if val.is_a?(String)
|
239
|
-
end
|
240
|
-
end
|
232
|
+
@type_coertion ||= fetch_type_from_other
|
233
|
+
@desc ||= fetch_desc_from_other
|
241
234
|
nil
|
242
235
|
end
|
236
|
+
|
237
|
+
def fetch_type_from_other
|
238
|
+
return nil unless type = other_args.find {|arg| arg.is_a?(Class)}
|
239
|
+
@type_coercion ||= type
|
240
|
+
other_args.delete(type)
|
241
|
+
end
|
242
|
+
|
243
|
+
def fetch_desc_from_other
|
244
|
+
return nil unless value = other_args.find {|arg| arg.is_a?(String)}
|
245
|
+
@desc ||= value
|
246
|
+
other_args.dup.each do |val|
|
247
|
+
other_args.delete(val) if val.is_a?(String)
|
248
|
+
end
|
249
|
+
end
|
243
250
|
end
|
244
251
|
end
|