Sha256: 4f0f5b6930818b61802f4ad35bfffe99b18911a042ac6f11caf70c04ae286c74

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 KB

Contents

require 'contracts'
require 'aruba/basic_configuration'
require 'aruba/config_wrapper'
require 'aruba/hooks'
require 'aruba/contracts/relative_path'

module Aruba
  # Aruba Configuration
  class Configuration < BasicConfiguration
    # As of 1.0.0 root_directory is read-only
    # option_reader   :root_directory, :contract => { None => String }, :default => Dir.getwd
    option_accessor   :root_directory, :contract => { String => String }, :default => Dir.getwd
    option_accessor :working_directory, :contract => { Aruba::Contracts::RelativePath => Aruba::Contracts::RelativePath }, :default => 'tmp/aruba'

    if RUBY_VERSION < '1.9'
      option_reader   :fixtures_path_prefix, :contract => { None => String }, :default => '%'
    else
      option_reader   :fixtures_path_prefix, :contract => { None => String }, :default => ?%
    end

    option_accessor :exit_timeout, :contract => { Num => Num }, :default => 15
    option_accessor :io_wait_timeout, :contract => { Num => Num }, :default => 0.1
    option_accessor :fixtures_directories, :contract => { Array => ArrayOf[String] }, :default => %w(features/fixtures spec/fixtures test/fixtures)
    option_accessor :command_runtime_environment, :contract => { Hash => Hash }, :default => ENV.to_hash
    option_accessor(:command_search_paths, :contract => { ArrayOf[String] => ArrayOf[String] }) { |config| [File.join(config.root_directory.value, 'bin')] }
    option_accessor :keep_ansi, :contract => { Bool => Bool }, :default => false
  end
end

# Main Module
module Aruba
  @config = Configuration.new

  class << self
    attr_reader :config

    def configure(&block)
      @config.configure(&block)

      self
    end
  end
end

module Aruba
  # Old Config
  #
  # @private
  class Config < Configuration
    def initialize(*args)
      warn('The use of "Aruba::Config" is deprecated. Use "Aruba::Configuration" instead.')

      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-0.8.0.pre2 lib/aruba/config.rb
aruba-0.8.0.pre lib/aruba/config.rb