henry-container 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/bin/henry-ruby-container
CHANGED
@@ -14,8 +14,10 @@ Usage:
|
|
14
14
|
where [options] are:
|
15
15
|
BANNER
|
16
16
|
|
17
|
-
opt :out, "Custom
|
18
|
-
opt :
|
17
|
+
opt :out, "Custom name for the results file.", :default => 'out.henry'
|
18
|
+
opt :"out-dir", "Custom dir path where the results will be written", :default => './'
|
19
|
+
opt :in, "Custom name for the input file.", :default => 'in.henry'
|
20
|
+
opt :"in-dir", "Custom dir path where the input will be read from.", :default => './'
|
19
21
|
end
|
20
22
|
|
21
23
|
Henry::Container.new(opts).execute
|
Binary file
|
Binary file
|
data/lib/henry/container.rb
CHANGED
@@ -46,10 +46,24 @@ module Henry
|
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
49
|
+
# Returns the input file path based on the given options.
|
50
|
+
#
|
51
|
+
# @return [String] the input file path.
|
52
|
+
def input_file_path
|
53
|
+
"#{@opts[:"in-dir"]}#{@opts[:in]}"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns the output file path based on the given options.
|
57
|
+
#
|
58
|
+
# @return [String] the output file path.
|
59
|
+
def output_file_path
|
60
|
+
"#{@opts[:"out-dir"]}#{@opts[:out]}"
|
61
|
+
end
|
62
|
+
|
49
63
|
# Executes required validations before execution.
|
50
64
|
def before_execution
|
51
|
-
unless File.exists?(
|
52
|
-
abort "#{"'#{
|
65
|
+
unless File.exists?(self.input_file_path)
|
66
|
+
abort "#{"'#{self.input_file_path}' file does not exist.".red}\n #{'*'.red} If running isolated make sure to create it first.\n #{'*'.red} If running from Henry contact us at henry@despegar.it."
|
53
67
|
end
|
54
68
|
|
55
69
|
unless File.exists?('henry-context.yml')
|
@@ -62,7 +76,7 @@ module Henry
|
|
62
76
|
#
|
63
77
|
# @return [{String => String}] the execution params.
|
64
78
|
def params
|
65
|
-
@params ||= JSON.parse(File.read(
|
79
|
+
@params ||= JSON.parse(File.read(self.input_file_path))
|
66
80
|
end
|
67
81
|
|
68
82
|
# Returns the default params.
|
@@ -128,7 +142,7 @@ module Henry
|
|
128
142
|
|
129
143
|
# Writes into @opts[:out] the execution results.
|
130
144
|
def dump_results
|
131
|
-
File.open(
|
145
|
+
File.open(self.output_file_path, 'w') { |f| f.write(results.to_json) }
|
132
146
|
end
|
133
147
|
|
134
148
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: henry-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -126,6 +126,8 @@ files:
|
|
126
126
|
- doc/method_list.html
|
127
127
|
- doc/top-level-namespace.html
|
128
128
|
- gems/henry-container-0.0.1.gem
|
129
|
+
- gems/henry-container-0.0.2.gem
|
130
|
+
- gems/henry-container-0.0.3.gem
|
129
131
|
- henry-container.gemspec
|
130
132
|
- henry-context.yml.sample
|
131
133
|
- in.henry.sample
|