builderator 1.0.0.pre.rc.4 → 1.0.0.pre.rc.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Buildfile +4 -0
- data/Gemfile +0 -9
- data/Gemfile.lock +2 -194
- data/VERSION +1 -1
- data/bin/build +0 -13
- data/builderator.gemspec +0 -1
- data/lib/builderator/config.rb +13 -5
- data/lib/builderator/config/attributes.rb +29 -11
- data/lib/builderator/config/file.rb +17 -7
- data/lib/builderator/config/rash.rb +16 -3
- data/lib/builderator/control/cleaner.rb +2 -2
- data/lib/builderator/tasks/version.rb +1 -1
- metadata +3 -18
- data/Rakefile +0 -1
- data/mkmf.log +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2852a1c02024fc999ea0eb74e472a8e233d867a9
|
4
|
+
data.tar.gz: 248ea3c6b324305423c9fc6db5336ad9a7c25c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 835929882dd2a9cf704b667a833eddbe6cfdaf00227636a10abdca11f1708a9e4cefa184a19c5835e910b982f8eed51e12879fff3b295d9d825dcae51fc662d1
|
7
|
+
data.tar.gz: fb06fff1526bc2be046757dddd479146c3ca1dce16f70d03c4173c600871821470c18900dca80f0dab4970b27c6adf8c3bf0b982beb66b738244c6cb2c8f5608
|
data/Buildfile
ADDED
data/Gemfile
CHANGED
@@ -2,12 +2,3 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in builderator.gemspec
|
4
4
|
gemspec
|
5
|
-
|
6
|
-
gem 'vagrant', :github => 'mitchellh/vagrant',
|
7
|
-
:tag => 'v1.7.4',
|
8
|
-
:group => :development
|
9
|
-
|
10
|
-
group :development, :plugins do
|
11
|
-
gem 'vagrant-aws'
|
12
|
-
gem 'vagrant-omnibus'
|
13
|
-
end
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,9 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/mitchellh/vagrant.git
|
3
|
-
revision: 78ea5e4a78ce644717ab16d8001ab77430168f0f
|
4
|
-
tag: v1.7.4
|
5
|
-
specs:
|
6
|
-
vagrant (1.7.4)
|
7
|
-
bundler (>= 1.5.2, <= 1.10.5)
|
8
|
-
childprocess (~> 0.5.0)
|
9
|
-
erubis (~> 2.7.0)
|
10
|
-
hashicorp-checkpoint (~> 0.1.1)
|
11
|
-
i18n (>= 0.6.0, <= 0.8.0)
|
12
|
-
listen (~> 3.0.2)
|
13
|
-
log4r (~> 1.1.9, < 1.1.11)
|
14
|
-
net-scp (~> 1.1.0)
|
15
|
-
net-sftp (~> 2.1)
|
16
|
-
net-ssh (>= 2.6.6, < 2.10.0)
|
17
|
-
nokogiri (= 1.6.3.1)
|
18
|
-
rb-kqueue (~> 0.2.0)
|
19
|
-
rest-client (>= 1.6.0, < 2.0)
|
20
|
-
wdm (~> 0.1.0)
|
21
|
-
winrm (~> 1.3)
|
22
|
-
winrm-fs (~> 0.2.0)
|
23
|
-
|
24
1
|
PATH
|
25
2
|
remote: .
|
26
3
|
specs:
|
27
|
-
builderator (1.0.0.pre.rc.
|
4
|
+
builderator (1.0.0.pre.rc.4)
|
28
5
|
aws-sdk (~> 2.0)
|
29
6
|
berkshelf (~> 3.2)
|
30
|
-
bundler (~> 1.7.0)
|
31
7
|
chef (~> 12.0)
|
32
8
|
faraday_middleware (~> 0.10.0)
|
33
9
|
ignorefile
|
@@ -36,7 +12,6 @@ PATH
|
|
36
12
|
GEM
|
37
13
|
remote: https://rubygems.org/
|
38
14
|
specs:
|
39
|
-
CFPropertyList (2.3.2)
|
40
15
|
addressable (2.3.8)
|
41
16
|
ast (2.1.0)
|
42
17
|
astrolabe (1.3.1)
|
@@ -114,8 +89,6 @@ GEM
|
|
114
89
|
mixlib-log (~> 1.3)
|
115
90
|
rack
|
116
91
|
uuidtools (~> 2.1)
|
117
|
-
childprocess (0.5.8)
|
118
|
-
ffi (~> 1.0, >= 1.0.11)
|
119
92
|
cleanroom (1.0.0)
|
120
93
|
coderay (1.1.0)
|
121
94
|
dep-selector-libgecode (1.0.2)
|
@@ -124,7 +97,6 @@ GEM
|
|
124
97
|
ffi (~> 1.9)
|
125
98
|
diff-lcs (1.2.5)
|
126
99
|
erubis (2.7.0)
|
127
|
-
excon (0.45.4)
|
128
100
|
faraday (0.9.2)
|
129
101
|
multipart-post (>= 1.2, < 3)
|
130
102
|
faraday_middleware (0.10.0)
|
@@ -132,144 +104,16 @@ GEM
|
|
132
104
|
ffi (1.9.10)
|
133
105
|
ffi-yajl (2.2.3)
|
134
106
|
libyajl2 (~> 1.2)
|
135
|
-
fission (0.5.0)
|
136
|
-
CFPropertyList (~> 2.2)
|
137
|
-
fog (1.36.0)
|
138
|
-
fog-aliyun (>= 0.1.0)
|
139
|
-
fog-atmos
|
140
|
-
fog-aws (>= 0.6.0)
|
141
|
-
fog-brightbox (~> 0.4)
|
142
|
-
fog-core (~> 1.32)
|
143
|
-
fog-dynect (~> 0.0.2)
|
144
|
-
fog-ecloud (~> 0.1)
|
145
|
-
fog-google (<= 0.1.0)
|
146
|
-
fog-json
|
147
|
-
fog-local
|
148
|
-
fog-powerdns (>= 0.1.1)
|
149
|
-
fog-profitbricks
|
150
|
-
fog-radosgw (>= 0.0.2)
|
151
|
-
fog-riakcs
|
152
|
-
fog-sakuracloud (>= 0.0.4)
|
153
|
-
fog-serverlove
|
154
|
-
fog-softlayer
|
155
|
-
fog-storm_on_demand
|
156
|
-
fog-terremark
|
157
|
-
fog-vmfusion
|
158
|
-
fog-voxel
|
159
|
-
fog-xenserver
|
160
|
-
fog-xml (~> 0.1.1)
|
161
|
-
ipaddress (~> 0.5)
|
162
|
-
nokogiri (~> 1.5, >= 1.5.11)
|
163
|
-
fog-aliyun (0.1.0)
|
164
|
-
fog-core (~> 1.27)
|
165
|
-
fog-json (~> 1.0)
|
166
|
-
ipaddress (~> 0.8)
|
167
|
-
xml-simple (~> 1.1)
|
168
|
-
fog-atmos (0.1.0)
|
169
|
-
fog-core
|
170
|
-
fog-xml
|
171
|
-
fog-aws (0.7.6)
|
172
|
-
fog-core (~> 1.27)
|
173
|
-
fog-json (~> 1.0)
|
174
|
-
fog-xml (~> 0.1)
|
175
|
-
ipaddress (~> 0.8)
|
176
|
-
fog-brightbox (0.10.1)
|
177
|
-
fog-core (~> 1.22)
|
178
|
-
fog-json
|
179
|
-
inflecto (~> 0.0.2)
|
180
|
-
fog-core (1.35.0)
|
181
|
-
builder
|
182
|
-
excon (~> 0.45)
|
183
|
-
formatador (~> 0.2)
|
184
|
-
fog-dynect (0.0.2)
|
185
|
-
fog-core
|
186
|
-
fog-json
|
187
|
-
fog-xml
|
188
|
-
fog-ecloud (0.3.0)
|
189
|
-
fog-core
|
190
|
-
fog-xml
|
191
|
-
fog-google (0.1.0)
|
192
|
-
fog-core
|
193
|
-
fog-json
|
194
|
-
fog-xml
|
195
|
-
fog-json (1.0.2)
|
196
|
-
fog-core (~> 1.0)
|
197
|
-
multi_json (~> 1.10)
|
198
|
-
fog-local (0.2.1)
|
199
|
-
fog-core (~> 1.27)
|
200
|
-
fog-powerdns (0.1.1)
|
201
|
-
fog-core (~> 1.27)
|
202
|
-
fog-json (~> 1.0)
|
203
|
-
fog-xml (~> 0.1)
|
204
|
-
fog-profitbricks (0.0.5)
|
205
|
-
fog-core
|
206
|
-
fog-xml
|
207
|
-
nokogiri
|
208
|
-
fog-radosgw (0.0.4)
|
209
|
-
fog-core (>= 1.21.0)
|
210
|
-
fog-json
|
211
|
-
fog-xml (>= 0.0.1)
|
212
|
-
fog-riakcs (0.1.0)
|
213
|
-
fog-core
|
214
|
-
fog-json
|
215
|
-
fog-xml
|
216
|
-
fog-sakuracloud (1.4.0)
|
217
|
-
fog-core
|
218
|
-
fog-json
|
219
|
-
fog-serverlove (0.1.2)
|
220
|
-
fog-core
|
221
|
-
fog-json
|
222
|
-
fog-softlayer (1.0.2)
|
223
|
-
fog-core
|
224
|
-
fog-json
|
225
|
-
fog-storm_on_demand (0.1.1)
|
226
|
-
fog-core
|
227
|
-
fog-json
|
228
|
-
fog-terremark (0.1.0)
|
229
|
-
fog-core
|
230
|
-
fog-xml
|
231
|
-
fog-vmfusion (0.1.0)
|
232
|
-
fission
|
233
|
-
fog-core
|
234
|
-
fog-voxel (0.1.0)
|
235
|
-
fog-core
|
236
|
-
fog-xml
|
237
|
-
fog-xenserver (0.2.2)
|
238
|
-
fog-core
|
239
|
-
fog-xml
|
240
|
-
fog-xml (0.1.2)
|
241
|
-
fog-core
|
242
|
-
nokogiri (~> 1.5, >= 1.5.11)
|
243
|
-
formatador (0.2.5)
|
244
|
-
gssapi (1.2.0)
|
245
|
-
ffi (>= 1.0.1)
|
246
|
-
gyoku (1.3.1)
|
247
|
-
builder (>= 2.1.2)
|
248
|
-
hashicorp-checkpoint (0.1.4)
|
249
107
|
hashie (3.4.3)
|
250
108
|
highline (1.7.8)
|
251
109
|
hitimes (1.2.3)
|
252
110
|
httpclient (2.6.0.1)
|
253
|
-
i18n (0.7.0)
|
254
111
|
ignorefile (1.1.0)
|
255
|
-
inflecto (0.0.2)
|
256
112
|
ipaddress (0.8.0)
|
257
113
|
jmespath (1.1.3)
|
258
114
|
json (1.8.3)
|
259
115
|
libyajl2 (1.2.0)
|
260
|
-
listen (3.0.5)
|
261
|
-
rb-fsevent (>= 0.9.3)
|
262
|
-
rb-inotify (>= 0.9)
|
263
|
-
little-plugger (1.1.4)
|
264
|
-
log4r (1.1.10)
|
265
|
-
logging (1.8.2)
|
266
|
-
little-plugger (>= 1.1.3)
|
267
|
-
multi_json (>= 1.8.4)
|
268
116
|
method_source (0.8.2)
|
269
|
-
mime-types (3.0)
|
270
|
-
mime-types-data (~> 3.2015)
|
271
|
-
mime-types-data (3.2015.1120)
|
272
|
-
mini_portile (0.6.0)
|
273
117
|
minitar (0.5.4)
|
274
118
|
mixlib-authentication (1.3.0)
|
275
119
|
mixlib-log
|
@@ -279,9 +123,7 @@ GEM
|
|
279
123
|
mixlib-shellout (2.2.5)
|
280
124
|
multi_json (1.11.2)
|
281
125
|
multipart-post (2.0.0)
|
282
|
-
net-scp (1.1
|
283
|
-
net-ssh (>= 2.6.5)
|
284
|
-
net-sftp (2.1.2)
|
126
|
+
net-scp (1.2.1)
|
285
127
|
net-ssh (>= 2.6.5)
|
286
128
|
net-ssh (2.9.2)
|
287
129
|
net-ssh-gateway (1.2.0)
|
@@ -291,9 +133,6 @@ GEM
|
|
291
133
|
net-ssh-gateway (>= 1.2.0)
|
292
134
|
net-telnet (0.1.1)
|
293
135
|
nio4r (1.2.0)
|
294
|
-
nokogiri (1.6.3.1)
|
295
|
-
mini_portile (= 0.6.0)
|
296
|
-
nori (2.6.0)
|
297
136
|
octokit (3.8.0)
|
298
137
|
sawyer (~> 0.6.0, >= 0.5.3)
|
299
138
|
ohai (8.8.1)
|
@@ -320,13 +159,6 @@ GEM
|
|
320
159
|
rack (1.6.4)
|
321
160
|
rainbow (2.0.0)
|
322
161
|
rake (10.4.2)
|
323
|
-
rb-fsevent (0.9.6)
|
324
|
-
rb-inotify (0.9.5)
|
325
|
-
ffi (>= 0.5.0)
|
326
|
-
rb-kqueue (0.2.4)
|
327
|
-
ffi (>= 0.5.0)
|
328
|
-
rest-client (1.6.7)
|
329
|
-
mime-types (>= 1.16)
|
330
162
|
retryable (2.0.3)
|
331
163
|
ridley (4.3.0)
|
332
164
|
addressable
|
@@ -372,8 +204,6 @@ GEM
|
|
372
204
|
ruby-progressbar (~> 1.7)
|
373
205
|
tins (<= 1.6.0)
|
374
206
|
ruby-progressbar (1.7.5)
|
375
|
-
rubyntlm (0.4.0)
|
376
|
-
rubyzip (1.1.7)
|
377
207
|
sawyer (0.6.0)
|
378
208
|
addressable (~> 2.3.5)
|
379
209
|
faraday (~> 0.8, < 0.10)
|
@@ -403,29 +233,10 @@ GEM
|
|
403
233
|
hitimes
|
404
234
|
tins (1.6.0)
|
405
235
|
uuidtools (2.1.5)
|
406
|
-
vagrant-aws (0.6.0)
|
407
|
-
fog (~> 1.22)
|
408
|
-
vagrant-omnibus (1.4.1)
|
409
236
|
varia_model (0.5.0)
|
410
237
|
buff-extensions (~> 1.0)
|
411
238
|
hashie (>= 2.0.2, < 4.0.0)
|
412
|
-
wdm (0.1.1)
|
413
|
-
winrm (1.3.6)
|
414
|
-
builder (>= 2.1.2)
|
415
|
-
gssapi (~> 1.2)
|
416
|
-
gyoku (~> 1.0)
|
417
|
-
httpclient (~> 2.2, >= 2.2.0.2)
|
418
|
-
logging (>= 1.6.1, < 3.0)
|
419
|
-
nori (~> 2.0)
|
420
|
-
rubyntlm (~> 0.4.0)
|
421
|
-
uuidtools (~> 2.1.2)
|
422
|
-
winrm-fs (0.2.3)
|
423
|
-
erubis (~> 2.7)
|
424
|
-
logging (~> 1.6, >= 1.6.1)
|
425
|
-
rubyzip (~> 1.1)
|
426
|
-
winrm (~> 1.3.0)
|
427
239
|
wmi-lite (1.0.0)
|
428
|
-
xml-simple (1.1.5)
|
429
240
|
|
430
241
|
PLATFORMS
|
431
242
|
ruby
|
@@ -436,6 +247,3 @@ DEPENDENCIES
|
|
436
247
|
rspec (~> 3.0)
|
437
248
|
rubocop (~> 0.35)
|
438
249
|
thor-scmversion (= 1.7.0)
|
439
|
-
vagrant!
|
440
|
-
vagrant-aws
|
441
|
-
vagrant-omnibus
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0-rc.
|
1
|
+
1.0.0-rc.5
|
data/bin/build
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
unless ENV.include?('BUNDLE_GEMFILE')
|
3
|
-
puts ''
|
4
|
-
puts ' / \\'
|
5
|
-
puts ' | ^ |'
|
6
|
-
puts " ಠ _ ಠ It looks like you're trying to run Builderator outside of Bundler!"
|
7
|
-
puts ' || || This is aggressively discouraged! Please re-run your command'
|
8
|
-
puts ' || || prepended with `bundle exec`'
|
9
|
-
puts ' || ||'
|
10
|
-
puts ' | | See http://bundler.io/ for help setting up Bundler and creating a Gemfile'
|
11
|
-
puts ' \\/'
|
12
|
-
puts ''
|
13
|
-
exit 1
|
14
|
-
end
|
15
2
|
|
16
3
|
require_relative '../lib/builderator/tasks'
|
17
4
|
Builderator::Tasks::CLI.start(ARGV)
|
data/builderator.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'thor-scmversion', '1.7.0'
|
25
25
|
|
26
26
|
spec.add_dependency 'aws-sdk', '~> 2.0'
|
27
|
-
spec.add_dependency 'bundler', '~> 1.7.0'
|
28
27
|
spec.add_dependency 'berkshelf', '~> 3.2'
|
29
28
|
spec.add_dependency 'chef', '~> 12.0'
|
30
29
|
spec.add_dependency 'faraday_middleware', '~> 0.10.0'
|
data/lib/builderator/config.rb
CHANGED
@@ -14,7 +14,7 @@ module Builderator
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def all_layers
|
17
|
-
([
|
17
|
+
([defaults] + layers + [overrides, argv])
|
18
18
|
end
|
19
19
|
|
20
20
|
def defaults
|
@@ -47,10 +47,13 @@ module Builderator
|
|
47
47
|
layers.unshift(File.from_json(path)) if ::File.exist?(path)
|
48
48
|
end
|
49
49
|
|
50
|
-
def compile(max_iterations =
|
50
|
+
def compile(max_iterations = 6)
|
51
51
|
compiled.unseal
|
52
52
|
compile_iterations = 0
|
53
53
|
|
54
|
+
## Initialize with global defaults
|
55
|
+
compiled.merge(GLOBAL_DEFAULTS.compile)
|
56
|
+
|
54
57
|
## Automatically recompile while layers are dirty
|
55
58
|
loop do
|
56
59
|
fail "Re-compile iteration limit of #{max_iterations} has been exceeded" if compile_iterations >= max_iterations
|
@@ -58,8 +61,13 @@ module Builderator
|
|
58
61
|
## Reset flags before next iteration
|
59
62
|
compiled.clean
|
60
63
|
|
61
|
-
## Merge layers from lowest to highest
|
62
|
-
all_layers.each
|
64
|
+
## Merge layers from lowest to highest. Compile, then merge.
|
65
|
+
all_layers.each(&:compile)
|
66
|
+
all_layers.each do |layer|
|
67
|
+
compiled.merge(layer)
|
68
|
+
|
69
|
+
layer.policies.each { |_, policy| compiled.merge(policy) }
|
70
|
+
end
|
63
71
|
|
64
72
|
break unless dirty?
|
65
73
|
compile_iterations += 1
|
@@ -75,7 +83,7 @@ module Builderator
|
|
75
83
|
end
|
76
84
|
|
77
85
|
def compiled
|
78
|
-
@compiled ||= File.new
|
86
|
+
@compiled ||= File.new({}, :source => 'compiled')
|
79
87
|
end
|
80
88
|
|
81
89
|
def fetch(key, *args)
|
@@ -67,7 +67,8 @@ module Builderator
|
|
67
67
|
define_method(namespace_name) do |&block|
|
68
68
|
nodes[namespace_name] ||= namespace_class.new(
|
69
69
|
@attributes[namespace_name],
|
70
|
-
:name => namespace_name,
|
70
|
+
:name => namespace_name,
|
71
|
+
:parent => self, &block).compile
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -116,22 +117,38 @@ module Builderator
|
|
116
117
|
self
|
117
118
|
end
|
118
119
|
|
120
|
+
## All dirty state should aggregate at the root node
|
121
|
+
def dirty
|
122
|
+
return @dirty if parent == self
|
123
|
+
parent.dirty
|
124
|
+
end
|
125
|
+
|
126
|
+
def dirty=(set)
|
127
|
+
return @dirty = set if parent == self
|
128
|
+
parent.dirty = set
|
129
|
+
end
|
130
|
+
|
131
|
+
def ==(other)
|
132
|
+
attributes == other.attributes
|
133
|
+
end
|
134
|
+
|
119
135
|
attr_reader :attributes
|
120
136
|
attr_reader :nodes
|
121
|
-
attr_reader :
|
137
|
+
attr_reader :parent
|
122
138
|
|
123
|
-
def initialize(attributes = {}, &block)
|
139
|
+
def initialize(attributes = {}, options = {}, &block)
|
124
140
|
@attributes = Rash.coerce(attributes)
|
125
141
|
@nodes = {}
|
126
142
|
@block = block
|
127
143
|
|
128
|
-
## Track change status for
|
129
|
-
@
|
144
|
+
## Track change status for consumers
|
145
|
+
@parent = options.fetch(:parent, self)
|
146
|
+
self.dirty = false if parent == self
|
130
147
|
end
|
131
148
|
|
132
149
|
## Clear dirty state flag
|
133
150
|
def clean
|
134
|
-
|
151
|
+
self.dirty = false
|
135
152
|
end
|
136
153
|
|
137
154
|
def compile
|
@@ -140,7 +157,7 @@ module Builderator
|
|
140
157
|
end
|
141
158
|
|
142
159
|
def merge(other)
|
143
|
-
attributes.merge!(other.attributes)
|
160
|
+
self.dirty |= attributes.merge!(other.attributes)
|
144
161
|
self
|
145
162
|
end
|
146
163
|
alias_method :includes, :merge
|
@@ -165,7 +182,7 @@ module Builderator
|
|
165
182
|
## Unchanged
|
166
183
|
return if @attributes[key] == arg
|
167
184
|
|
168
|
-
|
185
|
+
self.dirty |= true ## A mutation has occured
|
169
186
|
@attributes[key] = arg
|
170
187
|
end
|
171
188
|
|
@@ -177,7 +194,7 @@ module Builderator
|
|
177
194
|
|
178
195
|
return if arg.empty?
|
179
196
|
|
180
|
-
@dirty
|
197
|
+
@dirty |= true ## A mutation has occured
|
181
198
|
attribute.push(*arg)
|
182
199
|
end
|
183
200
|
|
@@ -227,7 +244,7 @@ module Builderator
|
|
227
244
|
attr_reader :collection
|
228
245
|
|
229
246
|
def initialize(attributes, options = {}, &block)
|
230
|
-
super(attributes, &block)
|
247
|
+
super(attributes, options, &block)
|
231
248
|
|
232
249
|
@name = options.fetch(:name, self.class.name)
|
233
250
|
@collection = options[:collection]
|
@@ -278,7 +295,8 @@ module Builderator
|
|
278
295
|
self.class.namespace_class.new(
|
279
296
|
attributes[instance_name],
|
280
297
|
:collection => self,
|
281
|
-
:name => instance_name,
|
298
|
+
:name => instance_name,
|
299
|
+
:parent => self, &block)
|
282
300
|
end
|
283
301
|
alias_method :[], :fetch
|
284
302
|
end
|
@@ -30,13 +30,16 @@ module Builderator
|
|
30
30
|
attr_reader :date ## Provide an authoritative, UTC-based date for any consumers
|
31
31
|
attr_reader :source ## Where the instance was defined
|
32
32
|
attr_reader :type ## How compile should populate attributes
|
33
|
+
attr_reader :policies
|
33
34
|
|
34
35
|
def initialize(attributes = {}, options = {}, &block)
|
35
|
-
|
36
|
+
@policies = {}
|
36
37
|
|
37
38
|
@date = Time.now.utc
|
38
39
|
@type = options.fetch(:type, :code)
|
39
40
|
@source = options.fetch(:source, nil)
|
41
|
+
|
42
|
+
super(attributes, &block)
|
40
43
|
end
|
41
44
|
|
42
45
|
def compile
|
@@ -46,22 +49,29 @@ module Builderator
|
|
46
49
|
when :file
|
47
50
|
instance_eval(IO.read(source), source, 0)
|
48
51
|
when :json
|
49
|
-
|
52
|
+
update = Rash.coerce(JSON.parse(IO.read(source)))
|
53
|
+
|
54
|
+
unless @attributes == update
|
55
|
+
@dirty |= true
|
56
|
+
@attributes = update
|
57
|
+
end
|
50
58
|
else
|
51
59
|
instance_eval(&@block) if @block
|
52
60
|
end
|
53
61
|
|
54
62
|
## Overlay policies
|
55
|
-
policy.each do |
|
63
|
+
policy.each do |name, policy|
|
56
64
|
if policy.has?(:path)
|
57
65
|
next unless ::File.exist?(policy.path)
|
58
|
-
|
59
|
-
end
|
66
|
+
policies[name] ||= self.class.from_file(policy.path)
|
60
67
|
|
61
|
-
|
68
|
+
elsif policy.has?(:json)
|
62
69
|
next unless ::File.exist?(policy.json)
|
63
|
-
|
70
|
+
policies[name] ||= self.class.from_json(policy.json)
|
64
71
|
end
|
72
|
+
|
73
|
+
policies[name].compile
|
74
|
+
self.dirty |= policies[name].dirty
|
65
75
|
end
|
66
76
|
|
67
77
|
self
|
@@ -47,23 +47,36 @@ module Builderator
|
|
47
47
|
def merge!(other)
|
48
48
|
fail TypeError, 'Argument other of `Rash#merge!(other)` must be a Hash.'\
|
49
49
|
" Recieved #{other.class}" unless other.is_a?(Hash)
|
50
|
+
dirty = false
|
50
51
|
|
51
52
|
other.each do |k, v|
|
52
53
|
## Replace `-`s with `_`s in in String keys
|
53
54
|
k = k.gsub(/\-/, '_') if k.is_a?(String)
|
54
55
|
|
56
|
+
next if self[k] == v
|
57
|
+
|
55
58
|
## Merge Arrays
|
56
|
-
|
59
|
+
if fetch(k, nil).is_a?(Array) && v.is_a?(Array)
|
60
|
+
next if (self[k] | v) == self[k]
|
61
|
+
|
62
|
+
dirty |= true
|
63
|
+
next self[k] |= v
|
64
|
+
end
|
57
65
|
|
58
66
|
## Overwrite non-Hash values
|
59
|
-
|
67
|
+
unless v.is_a?(Hash)
|
68
|
+
dirty |= true
|
69
|
+
next self[k] = v
|
70
|
+
end
|
60
71
|
|
61
72
|
## Replace `self[k]` with a new Rash unless it already is one
|
62
73
|
self[k] = self.class.new unless fetch(k, nil).is_a?(self.class)
|
63
74
|
|
64
75
|
## Merge recursivly coerces `v` to a Rash
|
65
|
-
self[k].merge!(v)
|
76
|
+
dirty |= self[k].merge!(v)
|
66
77
|
end
|
78
|
+
|
79
|
+
dirty
|
67
80
|
end
|
68
81
|
|
69
82
|
def to_hash
|
@@ -32,7 +32,7 @@ module Builderator
|
|
32
32
|
desc 'bump TYPE [PRERELEASE_NAME]', 'Increment the package version, optionally with a named prerelease'
|
33
33
|
def bump(type = :auto, prerelease_name = nil)
|
34
34
|
## Guard: Don't try to create a new version if `create_tags` is explicitly disabled
|
35
|
-
## or `search_tags` is disabled as we won't have a
|
35
|
+
## or `search_tags` is disabled as we won't have a valid current version to increment
|
36
36
|
unless Config.autoversion.create_tags && Config.autoversion.search_tags
|
37
37
|
say_status :disabled, 'Tag creation is disabled for this build. Not '\
|
38
38
|
'creating new SCM tags!', :red
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: builderator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.rc.
|
4
|
+
version: 1.0.0.pre.rc.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Manero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.7.0
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.7.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: berkshelf
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,11 +162,11 @@ executables:
|
|
176
162
|
extensions: []
|
177
163
|
extra_rdoc_files: []
|
178
164
|
files:
|
165
|
+
- Buildfile
|
179
166
|
- Gemfile
|
180
167
|
- Gemfile.lock
|
181
168
|
- LICENSE.txt
|
182
169
|
- README.md
|
183
|
-
- Rakefile
|
184
170
|
- Thorfile
|
185
171
|
- VERSION
|
186
172
|
- bin/build
|
@@ -233,7 +219,6 @@ files:
|
|
233
219
|
- lib/builderator/util/aws_exception.rb
|
234
220
|
- lib/builderator/util/limit_exception.rb
|
235
221
|
- lib/builderator/util/task_exception.rb
|
236
|
-
- mkmf.log
|
237
222
|
- spec/config_spec.rb
|
238
223
|
- spec/data/Berksfile
|
239
224
|
- spec/data/Buildfile
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
data/mkmf.log
DELETED