Module: Foreman::Kicker
- Defined in:
- lib/foreman/kicker.rb,
lib/foreman/kicker/version.rb,
lib/foreman/kicker/executor.rb,
lib/foreman/kicker/watchdog.rb
Defined Under Namespace
Classes: Executor, Watchdog
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.kick(*args) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/foreman/kicker.rb', line 15
def self.kick(*args)
if args.include?('-p') || args.include?('--port')
self.port = args[(args.find('-p') || args.find('--port')) + 1]
else
args += ['-p', port]
end
@watchdog = Foreman::Kicker::Watchdog.new
@watchdog.start(*args.map(&:to_s))
end
|
.port ⇒ Object
11
12
13
|
# File 'lib/foreman/kicker.rb', line 11
def self.port
@port
end
|
.port=(port) ⇒ Object
7
8
9
|
# File 'lib/foreman/kicker.rb', line 7
def self.port=(port)
@port = port
end
|
.stop ⇒ Object
38
39
40
|
# File 'lib/foreman/kicker.rb', line 38
def self.stop
@watchdog.stop
end
|
.wait ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/foreman/kicker.rb', line 26
def self.wait
loop do
begin
TCPSocket.open('127.0.0.1', self.port).close
break
rescue Errno::ECONNREFUSED
sleep 0.1
end
end
end
|