1 desc "Checks your app and gently warns you if you are using deprecated code."
2 task :deprecated => :environment do
4 '@params' => 'Use params[] instead',
5 '@session' => 'Use session[] instead',
6 '@flash' => 'Use flash[] instead',
7 '@request' => 'Use request[] instead',
8 '@env' => 'Use env[] instead',
9 'find_all' => 'Use find(:all) instead',
10 'find_first' => 'Use find(:first) instead',
11 'render_partial' => 'Use render :partial instead',
12 'component' => 'Use of components are frowned upon',
13 'paginate' => 'The default paginator is slow. Writing your own may be faster',
14 'start_form_tag' => 'Use form_for instead',
15 'end_form_tag' => 'Use form_for instead',
16 ':post => true' => 'Use :method => :post instead'
19 deprecated.each do |key, warning|
21 output = `cd '#{File.expand_path('app', RAILS_ROOT)}' && grep -n --exclude=*.svn* -r '#{key}' *`
23 puts " !! " + warning + " !!"
24 puts ' ' + '.' * (warning.length + 6)
27 puts " Clean! Cheers for you!"