Sha256: 91d4829a7a04d99c7fb05c06ded12bce793efeb1697272541f924685a1b08980
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
module JsTestCore class Configuration class << self attr_accessor :instance def method_missing(method_name, *args, &block) if Configuration.instance.respond_to?(method_name) Configuration.instance.send(method_name, *args, &block) else super end end end attr_reader :host, :port, :spec_path, :root_path, :framework_path, :framework_name attr_writer :host, :port, :framework_path, :framework_name def initialize(params={}) params = Server::DEFAULTS.dup.merge(params) @spec_path = ::File.expand_path(params[:spec_path]) @root_path = ::File.expand_path(params[:root_path]) @host = params[:host] @port = params[:port] @framework_path = params[:framework_path] @framework_name = params[:framework_name] end def suite_representation_class if framework_name JsTestCore::Representations::Suites.const_get(framework_name.gsub("-", "_").camelcase) end end def spec_path=(path) validate_path(path) @spec_path = path end def root_path=(path) validate_path(path) @root_path = path end def js_test_core_js_path "#{library_root_dir}/public/js_test_server.js" end def root_url "http://#{host}:#{port}" end protected def library_root_dir dir = File.dirname(__FILE__) File.expand_path("#{dir}/../..") end def validate_path(path) unless File.directory?(path) raise ArgumentError, "#{path} must be a directory" end end end end
Version data entries
4 entries across 4 versions & 2 rubygems