Sha256: c4b54554f62c72c4c2397be96c828378b99286f7873388745254081eea086c05

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

require 'drb/drb'
require 'fileutils'
require 'json'
require 'colorize'

require 'henry/input'
require 'henry/logger'
require 'henry/logger_service'

module Henry

  # Henry Environmet.
  # To be used as proxy to access the Task execution params from the tests
  class Environment

    # The path to the default file export directory
    #
    # @return [String]
    DEFAULT_OUTPUT_DIRECTORY = "./output"

    def self.config
      @@config ||= Henry::Config.import!.params 
    end

    # Imports and returs the Task execution parameters.
    # 
    # @return [Hash] the Task execution parameters
    def self.params
      @@params ||= Input.import!.params 
    end

    # Gets the Task Logger instance vis DBr.
    #
    # @return [Logger] the Task Logger instance.
    def self.logger
      Logger.new
      #return DRbObject.new_with_uri(LoggerService::DRB_URI)
    end

    # Copies the file from the given path to the default export directory
    #
    # @param [String] path the path of the file to be exported.
    def self.export_file(path)
      FileUtils.copy_file(path, "#{Henry::Environment.output_path}/#{File.basename(path)}")
    end

    # Returns the current output path for attachments.
    #
    # @param [String] the attachments path.
    def self.output_path
      Heny::Environment.config['output_directory'] || DEFAULT_OUTPUT_DIRECTORY
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
henry-container-0.1.47 lib/henry/environment.rb
henry-container-0.1.46 lib/henry/environment.rb
henry-container-0.1.45 lib/henry/environment.rb
henry-container-0.1.44 lib/henry/environment.rb
henry-container-0.1.43 lib/henry/environment.rb
henry-container-0.1.42 lib/henry/environment.rb