lib/henry/container.rb in henry-container-0.1.36 vs lib/henry/container.rb in henry-container-0.1.38

- old
+ new

@@ -36,11 +36,11 @@ tasks_results_set = [] self.tasks.select {|task| task.enabled?}.each do |task| task_params = (params['all'] || {}).merge(params[task.name] || {}) - task.configure(task_params,self.task_extended_context(task.name)) + task.configure(task_params,self.task_extended_context(task.name), self.default_task_options) task.export_params(task_params) task.execution.params = task_params task.before_execute self.execute_task(task) @@ -78,10 +78,16 @@ # @return [Hash] the paths of the out.henry templates TEMPLATE_PATHS = { json_parse_error: 'templates/errors/json_parse_error.json' } + def default_task_options + { + output_directory: self.output_directory + } + end + # Executes the task inside a timeout (defined by the task itself). # On Timeout::Error adds an erro mmessage to the Task Execution. # # @param [Henry::Task] task the task to be executed. def execute_task(task) @@ -99,15 +105,22 @@ # # @return [String] the input file path. def input_file_path "#{@opts[:"in-dir"]}/#{@opts[:in]}" end - + + # Returns the output directory path based on the given options. + # + # @return [String] the output directory path. + def output_directory + @opts[:"out-dir"] + end + # Returns the output file path based on the given options. # # @return [String] the output file path. def output_file_path - "#{@opts[:"out-dir"]}/#{@opts[:out]}" + "#{self.output_directory}/#{@opts[:out]}" end # Returns the task hints file path based on the given options. # # @return [String] the task hints file path.