bootinq 1.6 → 1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/bootinq/version.rb +1 -1
- data/lib/bootinq.rb +39 -25
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70b36fe43d2052568352c6afd05fdc32f761bdb232dadaed96d3ba05f3a93f6b
|
4
|
+
data.tar.gz: 28d7999b1f29b41c87944da9b564b5641ba0582465ae703b8d582aa8814a8eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a46c57dee491a7cd41997e79992befbe184439e0d49af40e980cf222d8f513eeda9c5874fdf8006eed7561715ab41cbe36f1de24a9a4efbe081601f1dbc69f
|
7
|
+
data.tar.gz: 66d7bbe52c5835ac53bd11e3413c26b7af08eabf7c06f19b3ccc88f4627d52c1e90341381ba2b5a180504580ed171afff4f5cbf4a58f03757f6722ea73f285fb
|
data/README.md
CHANGED
data/lib/bootinq/version.rb
CHANGED
data/lib/bootinq.rb
CHANGED
@@ -61,6 +61,8 @@ class Bootinq
|
|
61
61
|
"deps" => {}
|
62
62
|
}.freeze
|
63
63
|
|
64
|
+
ALL = %i[* all].freeze
|
65
|
+
|
64
66
|
FilterNegValue = -> (value, config) do
|
65
67
|
if value.start_with?(?-, ?^)
|
66
68
|
value = value.tr('\\-', '\\^')
|
@@ -111,7 +113,17 @@ class Bootinq
|
|
111
113
|
# Reads config from the given or default path, deserializes it and returns as a hash.
|
112
114
|
def self.deserialized_config(path: nil)
|
113
115
|
bootinq_yaml = File.read(path || ENV.fetch('BOOTINQ_PATH'))
|
114
|
-
|
116
|
+
psych_safe_load(bootinq_yaml, [Symbol])
|
117
|
+
end
|
118
|
+
|
119
|
+
if RUBY_VERSION >= '3.1.0'
|
120
|
+
def self.psych_safe_load(path, permitted_classes)
|
121
|
+
YAML.safe_load(path, permitted_classes: permitted_classes)
|
122
|
+
end
|
123
|
+
else
|
124
|
+
def self.psych_safe_load(*args)
|
125
|
+
YAML.safe_load(*args)
|
126
|
+
end
|
115
127
|
end
|
116
128
|
|
117
129
|
attr_reader :flags
|
@@ -168,7 +180,7 @@ class Bootinq
|
|
168
180
|
# Checks if a component with the given name (i.e. the same gem group)
|
169
181
|
# is enabled
|
170
182
|
def enabled?(name)
|
171
|
-
components.include?(name)
|
183
|
+
ALL.include?(name) || components.include?(name)
|
172
184
|
end
|
173
185
|
|
174
186
|
# :call-seq:
|
@@ -233,6 +245,11 @@ class Bootinq
|
|
233
245
|
# # do something when frontend and backend are enabled
|
234
246
|
# end
|
235
247
|
def on(name = nil, any: nil, all: nil) # :yields:
|
248
|
+
if ALL.include?(name)
|
249
|
+
yield
|
250
|
+
return true
|
251
|
+
end
|
252
|
+
|
236
253
|
if name.nil? && any.nil? && all.nil?
|
237
254
|
raise ArgumentError, "wrong arguments (given 0, expected 1)"
|
238
255
|
elsif (any && all) || (name && (any || all))
|
@@ -253,7 +270,7 @@ class Bootinq
|
|
253
270
|
# Takes a list of component names and yields a given block (optionally)
|
254
271
|
# if all of them are enabled. Returns boolean matching status.
|
255
272
|
def on_all(*parts) # :yields:
|
256
|
-
is_matched = parts.all? { |
|
273
|
+
is_matched = parts.all? { |part| enabled?(part) }
|
257
274
|
yield if is_matched && block_given?
|
258
275
|
is_matched
|
259
276
|
end
|
@@ -264,7 +281,7 @@ class Bootinq
|
|
264
281
|
# Takes a list of component names and yields a given block (optionally)
|
265
282
|
# if any of them are enabled. Returns boolean matching status.
|
266
283
|
def on_any(*parts) # :yields:
|
267
|
-
is_matched = parts.any? { |
|
284
|
+
is_matched = parts.any? { |part| enabled?(part) }
|
268
285
|
yield if is_matched && block_given?
|
269
286
|
is_matched
|
270
287
|
end
|
@@ -302,25 +319,22 @@ class Bootinq
|
|
302
319
|
super
|
303
320
|
end
|
304
321
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
on_any
|
324
|
-
switch
|
325
|
-
).each { |sym| class_eval(delegate_template % sym, *instance_method(sym).source_location) }
|
322
|
+
extend SingleForwardable
|
323
|
+
|
324
|
+
delegate %I[
|
325
|
+
component
|
326
|
+
components
|
327
|
+
each_mountable
|
328
|
+
enabled?
|
329
|
+
enable_component
|
330
|
+
flags
|
331
|
+
groups
|
332
|
+
on
|
333
|
+
on_all
|
334
|
+
on_any
|
335
|
+
ready!
|
336
|
+
ready?
|
337
|
+
switch
|
338
|
+
[]
|
339
|
+
] => :instance
|
326
340
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootinq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,7 +64,7 @@ homepage: https://github.com/estum/bootinq
|
|
64
64
|
licenses:
|
65
65
|
- MIT
|
66
66
|
metadata: {}
|
67
|
-
post_install_message:
|
67
|
+
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
70
70
|
- lib
|
@@ -79,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
83
|
-
signing_key:
|
82
|
+
rubygems_version: 3.3.7
|
83
|
+
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Rails Boot Inquirer
|
86
86
|
test_files: []
|