Sha256: 4ef72ec68eab7423ea1e1ad0afff45395c6ec4b947ab75d5ae2f207901bb346a

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

require 'rake'

module Henry

  class Task

    # The Henry Task implementation for Rake Tasks
    class RakeTask < Task

      # The temporary output file path for the RakeTask execution.
      #
      # @return [String] the output file path.
      OUT_PATH = 'rake.out'

      # The Rake Application name.
      #
      # @return [String] the rake application name.
      APPLICATION_NAME = 'rake'

      # Executes the Task and returns its results.
      def execute
        begin 
          Rake.application[self.application_name].invoke 
 
          self.execution.code = 'OK'
          self.execution.message = 'OK'
          self.execution.output = File.open(self.out_path, 'r').read
          self.execution.log = self.logger.log_as_hash
        rescue Exception => e
          self.execution.code = 'ERROR'
          self.execution.message = e.message
          self.execution.output = File.open(self.out_path, 'r').read
          self.execution.backtrace = e.backtrace
          self.execution.log = self.logger.log_as_hash
        end
      end

    end
  
  end

end
require_relative 'cucumber_task'
require_relative 'rspec_task'
require_relative 'minitest_task'

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
henry-container-0.1.10 lib/henry/task/rake_task.rb
henry-container-0.1.9 lib/henry/task/rake_task.rb
henry-container-0.1.8 lib/henry/task/rake_task.rb
henry-container-0.1.7 lib/henry/task/rake_task.rb
henry-container-0.1.6 lib/henry/task/rake_task.rb
henry-container-0.1.5 lib/henry/task/rake_task.rb
henry-container-0.1.4 lib/henry/task/rake_task.rb
henry-container-0.1.3 lib/henry/task/rake_task.rb
henry-container-0.1.1 lib/henry/task/rake_task.rb