Class: JsTestCore::Server
- Inherits:
-
Object
- Object
- JsTestCore::Server
- Defined in:
- lib/js_test_core/server.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.instance ⇒ Object
Returns the value of attribute instance.
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#implementation_root_path ⇒ Object
readonly
Returns the value of attribute implementation_root_path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#public_path ⇒ Object
readonly
Returns the value of attribute public_path.
-
#spec_root_path ⇒ Object
readonly
Returns the value of attribute spec_root_path.
Class Method Summary collapse
- .core_path ⇒ Object
- .implementation_root_path ⇒ Object
- .public_path ⇒ Object
- .request ⇒ Object
- .response ⇒ Object
- .root_url ⇒ Object
- .run(spec_root_path, implementation_root_path, public_path, server_options = {}) ⇒ Object
- .spec_root_path ⇒ Object
Instance Method Summary collapse
- #core_path ⇒ Object
-
#initialize(spec_root_path, implementation_root_path, public_path, host = DEFAULT_HOST, port = DEFAULT_PORT) ⇒ Server
constructor
A new instance of Server.
- #root_url ⇒ Object
- #run(options) ⇒ Object
Constructor Details
#initialize(spec_root_path, implementation_root_path, public_path, host = DEFAULT_HOST, port = DEFAULT_PORT) ⇒ Server
Returns a new instance of Server.
24 25 26 27 28 29 30 31 |
# File 'lib/js_test_core/server.rb', line 24 def initialize(spec_root_path, implementation_root_path, public_path, host=DEFAULT_HOST, port=DEFAULT_PORT) dir = ::File.dirname(__FILE__) @spec_root_path = ::File.(spec_root_path) @implementation_root_path = ::File.(implementation_root_path) @public_path = ::File.(public_path) @host = host @port = port end |
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
4 5 6 |
# File 'lib/js_test_core/server.rb', line 4 def instance @instance end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
22 23 24 |
# File 'lib/js_test_core/server.rb', line 22 def host @host end |
#implementation_root_path ⇒ Object (readonly)
Returns the value of attribute implementation_root_path.
22 23 24 |
# File 'lib/js_test_core/server.rb', line 22 def implementation_root_path @implementation_root_path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
22 23 24 |
# File 'lib/js_test_core/server.rb', line 22 def port @port end |
#public_path ⇒ Object (readonly)
Returns the value of attribute public_path.
22 23 24 |
# File 'lib/js_test_core/server.rb', line 22 def public_path @public_path end |
#spec_root_path ⇒ Object (readonly)
Returns the value of attribute spec_root_path.
22 23 24 |
# File 'lib/js_test_core/server.rb', line 22 def spec_root_path @spec_root_path end |
Class Method Details
.core_path ⇒ Object
16 |
# File 'lib/js_test_core/server.rb', line 16 def core_path; instance.core_path; end |
.implementation_root_path ⇒ Object
14 |
# File 'lib/js_test_core/server.rb', line 14 def implementation_root_path; instance.implementation_root_path; end |
.public_path ⇒ Object
15 |
# File 'lib/js_test_core/server.rb', line 15 def public_path; instance.public_path; end |
.request ⇒ Object
17 |
# File 'lib/js_test_core/server.rb', line 17 def request; instance.request; end |
.response ⇒ Object
18 |
# File 'lib/js_test_core/server.rb', line 18 def response; instance.response; end |
.root_url ⇒ Object
19 |
# File 'lib/js_test_core/server.rb', line 19 def root_url; instance.root_url; end |
.run(spec_root_path, implementation_root_path, public_path, server_options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/js_test_core/server.rb', line 6 def run(spec_root_path, implementation_root_path, public_path, = {}) [:Host] ||= DEFAULT_HOST [:Port] ||= DEFAULT_PORT @instance = new(spec_root_path, implementation_root_path, public_path, [:Host], [:Port]) instance.run end |
.spec_root_path ⇒ Object
13 |
# File 'lib/js_test_core/server.rb', line 13 def spec_root_path; instance.spec_root_path; end |
Instance Method Details
#core_path ⇒ Object
46 47 48 |
# File 'lib/js_test_core/server.rb', line 46 def core_path JsTestCore.core_path end |
#root_url ⇒ Object
42 43 44 |
# File 'lib/js_test_core/server.rb', line 42 def root_url "http://#{host}:#{port}" end |
#run(options) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/js_test_core/server.rb', line 33 def run() server = ::Thin::Server.new([:Host], [:Port]) do use Rack::CommonLogger end server.backend = ::Thin::Backends::JsTestCoreServer.new([:Host], [:Port]) server.backend.server = server server.start! end |