Commit 3c29b0ac by Jon Frisby

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

Conflicts: annotate.gemspec bin/annotate lib/annotate/annotate_models.rb
parents 61b2574d 42515461
......@@ -101,11 +101,11 @@ anywhere in the file:
-i, --show-indexes List the table's database indexes in the annotation
-s, --simple-indexes Concat the column's related indexes in the annotation
--model-dir dir Annotate model files stored in dir rather than app/models
--ignore-model-subdirs Ignore sub-directories of the models directory.
-R, --require path Additional files to require before loading models
-e [tests,fixtures] Do not annotate fixtures/factories, and/or test files
--exclude
== WARNING
Note that this code will blow away the initial/final comment
......
......@@ -50,6 +50,11 @@ OptionParser.new do |opts|
ENV['model_dir'] = dir
end
opts.on('--ignore-model-subdirects',
"Ignore subdirectories of the models directory") do |dir|
ENV['ignore_model_sub_dir'] = "yes"
end
opts.on('-R', '--require path',
"Additional files to require before loading models") do |path|
if ENV['require']
......
......@@ -257,7 +257,11 @@ module AnnotateModels
if models.empty?
begin
Dir.chdir(model_dir) do
models = Dir["**/*.rb"]
models = if options[:ignore_model_sub_dir]
Dir["*.rb"]
else
Dir["**/*.rb"]
end
end
rescue SystemCallError
puts "No models found in directory '#{model_dir}'."
......
......@@ -11,6 +11,7 @@ if(Rails.env.development?)
ENV['include_version'] = "false"
ENV['exclude_tests'] = "false"
ENV['exclude_fixtures'] = "false"
ENV['ignore_model_sub_dir'] = "false"
ENV['skip_on_db_migrate'] = "false"
ENV['format_rdoc'] = "false"
end
......@@ -16,6 +16,7 @@ task :annotate_models => :environment do
options[:require] = ENV['require'] ? ENV['require'].split(',') : []
options[:exclude_tests] = ENV['exclude_tests'] =~ true_re
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
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