Commit 17eb3b37 by Alex Chaffee

hack: make sure default position is 'before'; also remove VERSION.yml from gemspec

parent a786d70b
...@@ -9,5 +9,4 @@ Gemfile.lock ...@@ -9,5 +9,4 @@ Gemfile.lock
*.gem *.gem
/.idea/ /.idea/
.rvmrc .rvmrc
.bundle
.bundle/ .bundle/
...@@ -12,7 +12,7 @@ Gem::Specification.new do |s| ...@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.extra_rdoc_files = ["README.rdoc"] s.extra_rdoc_files = ["README.rdoc"]
s.files = %w( README.rdoc VERSION.yml History.txt ) s.files = %w( README.rdoc History.txt )
s.files += Dir.glob("lib/**/*") s.files += Dir.glob("lib/**/*")
s.files += Dir.glob("tasks/**/*") s.files += Dir.glob("tasks/**/*")
s.files += ["bin/annotate"] # todo: annotate_models s.files += ["bin/annotate"] # todo: annotate_models
......
...@@ -20,6 +20,7 @@ OptionParser.new do |opts| ...@@ -20,6 +20,7 @@ OptionParser.new do |opts|
task = :remove_annotation task = :remove_annotation
end end
ENV['position'] = 'before' # hack: make sure default position is "before"
opts.on('-p', '--position [before|after]', ['before', 'after'], opts.on('-p', '--position [before|after]', ['before', 'after'],
"Place the annotations at the top (before) or the bottom (after) of the model file") do |p| "Place the annotations at the top (before) or the bottom (after) of the model file") do |p|
ENV['position'] = p ENV['position'] = p
......
...@@ -197,6 +197,7 @@ module AnnotateModels ...@@ -197,6 +197,7 @@ module AnnotateModels
# Strip the old schema info, and insert new schema info. # Strip the old schema info, and insert new schema info.
old_content.sub!(encoding, '') old_content.sub!(encoding, '')
old_content.sub!(PATTERN, '') old_content.sub!(PATTERN, '')
new_content = (options[:position] || 'before').to_s == 'after' ? new_content = (options[:position] || 'before').to_s == 'after' ?
(encoding_header + (old_content.rstrip + "\n\n" + info_block)) : (encoding_header + (old_content.rstrip + "\n\n" + info_block)) :
(encoding_header + info_block + old_content) (encoding_header + info_block + old_content)
......
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