lib/tw/conf.rb in tw-0.0.3 vs lib/tw/conf.rb in tw-0.1.0

- old
+ new

@@ -27,11 +27,20 @@ def self.conf @@conf ||= ( res = default if File.exists? conf_file begin + data = nil open_conf_file do |f| - res = YAML::load f.read + 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?" + puts "[Y/n]" + res = data if STDIN.gets =~ /^n/i + else + res = data end rescue => e STDERR.puts e File.delete conf_file end