Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: using rake:notes for javascript

Is there a way to configure rake:notes to parse javascript files and emit respective notes? Thanks

like image 850
Miguel Ping Avatar asked Apr 30 '11 17:04

Miguel Ping


1 Answers

You can do this with grep directly if you want

grep -r 'OPTIMIZE:\|FIXME:\|TODO:' public/javascripts

If you wanted only TODO's

grep -r 'TODO:' public/javascripts # Find on todos

You could use the following to Search all js in the project, not just the files under public javascripts.

grep -r 'OPTIMIZE:\|FIXME:\|TODO:' **/*.js

Here is how you can turn this into a rake task.

# File lib/tasks/notes.rake

namespace :notes do
  task :js do
    puts `grep -r 'OPTIMIZE:\\|FIXME:\\|TODO:' public/javascripts`
  end
end

Now you can execute rake notes:js from the project root.

like image 122
Blake Taylor Avatar answered Oct 26 '22 03:10

Blake Taylor