simple_pid 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -31,14 +31,20 @@ Most of the above is fairly self-explanatory. You can accomplish all of the
31
31
  above by calling:
32
32
 
33
33
  SimplePid.drop("/path/to/your.pid")
34
+
35
+ If the path specified for the pid is unwritable for any reason, it falls back
36
+ to using /tmp to store the
34
37
 
35
- And you can cleanup quickly with:
38
+ You can cleanup quickly with:
36
39
 
37
40
  SimplePid.cleanup("/path/to/your.pid")
38
41
 
39
42
  The above cleanup class method returns true if the process wasn't running
40
43
  and the cleanup was actually run. It returns false if the process was still
41
- running and no cleanup occurred.
44
+ running and no cleanup occurred. If you need to force cleanup regardless of
45
+ whether the process is running or not, you can do so with:
46
+
47
+ SimplePid.cleanup!("/path/to/your.pid")
42
48
 
43
49
  You can check to see if the process is running and exit with an error message
44
50
  if it is like this:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/simple_pid.rb CHANGED
@@ -79,6 +79,10 @@ class SimplePid
79
79
  alias zap cleanup
80
80
 
81
81
  def write!
82
- File.open(@path, 'w') { |f| f.puts Process.pid }
82
+ begin
83
+ File.open(@path, "w") { |f| f.puts Process.pid }
84
+ rescue Errno::ENOENT, Errno::EACCES
85
+ File.open("/tmp/#{Pathname.new(@path).basename}", "w") { |f| f.puts Process.pid }
86
+ end
83
87
  end
84
88
  end
data/simple_pid.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simple_pid}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["watsonian"]
12
- s.date = %q{2010-05-30}
12
+ s.date = %q{2010-06-01}
13
13
  s.description = %q{A simple, but complete library for managing pidfiles.}
14
14
  s.email = %q{watsonian@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_pid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - watsonian
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-30 00:00:00 -07:00
18
+ date: 2010-06-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21