lib/tw/conf.rb in tw-0.3.1 vs lib/tw/conf.rb in tw-0.3.2
- old
+ new
@@ -25,14 +25,14 @@
end
def self.conf
@@conf ||= (
res = default
- if File.exists? conf_file
+ if File.exists? self.conf_file
begin
data = nil
- open_conf_file do |f|
+ self.open_conf_file do |f|
data = YAML::load f.read
end
if data['version'] < REQUIRE_VERSION
puts "This is tw version #{Tw::VERSION}."
puts "Your config file is old ("+data['version']+"). Reset tw settings?"
@@ -41,11 +41,11 @@
else
res = data
end
rescue => e
STDERR.puts e
- File.delete conf_file
+ File.delete self.conf_file
end
end
res
)
end
@@ -65,8 +65,9 @@
if block_given?
yield open(self.conf_file, opt)
else
return open(self.conf_file, opt)
end
+ File.chmod 0600, self.conf_file if File.exists? self.conf_file
end
end
end