Module: BladeRunner
- Extended by:
- BladeRunner, Forwardable
- Included in:
- BladeRunner
- Defined in:
- lib/blade_runner.rb,
lib/blade_runner/version.rb
Defined Under Namespace
Modules: Assets, CI, Component, Console, Server
Classes: CombinedTestResults, Model, RackAdapter, Session, TestResults
Constant Summary
collapse
- ALLOWED_MODES =
[:console, :ci]
- DEFAULT_MODE =
ALLOWED_MODES.first
- DEFAULT_PORT =
9876
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
40
41
42
|
# File 'lib/blade_runner.rb', line 40
def config
@config
end
|
#plugins ⇒ Object
Returns the value of attribute plugins.
40
41
42
|
# File 'lib/blade_runner.rb', line 40
def plugins
@plugins
end
|
Instance Method Details
#initialize!(options = {}) ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/blade_runner.rb', line 69
def initialize!(options = {})
return if initialized?
@options = options.with_indifferent_access
load_config_file!
read_arguments!
setup_config!
setup_adapter!
setup_plugins!
@initialized = true
end
|
#initialized? ⇒ Boolean
80
81
82
|
# File 'lib/blade_runner.rb', line 80
def initialized?
@initialized
end
|
#interface ⇒ Object
88
89
90
91
92
93
94
|
# File 'lib/blade_runner.rb', line 88
def interface
@interface ||=
case config.mode
when :ci then CI
when :console then Console
end
end
|
#register_component(component) ⇒ Object
16
17
18
|
# File 'lib/blade_runner.rb', line 16
def register_component(component)
@components << component
end
|
#root_path ⇒ Object
96
97
98
|
# File 'lib/blade_runner.rb', line 96
def root_path
Pathname.new(File.dirname(__FILE__)).join("../")
end
|
#running? ⇒ Boolean
65
66
67
|
# File 'lib/blade_runner.rb', line 65
def running?
@running
end
|
#start(options = {}) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/blade_runner.rb', line 45
def start(options = {})
return if running?
initialize!(options)
handle_exit
interface
EM.run do
@components.each { |c| c.start if c.respond_to?(:start) }
@running = true
end
end
|
#stop ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/blade_runner.rb', line 57
def stop
return if @stopping
@stopping = true
@components.each { |c| c.stop if c.respond_to?(:stop) }
EM.stop if EM.reactor_running?
@running = false
end
|
#tmp_path ⇒ Object
100
101
102
|
# File 'lib/blade_runner.rb', line 100
def tmp_path
Pathname.new(".").join("tmp/blade_runner")
end
|
#url(path = "") ⇒ Object
84
85
86
|
# File 'lib/blade_runner.rb', line 84
def url(path = "")
"http://localhost:#{config.port}#{path}"
end
|