Commit 637499db by Alex Chaffee

Revert "Changed to sort be default with an option to not sort."

This reverts commit 8d3c00c7. Sorry, but database order should be the default unless a user really wants it alphabetized. (We should also allow a .annotate file so users can set their own preferred options more easily.) Conflicts: .gitignore bin/annotate lib/annotate/annotate_models.rb lib/tasks/annotate_models.rake
parent 60381f84
......@@ -61,9 +61,9 @@ OptionParser.new do |opts|
ENV['ignore_model_sub_dir'] = "yes"
end
opts.on('-n', '--no-sort',
"Sort columns in creation order rather than alphabetically") do |dir|
ENV['no_sort'] = "yes"
opts.on('--sort',
"Sort columns alphabetically, rather than in creation order") do |dir|
ENV['sort'] = "yes"
end
opts.on('-R', '--require path',
......@@ -73,7 +73,7 @@ OptionParser.new do |opts|
else
ENV['require'] = path
end
end
end\
opts.on('-e', '--exclude [tests,fixtures]', Array, "Do not annotate fixtures, test files, or both") do |exclusions|
exclusions.each { |exclusion| ENV["exclude_#{exclusion}"] = "yes" }
......
......@@ -77,7 +77,7 @@ module AnnotateModels
end
cols = klass.columns
cols = cols.sort_by(&:name) unless(options[:no_sort])
cols = cols.sort_by(&:name) if(options[:sort])
cols.each do |col|
attrs = []
attrs << "default(#{quote(col.default)})" unless col.default.nil?
......@@ -211,9 +211,7 @@ module AnnotateModels
def remove_annotation_of_file(file_name)
if File.exist?(file_name)
content = File.read(file_name)
content.sub!(PATTERN, '')
File.open(file_name, "wb") { |f| f.puts content }
end
end
......
......@@ -26,7 +26,7 @@ task :annotate_models => :environment do
options[:ignore_model_sub_dir] = ENV['ignore_model_sub_dir'] =~ true_re
options[:format_rdoc] = ENV['format_rdoc'] =~ true_re
options[:format_markdown] = ENV['format_markdown'] =~ true_re
options[:no_sort] = ENV['no_sort'] =~ true_re
options[:sort] = ENV['sort'] =~ true_re
options[:force] = ENV['force'] =~ true_re
AnnotateModels.do_annotations(options)
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