How do you add a folder for rake statistics?

I added some folders (lib, spec, cells, etc.) to my Rails application and would like to add them to the list of rake statistics. Can I add new folders?

+5
source share
2 answers

Here's a great answer to find where a specific rake task is defined .

Using this advice, it turned out that the task is rake statsdefined in the file gems/railties-3.2.11/lib/rails/tasks/statistics.rake; therefore it is located in railties gem, which is part of the repository.

At the very top of the file, the directories in question are included in the variable STATS_DIRECTORIES.

, rake - , my_stats - , .

+3

, , , .

rake- , :

task :stats => "todolist:statsetup"

namespace :todolist do
  task :statsetup do
    require 'rails/code_statistics'
    ::STATS_DIRECTORIES << ["Policies", "app/policies"]
    ::STATS_DIRECTORIES << ["Services", "app/services"]

    # For test folders not defined in CodeStatistics::TEST_TYPES (ie: spec/)
    ::STATS_DIRECTORIES << ["Services specs", "specs/services"]
    CodeStatistics::TEST_TYPES << "Services specs"
  end
end

rake stats

+11

All Articles