Cyrus
Cyrus

Reputation: 3717

Custom rake:stats

How do I make a custom rake:stats so that I can examine the number of lines of code in a different directory?

For example, I have a app/workers directory for my resque workers, that I would like to profile.

I'm using rspec. I want something along the lines of Rake stats and Cucumber, but I don't have a /lib/tasks/rspec.rake

Upvotes: 3

Views: 1299

Answers (2)

Eva
Eva

Reputation: 4700

This article shows how to do it:

task :stats => "omakase:stats"

namespace :omakase do
  task :stats do
    require 'rails/code_statistics'
    ::STATS_DIRECTORIES << ["Services", "app/services"]
    ::STATS_DIRECTORIES << ["Services Tests", "test/services"]
    CodeStatistics::TEST_TYPES << 'Services Tests'
  end
end

Upvotes: 4

user1264973
user1264973

Reputation: 36

Sorry I don't know how to edit rake stats. But you could try this script in terminal on Mac, for example counting LOC in views directory:

find app/views -name "*html.erb" -exec wc -l {} \;

Hope that helps

Upvotes: 2

Related Questions