immortalize 0.2.2 → 0.2.3

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/immortalize +12 -2
  3. data/immortalize.gemspec +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
data/bin/immortalize CHANGED
@@ -87,7 +87,10 @@ optparse.parse!
87
87
  `mkdir -p "#{$log_location}"` unless File.directory?($log_location)
88
88
  $registry_filename = "#{$log_location}/registry.yaml"
89
89
  File.open($registry_filename, 'w'){|f| f << {}.to_yaml} unless File.exists?($registry_filename)
90
- $registry = YAML.load_file($registry_filename)
90
+ unless $registry = YAML.load_file($registry_filename)
91
+ File.open($registry_filename, 'w'){|f| f << {}.to_yaml}
92
+ $registry = {}
93
+ end
91
94
 
92
95
  $action = ARGV[0]
93
96
 
@@ -334,6 +337,13 @@ unless ::Object.const_defined?(:IRB)
334
337
  end
335
338
 
336
339
  # Save the registry
337
- File.open("#{$log_location}/registry.yaml", 'w') do |r|
340
+ File.open("#{$log_location}/registry.yaml~", 'w') do |r|
338
341
  r << $registry.to_yaml
339
342
  end
343
+ # Swap files back out IF registry was written correctly.
344
+ if File.read("#{$log_location}/registry.yaml~") == $registry.to_yaml
345
+ File.delete("#{$log_location}/registry.yaml")
346
+ File.move("#{$log_location}/registry.yaml~", "#{$log_location}/registry.yaml")
347
+ else
348
+ raise "PROBLEM WRITING TO #{$log_location}/registry.yaml!"
349
+ end
data/immortalize.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{immortalize}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["BehindLogic"]
12
- s.date = %q{2010-04-27}
12
+ s.date = %q{2010-05-07}
13
13
  s.default_executable = %q{immortalize}
14
14
  s.description = %q{Watch a specific process, restart it if it dies.}
15
15
  s.email = %q{gems@behindlogic.com}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - BehindLogic
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 -04:00
17
+ date: 2010-05-07 00:00:00 -04:00
18
18
  default_executable: immortalize
19
19
  dependencies: []
20
20