bootinq 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootinq/component.rb +2 -6
- data/lib/bootinq/version.rb +1 -1
- data/lib/bootinq.rb +14 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 729bf1c9b83d3e11258f451f220542d46836ffc9
|
4
|
+
data.tar.gz: fc860ed30c15acc2046e2e33074d4097004aa4fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2aa46cef37e5b173a9efb010bbc3fcc616f324ddb8ed52938e8303ab400ff707baf6bddfa3135b918c7adcf791463c59021a257efa0589b8888435877d0c2ae
|
7
|
+
data.tar.gz: b1f55595d4f7611014c547831d1b34b5dae00ba479802099de799f732b2665afefb94ecb9ae7377b6b355a427c568957eeffc9783e4cf26dca0dcb8d6747b3c3
|
data/lib/bootinq/component.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Bootinq
|
2
2
|
class Component
|
3
|
-
attr_reader :intern, :id2name
|
3
|
+
attr_reader :intern, :id2name, :group
|
4
4
|
|
5
5
|
alias :to_sym :intern
|
6
6
|
alias :to_s :id2name
|
@@ -10,6 +10,7 @@ class Bootinq
|
|
10
10
|
def initialize(intern)
|
11
11
|
@intern = intern.to_sym
|
12
12
|
@id2name = intern.to_s.freeze
|
13
|
+
@group = :"#@id2name\_boot"
|
13
14
|
freeze
|
14
15
|
end
|
15
16
|
|
@@ -17,10 +18,6 @@ class Bootinq
|
|
17
18
|
false
|
18
19
|
end
|
19
20
|
|
20
|
-
def group
|
21
|
-
:"#@id2name\_boot"
|
22
|
-
end
|
23
|
-
|
24
21
|
def == other
|
25
22
|
case other
|
26
23
|
when String then other == @id2name
|
@@ -34,7 +31,6 @@ class Bootinq
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def engine
|
37
|
-
nil
|
38
34
|
end
|
39
35
|
|
40
36
|
def module_name
|
data/lib/bootinq/version.rb
CHANGED
data/lib/bootinq.rb
CHANGED
@@ -27,7 +27,6 @@ class Bootinq
|
|
27
27
|
extend SingleForwardable
|
28
28
|
include Singleton
|
29
29
|
|
30
|
-
NEG_OPS = %w(- ^).freeze
|
31
30
|
DEFAULT = {
|
32
31
|
"env_key" => 'BOOTINQ',
|
33
32
|
"default" => '',
|
@@ -38,10 +37,10 @@ class Bootinq
|
|
38
37
|
# The helper method to bootstrap the Bootinq.
|
39
38
|
# Sets the BOOTINQ_PATH enviroment variable, yields optional block in
|
40
39
|
# the own instance's binding and, finally, requires selected bundler groups.
|
41
|
-
def self.require(*groups,
|
40
|
+
def self.require(*groups, verbose: false, &block) # :yields:
|
42
41
|
ENV['BOOTINQ_PATH'] ||= File.expand_path('../bootinq.yml', caller_locations(1..1)[0].path)
|
43
42
|
|
44
|
-
|
43
|
+
puts "Bootinq: loading components #{instance.components.join(', ')}" if verbose
|
45
44
|
|
46
45
|
instance.instance_exec(&block) if block_given?
|
47
46
|
|
@@ -60,7 +59,7 @@ class Bootinq
|
|
60
59
|
merge!(DEFAULT) { |_,l,r| l.nil? ? r : l }
|
61
60
|
|
62
61
|
@_value = ENV.fetch(config['env_key']) { config['default'] }
|
63
|
-
@_neg = @_value.start_with?(
|
62
|
+
@_neg = @_value.start_with?("-", "^")
|
64
63
|
@flags = []
|
65
64
|
@components = []
|
66
65
|
|
@@ -81,7 +80,7 @@ class Bootinq
|
|
81
80
|
alias :[] :component
|
82
81
|
|
83
82
|
# Enums each mountable component
|
84
|
-
def each_mountable
|
83
|
+
def each_mountable # :yields:
|
85
84
|
return to_enum(__method__) unless block_given?
|
86
85
|
components.each { |part| yield(part) if part.mountable? }
|
87
86
|
end
|
@@ -109,15 +108,17 @@ class Bootinq
|
|
109
108
|
# Bootinq.on all: %i(frontend backend) do
|
110
109
|
# # do something when frontend and backend are enabled
|
111
110
|
# end
|
112
|
-
def on(name) # :yields:
|
113
|
-
if name
|
114
|
-
|
115
|
-
|
116
|
-
next unless list.is_a?(Enumerable)
|
117
|
-
yield if list.public_send(:"#{m}?") { |part| enabled?(part) }
|
118
|
-
end
|
119
|
-
else
|
111
|
+
def on(name = nil, any: nil, all: nil) # :yields:
|
112
|
+
if (any && all) || (name && (any || all))
|
113
|
+
raise ArgumentError, "expected single argument or one of keywords: `all' or `any'"
|
114
|
+
elsif name
|
120
115
|
yield if enabled?(name)
|
116
|
+
elsif any
|
117
|
+
yield if any.any? { |part| enabled?(part) }
|
118
|
+
elsif all
|
119
|
+
yield if all.all? { |part| enabled?(part) }
|
120
|
+
else
|
121
|
+
raise ArgumentError, "wrong arguments (given 0, expected 1)"
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|