henry-container 0.1.80 → 0.1.81
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/bin/henry-ruby-container +1 -0
- data/lib/henry/container/version.rb +1 -1
- data/lib/henry/container.rb +59 -0
- 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: 1f0a4f0c542c76c485ed04e999512efcf472ea73
|
4
|
+
data.tar.gz: 24b631becfa803eef78d2e5a346635e64547272c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6e2909492c309de7142c0a7503a50a36b4acef2a29ed2856ee125089d433181463f89615acb630647001f6e955eea19661151e65817dcfe1ec68dc6eea664cc
|
7
|
+
data.tar.gz: 1aa40c72460521b2c60b1a50fb4ace0352e9b8fb5f111b27787cb0bbe0c05369e09056777a60dbb740e7b6e43b5e9cacd600eef67ab8146807a661e2f794f960
|
data/bin/henry-ruby-container
CHANGED
@@ -24,6 +24,7 @@ BANNER
|
|
24
24
|
opt :hints, "Custom name for the task hints (tasks to be executed) file.", :default => 'hints.henry'
|
25
25
|
opt :"hints-dir", "Custom dir path where the task hints (tasks to be executed) will be read from.", :default => '.'
|
26
26
|
opt :"output-dir", "Custom dir path where the task output files will be stored.", :default => '.'
|
27
|
+
opt :"reload-params", "Creates a dynamic in file based on the defined in-rules and the in-files"
|
27
28
|
end
|
28
29
|
|
29
30
|
Henry::Container.new(opts).execute
|
data/lib/henry/container.rb
CHANGED
@@ -203,6 +203,14 @@ TASK
|
|
203
203
|
"#{@opts[:"in-dir"]}/#{@opts[:hints]}"
|
204
204
|
end
|
205
205
|
|
206
|
+
# Return true whenever the execution requires the regeneration of the
|
207
|
+
# in files.
|
208
|
+
#
|
209
|
+
# @return [TrueClas|FalseClass] whether the exuction requires to regenerate the in files.
|
210
|
+
def reload_params?
|
211
|
+
@opts[:"reload-params"]
|
212
|
+
end
|
213
|
+
|
206
214
|
# Executes required validations before execution.
|
207
215
|
def before_execution
|
208
216
|
unless File.exists?('henry-context.yml')
|
@@ -221,6 +229,8 @@ TASK
|
|
221
229
|
#
|
222
230
|
# @return [<{String => String}>] collection of execution params.
|
223
231
|
def load_params
|
232
|
+
self.reload_params!
|
233
|
+
|
224
234
|
return [{}] unless File.exists?(self.input_file_path)
|
225
235
|
|
226
236
|
params = JSON.parse(File.read(self.input_file_path))
|
@@ -230,6 +240,55 @@ TASK
|
|
230
240
|
params
|
231
241
|
end
|
232
242
|
|
243
|
+
# Creates a dynamic in.henry based on the in-rules and
|
244
|
+
# in-files.
|
245
|
+
def reload_params!
|
246
|
+
return false unless self.reload_params?
|
247
|
+
|
248
|
+
in_files_params = self.in_files_params
|
249
|
+
|
250
|
+
in_rules = self.in_rules
|
251
|
+
|
252
|
+
params = in_rules.collect do |rule|
|
253
|
+
rule.inject({}) do |param, in_file|
|
254
|
+
in_files_params[in_file].each do |key, value|
|
255
|
+
param[key] ||= {}
|
256
|
+
|
257
|
+
param[key].merge!(value)
|
258
|
+
end
|
259
|
+
|
260
|
+
param
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
File.open(self.input_file_path, 'w') do |input_file|
|
265
|
+
JSON.dump(params, input_file)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
# Loads and returns all the in-files as a hash
|
270
|
+
#
|
271
|
+
# @return [Hash] the in-files with its values.
|
272
|
+
def in_files_params
|
273
|
+
return @in_files_params if @in_files_params
|
274
|
+
|
275
|
+
@in_file_params = {}
|
276
|
+
|
277
|
+
Dir.new('./in-files').each do |file_name|
|
278
|
+
next if file_name.match(/^\.+$/)
|
279
|
+
@in_file_params[file_name] = JSON.parse(File.read("./in-files/#{file_name}"))
|
280
|
+
end
|
281
|
+
|
282
|
+
return @in_file_params
|
283
|
+
end
|
284
|
+
|
285
|
+
# Loads and returns the in-rules as hash.
|
286
|
+
#
|
287
|
+
# @return [Hash] the in-file values.
|
288
|
+
def in_rules
|
289
|
+
@in_rules ||= JSON.parse(File.read('in-rules.henry'))
|
290
|
+
end
|
291
|
+
|
233
292
|
# Returns the default params.
|
234
293
|
# @note Custom task_params will overwrite the defaults.
|
235
294
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: henry-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.81
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Decurnex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|