'Place the annotations at the top (before) or the bottom (after) of the serializer files')do|p|
ENV['position_in_serializer']=p
has_set_position['position_in_serializer']=true
end
...
...
@@ -89,34 +86,32 @@ OptionParser.new do |opts|
ENV['wrapper_close']=p
end
opts.on('-r','--routes',
"Annotate routes.rb with the output of 'rake routes'")do
opts.on('-r','--routes',"Annotate routes.rb with the output of 'rake routes'")do
ENV['routes']='true'
end
opts.on('-v','--version',
"Show the current version of this gem")do
'Show the current version of this gem')do
puts"annotate v#{Annotate.version}";exit
end
opts.on('-m','--show-migration',
"Include the migration version number in the annotation")do
ENV['include_version']="yes"
opts.on('-m','--show-migration','Include the migration version number in the annotation')do
ENV['include_version']='yes'
end
opts.on('-k','--show-foreign-keys',
"List the table's foreign key constraints in the annotation")do
ENV['show_foreign_keys']="yes"
ENV['show_foreign_keys']='yes'
end
opts.on('-i','--show-indexes',
"List the table's database indexes in the annotation")do
ENV['show_indexes']="yes"
ENV['show_indexes']='yes'
end
opts.on('-s','--simple-indexes',
"Concat the column's related indexes in the annotation")do
ENV['simple_indexes']="yes"
ENV['simple_indexes']='yes'
end
opts.on('--model-dir dir',
...
...
@@ -131,17 +126,17 @@ OptionParser.new do |opts|
opts.on('--ignore-model-subdirects',
"Ignore subdirectories of the models directory")do|dir|
ENV['ignore_model_sub_dir']="yes"
ENV['ignore_model_sub_dir']='yes'
end
opts.on('--sort',
"Sort columns alphabetically, rather than in creation order")do|dir|
ENV['sort']="yes"
ENV['sort']='yes'
end
opts.on('--classified-sort',
"Sort columns alphabetically, but first goes id, then the rest columns, then the timestamp columns and then the association columns")do|dir|
ENV['classified_sort']="yes"
ENV['classified_sort']='yes'
end
opts.on('-R','--require path',
...
...
@@ -155,10 +150,10 @@ OptionParser.new do |opts|
opts.on('-e','--exclude [tests,fixtures,factories,serializers]',Array,"Do not annotate fixtures, test files, factories, and/or serializers")do|exclusions|
expect(@mock_file).toreceive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map \(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
it"should remove trailing annotation and trim trailing newlines, but leave leading newlines alone"do
it'should remove trailing annotation and trim trailing newlines, but leave leading newlines alone'do
expect(File).toreceive(:read).with(ROUTE_FILE).and_return("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n# == Route Map\n#\n# another good line\n# good line\n")
it"should remove prepended annotation and trim leading newlines, but leave trailing newlines alone"do
it'should remove prepended annotation and trim leading newlines, but leave trailing newlines alone'do
expect(File).toreceive(:read).with(ROUTE_FILE).and_return("# == Route Map\n#\n# another good line\n# good line\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n")