lifeline 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/lib/lifeline.rb CHANGED
@@ -2,10 +2,16 @@ require 'rake'
2
2
  require 'rake/tasklib'
3
3
 
4
4
  module Lifeline
5
+ ##
6
+ # @private
7
+ def get_processes_from_shell
8
+ %x{ps ax -o pid,command}
9
+ end
10
+
5
11
  ##
6
12
  # @private
7
13
  def get_process_list
8
- processes = %x{ps ax -o pid,command}
14
+ processes = get_processes_from_shell
9
15
 
10
16
  return nil if processes.nil?
11
17
 
data/lifeline.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lifeline}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jacob Harris", "Ben Koski", "Matt Todd"]
@@ -18,6 +18,25 @@ class TestLifeline < Test::Unit::TestCase
18
18
  assert_kind_of(String, p[:command])
19
19
  end
20
20
  end
21
+
22
+ context '' do
23
+ setup do
24
+ ps_output = <<EOF
25
+ 2070 ps ax -o pid,command
26
+ 10096 searchd --pidfile --config /mnt/apps/doc_viewer/releases/20100329193155/config/internal_production.sphinx.conf
27
+ EOF
28
+ self.expects(:get_processes_from_shell).returns(ps_output)
29
+ @processes = get_process_list
30
+ end
31
+
32
+ should "handle whitespace in the front of the PID correctly" do
33
+ assert @processes.any? {|x| x[:pid] == 2070}
34
+ end
35
+
36
+ should "handle a lack of whitespace in front of the PID correctly" do
37
+ assert @processes.any? {|x| x[:pid] == 10096}
38
+ end
39
+ end
21
40
  end
22
41
 
23
42
  context "lifeline" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacob Harris