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 CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -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
- pid = fork do
17
+ read, write = IO.pipe
18
+ tmp_pid = fork do
19
+ read.close
18
20
  fork do
19
21
  Process.setsid
20
- File.open(pid_file, 'w') { |f| f << Process.pid }
21
- run(eager_tasks, options)
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
- Process.waitpid(pid)
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rake_server}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mat Brown", "Cedric Howe"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mat Brown