Sha256: e71086dd954675f217b35f2d6fa32556fdfe38ffbdbf8904f746e03cf9802c4f

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

require 'rubygems'
require 'sinatra/base'
require 'capybara'
require 'launchy'
require 'coffee-script'
require 'everqueen/version'
require 'everqueen/application'
require 'json'

module Everqueen
  autoload :Cli, 'everqueen/cli'
  autoload :Server, 'everqueen/server'
  autoload :Runner, 'everqueen/runner'
  autoload :Suite, 'everqueen/suite'
  autoload :Test, 'everqueen/test'

  class << self
    attr_accessor :driver, :public_dir, :test_dir, :root, :mounted_at, :application

    def configure
      yield self
    end

    def use_defaults!
      configure do |config|
        config.application = Everqueen::Application
        config.driver = :selenium
        config.public_dir = 'public'
        config.test_dir = 'test/javascripts'
        config.mounted_at = ""
      end
    end

    def test_dir=(new_dir)
      update_asset_paths(new_dir, test_dir)
      @test_dir = new_dir
    end

    def public_dir=(new_dir)
      update_asset_paths(new_dir, public_dir)
      @public_dir = new_dir
    end

    def root=(new_root)
      @root = new_root
      update_asset_paths(test_dir, test_dir)
      update_asset_paths(public_dir, public_dir)
      @root
    end

    private

    def update_asset_paths(new_dir, old_dir)
      return if root.nil?
      old_dir = File.expand_path(old_dir, root)
      new_dir = File.expand_path(new_dir, root)
      old_paths = Everqueen.assets_environment.clear_paths
      old_paths.delete(old_dir)
      old_paths.unshift(new_dir).each do |dir|
        Everqueen.assets_environment.append_path(dir)
      end
    end
  end
end

Everqueen.use_defaults!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
everqueen-1.1.1 lib/everqueen.rb
everqueen-1.1.0 lib/everqueen.rb