Created
August 28, 2015 13:30
-
-
Save barelyknown/a7d26f71bf498718292b to your computer and use it in GitHub Desktop.
Setup for `bundle exec rake stats`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :stats => "app:stats_setup" | |
# insert additional types into the statistics table and sort the list | |
namespace :app do | |
task :stats_setup do | |
require 'rails/code_statistics' | |
app_entries, spec_entries = [], [] | |
until ::STATS_DIRECTORIES.empty? | |
entry = STATS_DIRECTORIES.shift | |
case entry[0] | |
when / specs/ | |
spec_entries << entry | |
else | |
app_entries << entry | |
end | |
end | |
[ | |
["Policies", "./app/policies"], | |
["Resources", "./app/resources"] | |
].each do |new_entry| | |
index = 0 | |
app_entries.each do |entry| | |
break if new_entry[0] < entry[0] | |
index += 1 | |
end | |
app_entries.insert(index - 1, new_entry) | |
end | |
::STATS_DIRECTORIES.push *app_entries.sort | |
::STATS_DIRECTORIES.push *spec_entries.sort | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment