Sha256: 6de8be9fde533065bb351768fb431f56a341bf8e590761bcd6c52cf7553f6e59

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'rake'
require 'cucumber/rake/task'
 
module Henry
  
  class Task
    
    # The Henry Task implementation for Cucumber
    class CucumberTask < Task
 
      # Makes available the cucumber rake task.
      Cucumber::Rake::Task.new do |t|
        t.cucumber_opts = %w{--out cucumber.out}
      end
      
      # Executes the CucumberTask and returns its results.
      #
      # @return [Hash] the CucumberTask results.
      def execute(params)
        begin
          File.open('cucumber.out', 'w') { |f| }

          #tail_pid = Process.spawn('tail -f cucumber.out')

          Rake.application['cucumber'].invoke 
 
          #Process.kill(:SIGINT, tail_pid)

          {
            code:0,
            message:"OK",
            data:File.open('cucumber.out', 'r').read,
            stacktrace:nil
          }
        rescue Exception => e
          {
            code:2,
            message:e.message,
            data:File.open('cucumber.out', 'r').read,
            stacktrace:e.backtrace
          }
        end
      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
henry-container-0.0.14 lib/henry/task/cucumber_task.rb
henry-container-0.0.13 lib/henry/task/cucumber_task.rb
henry-container-0.0.12 lib/henry/task/cucumber_task.rb
henry-container-0.0.11 lib/henry/task/cucumber_task.rb
henry-container-0.0.10 lib/henry/task/cucumber_task.rb
henry-container-0.0.9 lib/henry/task/cucumber_task.rb
henry-container-0.0.8 lib/henry/task/cucumber_task.rb