Skip to content

Commit

Permalink
We had stripped the trailing newlines from our Schema Information sec…
Browse files Browse the repository at this point in the history
…tion. This small fix supports that case.
  • Loading branch information
ndbroadbent committed Dec 10, 2011
1 parent a709a87 commit 7f44f0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/annotate/annotate_models.rb
Expand Up @@ -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, '')
Expand All @@ -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
Expand Down

0 comments on commit 7f44f0e

Please sign in to comment.