freelancing-god-riddle 0.9.8.1533.7 → 0.9.8.1533.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -85,3 +85,4 @@ Thanks to the following people who have contributed to Riddle in some shape or f
85
85
  * Xavier Noria
86
86
  * Henrik Nye
87
87
  * Kristopher Chambers
88
+ * Rob Anderton
data/lib/riddle.rb CHANGED
@@ -18,7 +18,7 @@ module Riddle #:nodoc:
18
18
  Rev = 1533
19
19
  # Release number to mark my own fixes, beyond feature parity with
20
20
  # Sphinx itself.
21
- Release = 7
21
+ Release = 8
22
22
 
23
23
  String = [Major, Minor, Tiny].join('.')
24
24
  GemVersion = [Major, Minor, Tiny, Rev, Release].join('.')
@@ -10,35 +10,40 @@ module Riddle
10
10
  cmd << " --rotate" if running?
11
11
  `#{cmd}`
12
12
  end
13
-
13
+
14
14
  def start
15
15
  return if running?
16
-
16
+
17
17
  cmd = "searchd --pidfile --config #{@path}"
18
- `#{cmd}`
19
-
18
+ cmd = "start /B #{cmd}" if RUBY_PLATFORM =~ /mswin/
19
+ `#{cmd}`
20
+
20
21
  sleep(1)
21
-
22
+
22
23
  unless running?
23
24
  puts "Failed to start searchd daemon. Check #{@configuration.searchd.log}."
24
25
  end
25
26
  end
26
-
27
+
27
28
  def stop
28
29
  return unless running?
29
- `kill #{pid}`
30
+ Process.kill('SIGTERM', pid.to_i)
31
+ rescue Errno::EINVAL
32
+ Process.kill('SIGKILL', pid.to_i)
30
33
  end
31
-
34
+
32
35
  def pid
33
- if File.exists?("#{@configuration.searchd.pid_file}")
34
- `cat #{@configuration.searchd.pid_file}`[/\d+/]
36
+ if File.exists?(@configuration.searchd.pid_file)
37
+ File.read(@configuration.searchd.pid_file)[/\d+/]
35
38
  else
36
39
  nil
37
40
  end
38
41
  end
39
-
42
+
40
43
  def running?
41
- pid && `ps #{pid} | wc -l`.to_i > 1
44
+ !!pid && !!Process.kill(0, pid.to_i)
45
+ rescue
46
+ false
42
47
  end
43
48
  end
44
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freelancing-god-riddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8.1533.7
4
+ version: 0.9.8.1533.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-30 00:00:00 -07:00
12
+ date: 2009-07-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15