Class: Henry::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/henry/environment.rb

Overview

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

Constant Summary collapse

DEFAULT_OUTPUT_DIRECTORY =

The path to the default file export directory

Returns:

  • (String)
".output"

Class Method Summary collapse

Class Method Details

.configObject



21
22
23
# File 'lib/henry/environment.rb', line 21

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

.export_file(path) ⇒ Object

Copies the file from the given path to the default export directory

Parameters:

  • path (String)

    the path of the file to be exported.



43
44
45
46
# File 'lib/henry/environment.rb', line 43

def self.export_file(path)
  FileUtils.mkdir_p(Henry::Environment.output_path)
  FileUtils.copy_file(path, "#{Henry::Environment.output_path}/#{File.basename(path)}")
end

.loggerLogger

Gets the Task Logger instance vis DBr.

Returns:

  • (Logger)

    the Task Logger instance.



35
36
37
38
# File 'lib/henry/environment.rb', line 35

def self.logger
  Logger.new
  #return DRbObject.new_with_uri(LoggerService::DRB_URI)
end

.output_pathObject

Returns the current output path for attachments.

Parameters:

  • the (String)

    attachments path.



51
52
53
# File 'lib/henry/environment.rb', line 51

def self.output_path
  "#{Henry::Environment.config['output_directory']}/output" || DEFAULT_OUTPUT_DIRECTORY
end

.paramsHash

Imports and returs the Task execution parameters.

Returns:

  • (Hash)

    the Task execution parameters



28
29
30
# File 'lib/henry/environment.rb', line 28

def self.params
  @@params ||= Input.import!.params 
end