lib/kosmos.rb in kosmos-0.0.2 vs lib/kosmos.rb in kosmos-0.0.3
- old
+ new
@@ -35,15 +35,19 @@
end
private
def write_config(opts)
+ FileUtils.touch(config_path)
+
File.open(config_path, "r+") do |file|
file.write JSON.pretty_generate(read_config.merge(opts))
end
end
def read_config
+ FileUtils.touch(config_path)
+
config = File.read(config_path)
if config.empty?
{}
else
JSON.parse(config, symbolize_names: true)