Sha256: 39ac41a51e90a9902986ad5800e232438cb47a101f4b7db06f2a353d186baedd

Contents?: true

Size: 1.29 KB

Versions: 9

Compression:

Stored size: 1.29 KB

Contents

require 'aruba/config'
require 'aruba/aruba_logger'

module Aruba
  class Runtime
    attr_reader :config, :current_directory, :environment, :root_directory, :logger

    def initialize
      @config            = Aruba.config.make_copy
      @current_directory = ArubaPath.new(@config.working_directory)
      @root_directory    = ArubaPath.new(@config.root_directory)
      @environment       = Aruba.platform.environment_variables

      @logger      = ArubaLogger.new
      @logger.mode = @config.log_level
    end

    # The path to the directory which contains fixtures
    # You might want to overwrite this method to place your data else where.
    #
    # @return [ArubaPath]
    #   The directory to where your fixtures are stored
    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
aruba-0.11.0.pre lib/aruba/runtime.rb
aruba-0.10.2 lib/aruba/runtime.rb
aruba-0.10.1 lib/aruba/runtime.rb
aruba-0.10.0 lib/aruba/runtime.rb
aruba-0.10.0.pre2 lib/aruba/runtime.rb
aruba-0.10.0.pre lib/aruba/runtime.rb
aruba-0.9.0 lib/aruba/runtime.rb
aruba-0.9.0.pre2 lib/aruba/runtime.rb
aruba-0.9.0.pre lib/aruba/runtime.rb