Class: Aruba::Runtime
- Inherits:
-
Object
- Object
- Aruba::Runtime
- Defined in:
- lib/aruba/runtime.rb
Overview
Runtime of aruba
Most methods are considered private. Please look for ‘(private)` in the attribute descriptions. Only a few like `#current_directory`, ’#root_directory` and ‘#config` are considered to be part of the public API.
Instance Attribute Summary collapse
-
#announcer ⇒ Object
Announce information.
-
#command_monitor ⇒ Object
Handler started commands (private).
-
#config ⇒ Object
Access configuration of aruba.
-
#current_directory ⇒ Object
readonly
Returns the current working directory.
-
#environment ⇒ Object
Access environment of aruba (private).
-
#event_bus ⇒ Object
Handle events (private).
-
#logger ⇒ Object
Logger of aruba (private).
-
#root_directory ⇒ Object
readonly
Returns the value of attribute root_directory.
Instance Method Summary collapse
-
#fixtures_directory ⇒ ArubaPath
The path to the directory which contains fixtures You might want to overwrite this method to place your data else where.
-
#initialize(opts = {}) ⇒ Runtime
constructor
A new instance of Runtime.
-
#setup_already_done? ⇒ Boolean
Has aruba already been setup.
-
#setup_done ⇒ Object
Setup of aruba is finshed.
Constructor Details
#initialize(opts = {}) ⇒ Runtime
Returns a new instance of Runtime.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/aruba/runtime.rb', line 44 def initialize(opts = {}) @event_bus = EventBus.new(Aruba::Events.registry) @announcer = opts.fetch(:announcer, Aruba.platform.announcer.new) @config = opts.fetch(:config, ConfigWrapper.new(Aruba.config.make_copy, @event_bus)) @environment = opts.fetch(:environment, Aruba.platform.environment_variables.new) @current_directory = ArubaPath.new(@config.working_directory) @root_directory = ArubaPath.new(@config.root_directory) @environment.update(@config.command_runtime_environment) @command_monitor = opts.fetch(:command_monitor, Aruba.platform.command_monitor.new(announcer: @announcer)) @logger = opts.fetch(:logger, Aruba.platform.logger.new) @logger.mode = @config.log_level @setup_done = false end |
Instance Attribute Details
#announcer ⇒ Object
Announce information
42 |
# File 'lib/aruba/runtime.rb', line 42 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#command_monitor ⇒ Object
Handler started commands (private)
42 |
# File 'lib/aruba/runtime.rb', line 42 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#config ⇒ Object
Access configuration of aruba
42 43 44 |
# File 'lib/aruba/runtime.rb', line 42 def config @config end |
#current_directory ⇒ Object (readonly)
Returns the current working directory
22 23 24 |
# File 'lib/aruba/runtime.rb', line 22 def current_directory @current_directory end |
#environment ⇒ Object
Access environment of aruba (private)
42 |
# File 'lib/aruba/runtime.rb', line 42 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#event_bus ⇒ Object
Handle events (private)
42 |
# File 'lib/aruba/runtime.rb', line 42 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#logger ⇒ Object
Logger of aruba (private)
42 |
# File 'lib/aruba/runtime.rb', line 42 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#root_directory ⇒ Object (readonly)
Returns the value of attribute root_directory.
22 |
# File 'lib/aruba/runtime.rb', line 22 attr_reader :current_directory, :root_directory |
Instance Method Details
#fixtures_directory ⇒ ArubaPath
The path to the directory which contains fixtures You might want to overwrite this method to place your data else where.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/aruba/runtime.rb', line 83 def fixtures_directory @fixtures_directory ||= begin candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) } directory = candidates.find { |d| Aruba.platform.directory? d } unless directory canditates_display = candidates.map { |d| format('"%s"', d) }.join(', ') raise "No existing fixtures directory found in #{canditates_display}." end directory end unless Aruba.platform.directory?(@fixtures_directory) raise %(Fixtures directory "#{@fixtures_directory}" is not a directory) end ArubaPath.new(@fixtures_directory) end |
#setup_already_done? ⇒ Boolean
Has aruba already been setup. Should be used only internally.
74 75 76 |
# File 'lib/aruba/runtime.rb', line 74 def setup_already_done? @setup_done == true end |
#setup_done ⇒ Object
Setup of aruba is finshed. Should be used only internally.
67 68 69 |
# File 'lib/aruba/runtime.rb', line 67 def setup_done @setup_done = true end |