Over a million developers have joined DZone.

Ruby Rake::todo

DZone's Guide to

Ruby Rake::todo

Free Resource
Simply reads the set directories, and scans the .rb files for @todo, will report the line before and line after @todo 
Needs console coloring to work: http://snippets.dzone.com/posts/show/7148

EDIT: After readind Michals comment i decided to change it, i hope it all works a bit faster now and doesnt have to give in on functionalities.

  # A probably controversial way of achieving different task effects
  @task_captures = @legend =  ""
  {:todo => :green, :fixme => :blue, :bug => "red blink"}.each do |task, eff|
    @task_captures += "#{task}|"
    methods = eff.to_s.split(/[\.\s]/).map{|e| ".console_#{e}" }.join().to_a.map {|e| 
      "def #{task}; self#{e}; end; "
    eval(%{class String; #{methods} end})
    @legend += eval(%{"#{task.to_s.upcase} ".#{task}})
  @task_captures.gsub!(/(.)$/, "")
  puts ("Legend:".console_bold)+" #{@legend}"
  puts ""
  tasks = files = 0
  %w{. app config test lib}.each do |dir|
    Dir.entries(dir).each do |entry|
      next unless entry =~ /\.rb$/i
      files   += 1
      f_tasks  = 0
      (lines = IO.readlines("#{dir}/#{entry}")).each_with_index do |line, i|
        next if i==0 || i==(lines.size-1) || line.empty?
        next unless line.match(/^[\s]*\#.*?(#{@task_captures})[\s\:]*(.+?)$/i)
        puts eval(%{'#{$2}'.#{$1.downcase}()}).to_s + " on line: #{i}"
        puts "   \e[1mline before: \e[0m#{lines[i-1].chomp}" if (lines[i-1].match(/[^\s]/) || []).size > 0
        puts "   \e[1mline after: \e[0m#{lines[i+1].gsub!(/^[\s\#]*/, "")}"
        tasks   += 1
        f_tasks += 1
      puts "#{f_tasks} task(s) in total for #{dir}/#{entry}\n".console_bold if f_tasks > 0
  puts "#{tasks} tasks over #{files} files".console_dark_yellow

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}