rake_server 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rake_server/server.rb +17 -5
- data/rake_server.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/rake_server/server.rb
CHANGED
@@ -14,14 +14,25 @@ module RakeServer
|
|
14
14
|
class <<self
|
15
15
|
def start(eager_tasks, options = {})
|
16
16
|
pid_file = File.join(pid_dir(options), "rake-server.pid")
|
17
|
-
|
17
|
+
read, write = IO.pipe
|
18
|
+
tmp_pid = fork do
|
19
|
+
read.close
|
18
20
|
fork do
|
19
21
|
Process.setsid
|
20
|
-
|
21
|
-
|
22
|
+
run(eager_tasks, options) do
|
23
|
+
write.write(Process.pid.to_s)
|
24
|
+
write.close
|
25
|
+
STDOUT.reopen('/dev/null')
|
26
|
+
STDERR.reopen(STDOUT)
|
27
|
+
end
|
22
28
|
end
|
29
|
+
write.close
|
23
30
|
end
|
24
|
-
|
31
|
+
write.close
|
32
|
+
pid = read.read.to_i
|
33
|
+
File.open(pid_file, 'w') { |f| f << pid }
|
34
|
+
read.close
|
35
|
+
Process.waitpid(tmp_pid)
|
25
36
|
end
|
26
37
|
|
27
38
|
def stop(options = {})
|
@@ -39,7 +50,7 @@ module RakeServer
|
|
39
50
|
end
|
40
51
|
end
|
41
52
|
|
42
|
-
def run(eager_tasks, options = {})
|
53
|
+
def run(eager_tasks, options = {}, &block)
|
43
54
|
options = DEFAULT_OPTIONS.merge(options)
|
44
55
|
EventMachine.run do
|
45
56
|
Rake.application.init
|
@@ -49,6 +60,7 @@ module RakeServer
|
|
49
60
|
unless options[:quiet]
|
50
61
|
puts "rake-server listening on #{options[:host]}:#{options[:port]}"
|
51
62
|
end
|
63
|
+
block.call if block
|
52
64
|
end
|
53
65
|
end
|
54
66
|
|
data/rake_server.gemspec
CHANGED