lib/commands/update-config.rb in canzea-0.1.149 vs lib/commands/update-config.rb in canzea-0.1.151

- old
+ new

@@ -4,21 +4,23 @@ def do (role, solution, gitRoot) steps = {} - # write to configure the registration of the service - if (File.exists?("#{gitRoot}/configure.json")) - steps = JSON.parse(File.read("#{gitRoot}/configure.json")) - else - steps["steps"] = [] - end + if File.directory? "#{gitRoot}" + # write to configure the registration of the service + if (File.exists?("#{gitRoot}/configure.json")) + steps = JSON.parse(File.read("#{gitRoot}/configure.json")) + else + steps["steps"] = [] + end - conf = { - :role => role, - :solution => solution - } - steps["steps"].push(conf) + conf = { + :role => role, + :solution => solution + } + steps["steps"].push(conf) - File.open("#{gitRoot}/configure.json", 'w') { |file| file.puts(JSON.generate(steps)) } + File.open("#{gitRoot}/configure.json", 'w') { |file| file.puts(JSON.generate(steps)) } + end end end