@@ -344,28 +344,27 @@ def options_with_position(options, position_in)
344
344
options . merge ( :position => ( options [ position_in ] || options [ :position ] ) )
345
345
end
346
346
347
- # Return a list of the model files to annotate. If we have
348
- # command line arguments, they're assumed to be either
349
- # the underscore or CamelCase versions of model names.
350
- # Otherwise we take all the model files in the
351
- # model_dir directory.
347
+ # Return a list of the model files to annotate.
348
+ # If we have command line arguments, they're assumed to the path
349
+ # of model files from root dir. Otherwise we take all the model files
350
+ # in the model_dir directory.
352
351
def get_model_files ( options )
352
+ models = [ ]
353
353
if ( !options [ :is_rake ] )
354
- models = ARGV . dup
355
- models . shift
356
- else
357
- models = [ ]
354
+ models = ARGV . dup . reject { |m | m . match ( /^(.*)=/ ) }
358
355
end
359
- models . reject! { | m | m . match ( /^(.*)=/ ) }
356
+
360
357
if models . empty?
361
358
begin
362
359
model_dir . each do |dir |
363
360
Dir . chdir ( dir ) do
364
- models . concat ( if options [ :ignore_model_sub_dir ]
365
- Dir [ "*.rb" ] . map { |f | [ dir , f ] }
366
- else
367
- Dir [ "**/*.rb" ] . reject { |f | f [ "concerns/" ] } . map { |f | [ dir , f ] }
368
- end )
361
+ lst =
362
+ if options [ :ignore_model_sub_dir ]
363
+ Dir [ "*.rb" ] . map { |f | [ dir , f ] }
364
+ else
365
+ Dir [ "**/*.rb" ] . reject { |f | f [ "concerns/" ] } . map { |f | [ dir , f ] }
366
+ end
367
+ models . concat ( lst )
369
368
end
370
369
end
371
370
rescue SystemCallError
@@ -375,6 +374,9 @@ def get_model_files(options)
375
374
exit 1
376
375
end
377
376
end
377
+
378
+ puts "MODELS: #{ models } "
379
+
378
380
models
379
381
end
380
382
0 commit comments