bootinq 1.3.1 → 1.4.0
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/lib/bootinq.rb +40 -13
- data/lib/bootinq/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: c08400508d67149e4ea7d4eeda4f33a25a5a9dd68f4ed40b79ac517f5d028ce5
|
4
|
+
data.tar.gz: c1af627b8eb2282a3fccec5c90f83d44382bdb9ffea7f81de4df95a13af747c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da561be83aff97f64a9b41084ae19a5dc0f9c4692a0e944c1c9bf2f41d16538d37fe4d35de515c01c63c5c795abccc7c54a8d6c4cb2d9964762b4d84d880c5c7
|
7
|
+
data.tar.gz: 87152bc5af6852f2b1347bab91b9a8c5f68e929266fecf214a5fe66f545a6ef3517603904ce344fdb177ae95c10d03e30ac507cabcb7aa1863718ec42c343f0f
|
data/lib/bootinq.rb
CHANGED
@@ -67,28 +67,36 @@ class Bootinq
|
|
67
67
|
# :call-seq:
|
68
68
|
# Bootinq.require(*groups, verbose: false, &block)
|
69
69
|
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# invokes the <tt>Bootinq.setup</tt> method with the given verbose key argument & block,
|
73
|
-
# and, finally, gets Bundler to require the given groups.
|
70
|
+
# Invokes the <tt>Bootinq.init</tt> method with the given verbose key argument & block,
|
71
|
+
# and, finally, makes Bundler to require the given groups.
|
74
72
|
def self.require(*groups, verbose: false, &block) # :yields: Bootinq.instance
|
75
|
-
|
76
|
-
|
77
|
-
setup(verbose: verbose, &block)
|
78
|
-
|
73
|
+
init(verbose: verbose, &block)
|
79
74
|
Bundler.require(*instance.groups(*groups))
|
80
75
|
end
|
81
76
|
|
82
77
|
# :call-seq:
|
83
|
-
# Bootinq.setup(verbose: false, &block)
|
78
|
+
# Bootinq.setup(*groups, verbose: false, &block)
|
84
79
|
#
|
85
|
-
#
|
80
|
+
# Invokes the <tt>Bootinq.init</tt> method with the given verbose key argument & block,
|
81
|
+
# and, finally, makes Bundler to setup the given groups.
|
82
|
+
def self.setup(*groups, verbose: false, &block) # :yields: Bootinq.instance
|
83
|
+
init(verbose: verbose, &block)
|
84
|
+
Bundler.setup(*instance.groups(*groups))
|
85
|
+
end
|
86
|
+
|
87
|
+
# :call-seq:
|
88
|
+
# Bootinq.init(verbose: false, &block) -> true or false
|
89
|
+
#
|
90
|
+
# Initializes itself. Sets the BOOTINQ_PATH enviroment variable if it is missing.
|
91
|
+
# To track inquired components use <tt>verbose: true</tt> key argument.
|
86
92
|
# Optionally yields block within the own instance's binding.
|
87
|
-
def self.
|
93
|
+
def self.init(verbose: false, &block) # :yields: Bootinq.instance
|
94
|
+
ENV['BOOTINQ_PATH'] ||= File.expand_path('../bootinq.yml', caller_locations(1..1)[0].path)
|
95
|
+
|
88
96
|
instance
|
97
|
+
instance.instance_variable_set(:@_on_ready, block.to_proc) if block_given?
|
89
98
|
puts "Bootinq: loading components #{instance.components.join(', ')}" if verbose
|
90
|
-
instance.
|
91
|
-
instance
|
99
|
+
instance.ready!
|
92
100
|
end
|
93
101
|
|
94
102
|
attr_reader :flags
|
@@ -111,6 +119,25 @@ class Bootinq
|
|
111
119
|
config['mount'].each { |flag, name| enable_component(name, flag: flag, as: Mountable) }
|
112
120
|
end
|
113
121
|
|
122
|
+
delegated def ready? # :no-doc:
|
123
|
+
!!@ready
|
124
|
+
end
|
125
|
+
|
126
|
+
# :call-seq:
|
127
|
+
# Bootinq.ready! -> nil or self
|
128
|
+
#
|
129
|
+
# At the first call marks Bootinq as ready and returns the instance,
|
130
|
+
# otherwise returns nil.
|
131
|
+
delegated def ready!
|
132
|
+
return if ready?
|
133
|
+
@ready = true
|
134
|
+
if defined?(@_on_ready)
|
135
|
+
instance_exec(&@_on_ready)
|
136
|
+
remove_instance_variable :@_on_ready
|
137
|
+
end
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
114
141
|
# :call-seq:
|
115
142
|
# Bootinq.enable_component(name, flag: [, as: Component])
|
116
143
|
#
|
data/lib/bootinq/version.rb
CHANGED
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|