Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #61 from ndbroadbent/master

Optional trailing newlines after schema info block
  • Loading branch information...
commit 672a22abf6165d6cc1dfb4d29dff5839f88af769 2 parents a709a87 + 7f44f0e
@turadg turadg authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/annotate/annotate_models.rb
View
4 lib/annotate/annotate_models.rb
@@ -138,7 +138,7 @@ def annotate_one_file(file_name, info_block, options={})
false
else
# 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
if new_content == old_content
old_content.sub!(encoding, '')
@@ -157,7 +157,7 @@ def remove_annotation_of_file(file_name)
if File.exist?(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 }
end
Please sign in to comment.
Something went wrong with that request. Please try again.