ECS 0.1.2 → 0.1.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.
- data/CHANGELOG +4 -0
- data/lib/ecs/time_management.rb +10 -3
- metadata +1 -1
data/CHANGELOG
CHANGED
data/lib/ecs/time_management.rb
CHANGED
@@ -44,14 +44,21 @@ module ECS
|
|
44
44
|
def self.time_file
|
45
45
|
@@time_file
|
46
46
|
end
|
47
|
+
def self.prepare_time_file( f )
|
48
|
+
file = File.expand_path( f )
|
49
|
+
FileUtils.touch( file ) unless File.exist?( file )
|
50
|
+
File.writable?( file )
|
51
|
+
rescue
|
52
|
+
false
|
53
|
+
end
|
47
54
|
def self.time_file=( f='' )
|
48
55
|
file = File.expand_path( f )
|
49
|
-
|
50
|
-
raise "#{file} is an unacceptable time file." unless File.writable?( file )
|
56
|
+
raise "#{file} is an unacceptable time file." unless self.prepare_time_file( file )
|
51
57
|
@@time_file = file
|
52
58
|
end
|
53
59
|
def self.kill_time_file
|
54
|
-
|
60
|
+
raise "Cannot kill time file #{self.time_file}." unless self.prepare_time_file( self.time_file )
|
61
|
+
File.unlink( self.time_file )
|
55
62
|
rescue
|
56
63
|
end
|
57
64
|
end
|