sparehand 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ require 'fileutils'
2
+
3
+ class << File
4
+ def safe_modify original
5
+ path = File.dirname(original)
6
+ temp_name = '.' + File.basename(original) + '.tmp'
7
+ temp_path = File.join(path, temp_name)
8
+
9
+ File.open(original) do |input|
10
+ File.open(temp_path, 'w') do |output|
11
+ yield input, output
12
+ end
13
+ end
14
+
15
+ File.delete original
16
+ File.rename temp_path, original
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ module Sparehand #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end