Commit 75904357 by Jon Frisby

Merge remote-tracking branch 'tonyday/master' into development

Conflicts: .gitignore Rakefile annotate.gemspec bin/annotate lib/annotate/annotate_models.rb lib/tasks/annotate_models.rake
parents 5f0d3c95 8d3c00c7
......@@ -55,6 +55,11 @@ 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"
end
opts.on('-R', '--require path',
"Additional files to require before loading models") do |path|
if ENV['require']
......
......@@ -62,7 +62,9 @@ module AnnotateModels
max_size = klass.column_names.map{|name| name.size}.max || 0
max_size += options[:format_rdoc] ? 5 : 1
klass.columns.sort_by(&:name).each do |col|
cols = klass.columns
cols = cols.sort_by(&:name) unless(options[:no_sort])
cols.each do |col|
attrs = []
attrs << "default(#{quote(col.default)})" unless col.default.nil?
attrs << "not null" unless col.null
......
......@@ -14,4 +14,5 @@ if(Rails.env.development?)
ENV['ignore_model_sub_dir'] = "false"
ENV['skip_on_db_migrate'] = "false"
ENV['format_rdoc'] = "false"
ENV['no_sort'] = "false"
end
......@@ -18,6 +18,7 @@ task :annotate_models => :environment do
options[:exclude_fixtures] = ENV['exclude_fixtures'] =~ true_re
options[:ignore_model_sub_dir] = ENV['ignore_model_sub_dir'] =~ true_re
options[:format_rdoc] = ENV['format_rdoc'] =~ true_re
options[:no_sort] = ENV['no_sort'] =~ 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