Commit d4948432 by Shu Fujita Committed by Andrew W. Lee

Refactor AnnotateRoutes.rewrite_contents (#734)

I moved `puts` from `AnnotateRoutes.rewrite_contents` to `.do_annotations` and `.remove_annotations`.
parent 1b51de89
......@@ -36,6 +36,8 @@ module AnnotateRoutes
if rewrite_contents(existing_text, new_text)
puts "#{routes_file} annotated."
else
puts "#{routes_file} unchanged."
end
else
puts "Can't find routes.rb"
......@@ -50,6 +52,8 @@ module AnnotateRoutes
new_text = new_content.join("\n")
if rewrite_contents(existing_text, new_text)
puts "Removed annotations from #{routes_file}."
else
puts "#{routes_file} unchanged."
end
else
puts "Can't find routes.rb"
......@@ -156,7 +160,6 @@ module AnnotateRoutes
def rewrite_contents(existing_text, new_text)
if existing_text == new_text
puts "#{routes_file} unchanged."
false
else
File.open(routes_file, 'wb') { |f| f.puts(new_text) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment