Class: Holoserve
- Inherits:
-
Object
show all
- Defined in:
- lib/holoserve.rb
Defined Under Namespace
Modules: Fixture, Pair, Request, Response, State, Tool
Classes: Interface
Instance Method Summary
collapse
Constructor Details
#initialize(options = { }) ⇒ Holoserve
Returns a new instance of Holoserve.
14
15
16
17
18
19
20
21
|
# File 'lib/holoserve.rb', line 14
def initialize(options = { })
@port = options[:port] || 4250
@pid_filename = options[:pid_filename] || File.expand_path(File.join(File.dirname(__FILE__), "..", "holoserve.pid"))
@log_filename = options[:log_filename]
@fixture_file_pattern = options[:fixture_file_pattern]
@pair_file_pattern = options[:pair_file_pattern]
@state = options[:state] || { }
end
|
Instance Method Details
#process_id ⇒ Object
46
47
48
49
50
|
# File 'lib/holoserve.rb', line 46
def process_id
File.read(@pid_filename).to_i
rescue Errno::ENOENT
nil
end
|
#run ⇒ Object
30
31
32
33
34
|
# File 'lib/holoserve.rb', line 30
def run
initialize_logger
load_pairs
run_goliath false
end
|
#running? ⇒ Boolean
40
41
42
43
44
|
# File 'lib/holoserve.rb', line 40
def running?
!!(process_id && Process.kill(0, process_id) == 1)
rescue Errno::ESRCH
false
end
|
#start ⇒ Object
23
24
25
26
27
28
|
# File 'lib/holoserve.rb', line 23
def start
initialize_logger
load_pairs
run_goliath true
wait_until_running
end
|
#stop ⇒ Object
36
37
38
|
# File 'lib/holoserve.rb', line 36
def stop
kill_goliath
end
|