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

- old
+ new

@@ -11,12 +11,15 @@ attr_accessor :generated_reports, :report_recipients # The temporary output file path for the RspecTask execution. OUT_PATH = 'cucumber.out' + # Default base output directory + DEFAULT_OUTPUT_BASE_DIR = '.henry' + # The reports path template. - REPORTS_DIR = '.henry/reports/${FORMAT}' + REPORTS_DIR = 'reports/${FORMAT}' # Default time format to be used in the reports filepath. TIME_FORMAT = '%Y-%m-%dT%H%M%S' # The Cucumber Rake Application name. @@ -52,24 +55,38 @@ end super end + # Returns output base path + # + # @return [String] the base output path. + def base_output_path + @base_output_path ||= DEFAULT_OUTPUT_BASE_PATH + end + + # Sets the output base path. + def base_output_path=(path) + @base_output_path = path + end + # Configures the Task. # # @param [Hash] params the task params. # @param [Hash] extended_context task extended context. - def configure(params, extended_context={}) + def configure(params, extended_context={}, options={}) + self.base_output_path = "#{options[:output_directory]}/output}" if options[:output_directory] + File.open(OUT_PATH, 'w') { |f| } # Makes available the cucumber rake task. Rake.application.clear Cucumber::Rake::Task.new do |t| if self.data.options t.cucumber_opts = "#{self.custom_options} #{extended_context['options']}" else - t.cucumber_opts = "#{self.default_options} #{extended_context['options']}" + t.cucumber_opts = "#{self.default_options()} #{extended_context['options']}" end end super end @@ -174,10 +191,10 @@ # Interpolates and returns the reports directory for the given format. # # @param [String] format the formatter name. # @return [Stiring] the reports directory. def reports_dir(format) - REPORTS_DIR.gsub(/\${[A-Z_]+}/, '${FORMAT}' => format).gsub(' ', '_') + "#{self.base_output_path}/#{REPORTS_DIR}".gsub(/\${[A-Z_]+}/, '${FORMAT}' => format).gsub(' ', '_') end end end