pyramid_scheme 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -12,12 +12,16 @@ module PyramidScheme
12
12
 
13
13
  def searchd_pids
14
14
  ps_output = `ps ax | grep searchd`
15
- ps_output.split("\n").collect{|p| /^(\d*)/.match(p)[0]}
15
+ ps_output.split("\n").collect{|p| /^\s*(\d*)/.match(p)[1]}
16
16
  end
17
17
 
18
18
  def bounce_pids
19
19
  searchd_pids.each do |pid|
20
- Process.kill("HUP", pid.to_i) if pid != ""
20
+ begin
21
+ Process.kill("HUP", pid.to_i) if pid != ""
22
+ rescue Exception => e
23
+ raise e unless e.message =~ /No such process/i
24
+ end
21
25
  end
22
26
  end
23
27
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pyramid_scheme}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Pickett"]
@@ -14,6 +14,12 @@ describe PyramidScheme::IndexClient do
14
14
  Process.expects(:kill).with("HUP", 4345)
15
15
  @client.bounce_pids
16
16
  end
17
+
18
+ it 'should continue gracefully if no such process gets raise' do
19
+ @client.expects(:searchd_pids).returns(["4345"])
20
+ Process.expects(:kill).raises(Exception, "No Such Process").then.returns(1)
21
+ lambda { @client.bounce_pids }.should_not raise_error
22
+ end
17
23
  end
18
24
 
19
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyramid_scheme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett