Commit 672a22ab by Turadg Aleahmad

Merge pull request #61 from ndbroadbent/master

Optional trailing newlines after schema info block
parents a709a87d 7f44f0e3
...@@ -138,7 +138,7 @@ module AnnotateModels ...@@ -138,7 +138,7 @@ module AnnotateModels
false false
else else
# Replace the old schema info with the new schema info # Replace the old schema info with the new schema info
new_content = old_content.sub(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, info_block) new_content = old_content.sub(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n*/, info_block)
# But, if there *was* no old schema info, we simply need to insert it # But, if there *was* no old schema info, we simply need to insert it
if new_content == old_content if new_content == old_content
old_content.sub!(encoding, '') old_content.sub!(encoding, '')
...@@ -157,7 +157,7 @@ module AnnotateModels ...@@ -157,7 +157,7 @@ module AnnotateModels
if File.exist?(file_name) if File.exist?(file_name)
content = File.read(file_name) content = File.read(file_name)
content.sub!(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, '') content.sub!(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n*/, '')
File.open(file_name, "wb") { |f| f.puts content } File.open(file_name, "wb") { |f| f.puts content }
end end
......
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