henry-container 0.1.40 → 0.1.41

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af13a1103b532c04042d9acb667f6a38bf3602cd
4
- data.tar.gz: dbe5db8483a5acb94680a9247330d316df442373
3
+ metadata.gz: d23b417804c321844f8621736e8a7837cdb0a47a
4
+ data.tar.gz: 958bd3d63376a824b22363ae5e9ebb9c36efd0a6
5
5
  SHA512:
6
- metadata.gz: 374b77a583c104229c3ad29b49d6cbd828394147a8dc79aeb40838aa7b26bc625b7bfc5c58caa968500a1da90bf2f229d58e036b0b3fcc1ae8b1b8a610c279f6
7
- data.tar.gz: ceed470e6d90012828353c1ab84d6b7c51a73526b279aa63b4d1493d92911a27ed698c4be9f77fe45c4645b22c0b73b7bd885b3b213d878b6689c5949e0ec643
6
+ metadata.gz: d41bd65ef5b858a04e02bf84186c2be29171894a368f457cba52845e355fa8e7b64d311027b48630388a29ec101b8afc6803bfbff15bed01a795f3cff3f980f6
7
+ data.tar.gz: 9ea4144a20a3bd58ef77423287c46d9125b2e899b16855fc92cbd8ea52683ecd478ac7cbde97cad46d134b234ddb77b3c9f3b4571323263d614b602fa5cbac52
@@ -0,0 +1,10 @@
1
+ module Henry
2
+
3
+ class Config < Henry::Input
4
+
5
+ # ENV key where the Config will be exported to/imported from.
6
+ EXPORT_KEY = 'HENRY_CONFIG'
7
+
8
+ end
9
+
10
+ end
@@ -38,8 +38,9 @@ module Henry
38
38
  self.tasks.select {|task| task.enabled?}.each do |task|
39
39
  task_params = (params['all'] || {}).merge(params[task.name] || {})
40
40
 
41
- task.configure(task_params,self.task_extended_context(task.name), self.default_task_options)
41
+ task.configure(task_params,self.task_extended_context(task.name))
42
42
  task.export_params(task_params)
43
+ task.export_config({output_directory:task.data.system[:output_directory]})
43
44
  task.execution.params = task_params
44
45
  task.before_execute
45
46
  self.execute_task(task)
@@ -80,7 +81,7 @@ module Henry
80
81
  json_parse_error: 'templates/errors/json_parse_error.json'
81
82
  }
82
83
 
83
- def default_task_options
84
+ def default_task_system_context
84
85
  {
85
86
  output_directory: self.output_directory
86
87
  }
@@ -256,7 +257,7 @@ module Henry
256
257
  # @return [<Task>] tasks to be executed.
257
258
  def build_tasks
258
259
  tasks = self.context.tasks.collect do |task_data|
259
- Task.create(task_data["name"], task_data)
260
+ Task.create(task_data["name"], task_data.merge({system: self.default_task_system_context}))
260
261
  end
261
262
 
262
263
  return tasks if self.task_hints.empty?
@@ -3,7 +3,7 @@ module Henry
3
3
  class Container
4
4
 
5
5
  # Current Gem version
6
- VERSION = '0.1.40'
6
+ VERSION = '0.1.41'
7
7
 
8
8
  end
9
9
 
@@ -16,7 +16,11 @@ module Henry
16
16
  # The path to the default file export directory
17
17
  #
18
18
  # @return [String]
19
- EXPORT_FILE_PATH = "/output"
19
+ DEFAULT_OUTPUT_DIRECTORY = "./output"
20
+
21
+ def self.config
22
+ @@config ||= Config.import!.params
23
+ end
20
24
 
21
25
  # Imports and returs the Task execution parameters.
22
26
  #
@@ -37,7 +41,14 @@ module Henry
37
41
  #
38
42
  # @param [String] path the path of the file to be exported.
39
43
  def self.export_file(path)
40
- FileUtils.copy_file(path, "#{EXPORT_FILE_PATH}/#{File.basename(path)}")
44
+ FileUtils.copy_file(path, "#{Henry::Environment.output_path}/#{File.basename(path)}")
45
+ end
46
+
47
+ # Returns the current output path for attachments.
48
+ #
49
+ # @param [String] the attachments path.
50
+ def self.output_path
51
+ Heny::Environment.config['output_directory'] || DEFAULT_OUTPUT_DIRECTORY
41
52
  end
42
53
 
43
54
  end
@@ -51,6 +51,13 @@ module Henry
51
51
  Input.export!(params)
52
52
  end
53
53
 
54
+ # Exports the Task config to the ENV.
55
+ #
56
+ # @param [Hash] params the Task config to be exported.
57
+ def export_config(config)
58
+ Config.export!(config)
59
+ end
60
+
54
61
  # Returns the Task Execution.
