rake-commander 0.2.4 → 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 +12 -1
- data/lib/rake-commander/base/class_inheritable.rb +3 -3
- data/lib/rake-commander/option.rb +19 -12
- data/lib/rake-commander/version.rb +1 -1
- metadata +2 -2
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,22 @@ 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.
|
46
|
+
|
47
|
+
## [0.2.5] - 2023-05-01
|
48
|
+
|
49
|
+
### Changed
|
50
|
+
- `RakeCommander::Base::ClassInheritable#inherited_class_value` now expects a reference to the subclass
|
40
51
|
|
41
52
|
## [0.2.4] - 2023-04-30
|
42
53
|
|
@@ -50,7 +50,7 @@ class RakeCommander
|
|
50
50
|
definitions.each do |var, action|
|
51
51
|
instance_var = instance_variable_name(var)
|
52
52
|
value = instance_variable_get(instance_var)
|
53
|
-
child_value = inherited_class_value(value, method, action)
|
53
|
+
child_value = inherited_class_value(value, method, action, subclass)
|
54
54
|
subclass.instance_variable_set(instance_var, child_value)
|
55
55
|
end
|
56
56
|
end
|
@@ -58,14 +58,14 @@ class RakeCommander
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# @return [Variant] the value that the child class will inherit
|
61
|
-
def inherited_class_value(value, method, action)
|
61
|
+
def inherited_class_value(value, method, action, subclass)
|
62
62
|
case method
|
63
63
|
when :mirror
|
64
64
|
value
|
65
65
|
when :deep_dup
|
66
66
|
case action
|
67
67
|
when Proc
|
68
|
-
action.call(value)
|
68
|
+
action.call(value, subclass)
|
69
69
|
when :default
|
70
70
|
custom_deep_dup(value)
|
71
71
|
end
|
@@ -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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura Samper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|