Class: JsTestServer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/js_test_server/configuration.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Configuration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
# File 'lib/js_test_server/configuration.rb', line 18

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]
  @javascript_test_file_glob = params[:javascript_test_file_glob]
end

Class Attribute Details

.instanceObject

Returns the value of attribute instance.



4
5
6
# File 'lib/js_test_server/configuration.rb', line 4

def instance
  @instance
end

Instance Attribute Details

#framework_nameObject

Returns the value of attribute framework_name.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def framework_name
  @framework_name
end

#framework_pathObject

Returns the value of attribute framework_path.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def framework_path
  @framework_path
end

#hostObject

Returns the value of attribute host.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def host
  @host
end

#javascript_test_file_globObject

Returns the value of attribute javascript_test_file_glob.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def javascript_test_file_glob
  @javascript_test_file_glob
end

#portObject

Returns the value of attribute port.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def port
  @port
end

#root_pathObject

Returns the value of attribute root_path.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def root_path
  @root_path
end

#spec_pathObject

Returns the value of attribute spec_path.



15
16
17
# File 'lib/js_test_server/configuration.rb', line 15

def spec_path
  @spec_path
end

Class Method Details

.method_missing(method_name, *args, &block) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/js_test_server/configuration.rb', line 6

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

Instance Method Details

#js_test_server_root_pathObject



45
46
47
# File 'lib/js_test_server/configuration.rb', line 45

def js_test_server_root_path
  "#{library_root_dir}/public"
end

#rackup_pathObject



53
54
55
# File 'lib/js_test_server/configuration.rb', line 53

def rackup_path
  File.expand_path("#{File.dirname(__FILE__)}/server/standalone.ru")
end

#root_urlObject



49
50
51
# File 'lib/js_test_server/configuration.rb', line 49

def root_url
  "http://#{host}:#{port}"
end

#suite_view_classObject



29
30
31
32
33
# File 'lib/js_test_server/configuration.rb', line 29

def suite_view_class
  if framework_name
    JsTestServer::Server::Views::Suites.const_get(framework_name.gsub("-", "_").camelcase)
  end
end