Sha256: 7ad14c4640b2ff92e3edacf9a2b953a155a9420b777686db9dfa1c3c2e33b1e0

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require 'aruba/config'
require 'aruba/environment'

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

    def initialize
      @config            = Aruba.config.make_copy
      @current_directory = ArubaPath.new(@config.working_directory)
      @root_directory    = ArubaPath.new(@config.root_directory)
      @environment       = Environment.new
    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

5 entries across 5 versions & 1 rubygems

Version Path
aruba-0.8.1 lib/aruba/runtime.rb
aruba-0.8.0 lib/aruba/runtime.rb
aruba-0.8.0.pre3 lib/aruba/runtime.rb
aruba-0.8.0.pre2 lib/aruba/runtime.rb
aruba-0.8.0.pre lib/aruba/runtime.rb