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_directoryand
#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.
42 43 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 42 def initialize(opts = {}) @event_bus = EventBus.new(EventBus::NameResolver.new(Aruba::Events)) @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 = if Aruba::VERSION < '1' opts.fetch(:command_monitor, Aruba.platform.command_monitor.new(:announcer => @announcer)) else opts.fetch(:command_monitor, Aruba.platform.command_monitor.new) end @logger = opts.fetch(:logger, Aruba.platform.logger.new) @logger.mode = @config.log_level @setup_done = false end |
Instance Attribute Details
#announcer ⇒ Object
Announce information
40 |
# File 'lib/aruba/runtime.rb', line 40 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#command_monitor ⇒ Object
Handler started commands (private)
40 |
# File 'lib/aruba/runtime.rb', line 40 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#config ⇒ Object
Access configuration of aruba
40 41 42 |
# File 'lib/aruba/runtime.rb', line 40 def config @config end |
#current_directory ⇒ Object (readonly)
Returns the current working directory
20 21 22 |
# File 'lib/aruba/runtime.rb', line 20 def current_directory @current_directory end |
#environment ⇒ Object
Access environment of aruba (private)
40 |
# File 'lib/aruba/runtime.rb', line 40 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#event_bus ⇒ Object
Handle events (private)
40 |
# File 'lib/aruba/runtime.rb', line 40 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#logger ⇒ Object
Logger of aruba (private)
40 |
# File 'lib/aruba/runtime.rb', line 40 attr_accessor :config, :environment, :logger, :command_monitor, :announcer, :event_bus |
#root_directory ⇒ Object (readonly)
Returns the value of attribute root_directory.
20 |
# File 'lib/aruba/runtime.rb', line 20 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 |
# File 'lib/aruba/runtime.rb', line 83 def fixtures_directory unless @fixtures_directory candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) } @fixtures_directory = candidates.find { |d| Aruba.platform.directory? d } fail "No existing fixtures directory found in #{candidates.map { |d| format('"%s"', d) }.join(', ')}. " unless @fixtures_directory end fail %(Fixtures directory "#{@fixtures_directory}" is not a directory) unless Aruba.platform.directory?(@fixtures_directory) 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 |