55
62
  #
56
63
  # @return [Execution]
@@ -96,7 +103,7 @@ module Henry
96
103
 
97
104
  # Nothing to be done here...
98
105
  # The Task configuration code should be defined under this method on the specific Task class.
99
- def configure(params, extended_context={}, options={})
106
+ def configure(params, extended_context={})
100
107
  end
101
108
 
102
109
  end
@@ -45,7 +45,7 @@ module Henry
45
45
 
46
46
  def after_execute
47
47
  if self.execution.code != 'OK' && !(self.generated_reports || []).empty? && !(self.report_recipients || []).empty?
48
- tgz_path = "#{self.base_output_path}/#{DateTime.now.strftime(TIME_FORMAT)}_#{self.name}.tgz"
48
+ tgz_path = "#{self.base_output_path}/#{DateTime.now.strftime(TIME_FORMAT)}_#{self.name}.tgz"
49
49
 
50
50
  `tar czf "#{tgz_path}" "#{self.generated_reports.join('" "')}"`
51
51
 
@@ -61,21 +61,14 @@ module Henry
61
61
  #
62
62
  # @return [String] the base output path.
63
63
  def base_output_path
64
- @base_output_path ||= DEFAULT_OUTPUT_BASE_PATH
65
- end
66
-
67
- # Sets the output base path.
68
- def base_output_path=(path)
69
- @base_output_path = path
64
+ @base_output_path ||= (self.data.system[:output_directory] ? "#{self.data.system[:output_directory]}/output" : DEFAULT_OUTPUT_BASE_PATH)
70
65
  end
71
66
 
72
67
  # Configures the Task.
73
68
  #
74
69
  # @param [Hash] params the task params.
75
70
  # @param [Hash] extended_context task extended context.
76
- def configure(params, extended_context={}, options={})
77
- self.base_output_path = "#{options[:output_directory]}/output" if options[:output_directory]
78
-
71
+ def configure(params, extended_context={})
79
72
  File.open(OUT_PATH, 'w') { |f| }
80
73
 
81
74
  # Makes available the cucumber rake task.
@@ -33,20 +33,13 @@ module Henry
33
33
  #
34
34
  # @return [String] the base output path.
35
35
  def base_output_path
36
- @base_output_path ||= DEFAULT_OUTPUT_BASE_PATH
36
+ @base_output_path ||= (self.data.system[:output_directory] ? "#{self.data.system[:output_directory]}/output" : DEFAULT_OUTPUT_BASE_PATH)
37
37
  end
38
-
39
- # Sets the output base path.
40
- def base_output_path=(path)
41
- @base_output_path = path
42
- end
43
-
38
+
44
39
  # Configures the Task.
45
40
  #
46
41
  # @param [Hash] params the task params.
47
- def configure(params, extended_context={}, options={})
48
- self.base_output_path = options[:output_directory] if options[:output_directory]
49
-
42
+ def configure(params, extended_context={})
50
43
  File.open(OUT_PATH, 'w') { |f| }
51
44
 
52
45
  pattern = params['pattern'] || './spec{,/*/**}/*_spec.rb'
@@ -53,21 +53,14 @@ module Henry
53
53
  #
54
54
  # @return [String] the base output path.
55
55
  def base_output_path
56
- @base_output_path ||= DEFAULT_OUTPUT_BASE_PATH
57
- end
58
-
59
- # Sets the output base path.
60
- def base_output_path=(path)
61
- @base_output_path = path
56
+ @base_output_path ||= (self.data.system[:output_directory] ? "#{self.data.system[:output_directory]}/output" : DEFAULT_OUTPUT_BASE_PATH)
62
57
  end
63
58
 
64
59
  # Configures the Task.
65
60
  #
66
61
  # @param [Hash] params the task params.
67
62
  # @param [Hash] extended_context the task extended context.
68
- def configure(params, extended_context={}, options={})
69
- self.base_output_path = "#{options[:output_directory]}/output" if options[:output_directory]
70
-
63
+ def configure(params, extended_context={})
71
64
  File.open(OUT_PATH, 'w') { |f| }
72
65
 
73
66
  # Makes available the spec rake task.
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.40
4
+ version: 0.1.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Decurnex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-31 00:00:00.000000000 Z
11
+ date: 2013-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -140,6 +140,7 @@ files:
140
140
  - henry-context.yml.sample
141
141
  - in.henry.sample
142
142
  - lib/henry.rb
143
+ - lib/henry/config.rb
143
144
  - lib/henry/container.rb
144
145
  - lib/henry/container/version.rb
145
146
  - lib/henry/email_client.rb