Class: Henry::Environment
- Inherits:
-
Object
- Object
- Henry::Environment
- 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
".output"
Class Method Summary collapse
- .config ⇒ Object
-
.execution ⇒ Execution
Gets the Task Execution instance via DBr.
-
.export_file(path) ⇒ Object
Copies the file from the given path to the default export directory.
-
.logger ⇒ Logger
Gets the Task Logger instance via DBr.
-
.output_path ⇒ Object
Returns the current output path for attachments.
-
.params ⇒ Hash
Imports and returs the Task execution parameters.
- .warning!(message = nil) ⇒ Object
Class Method Details
.config ⇒ Object
23 24 25 |
# File 'lib/henry/environment.rb', line 23 def self.config @@config ||= Henry::Config.import!.params end |
.execution ⇒ Execution
Gets the Task Execution instance via DBr.
48 49 50 |
# File 'lib/henry/environment.rb', line 48 def self.execution return @@execution ||= DRbObject.new_with_uri(ENV['DRB_EXECUTION_URI']) end |
.export_file(path) ⇒ Object
Copies the file from the given path to the default export directory
60 61 62 63 |
# File 'lib/henry/environment.rb', line 60 def self.export_file(path) FileUtils.mkdir_p(Henry::Environment.output_path) FileUtils.copy_file(path, "#{Henry::Environment.output_path}/#{File.basename(path)}") end |
.logger ⇒ Logger
Gets the Task Logger instance via DBr.
37 38 39 40 41 42 43 |
# File 'lib/henry/environment.rb', line 37 def self.logger if ENV['DRB_LOGGER_URI'] return @@logger ||= DRbObject.new_with_uri(ENV['DRB_LOGGER_URI']) end return @@logger ||= Logger.new end |
.output_path ⇒ Object
Returns the current output path for attachments.
68 69 70 |
# File 'lib/henry/environment.rb', line 68 def self.output_path File.path("#{Henry::Environment.config['output_directory']}/output" || DEFAULT_OUTPUT_DIRECTORY) end |
.params ⇒ Hash
Imports and returs the Task execution parameters.
30 31 32 |
# File 'lib/henry/environment.rb', line 30 def self.params @@params ||= Input.import!.params end |
.warning!(message = nil) ⇒ Object
52 53 54 55 |
# File 'lib/henry/environment.rb', line 52 def self.warning!( = nil) self.execution.code = 'WARNING' self.execution. = || 'WARNING' end |