2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-12-16 09:32:06 -05:00
|
|
|
# While global constants are bad, many 3rd party tools depend on this one (e.g
|
|
|
|
# rspec-rails & cucumber-rails). So a deprecation warning is needed if we want
|
|
|
|
# to remove it.
|
2014-05-25 19:19:53 -04:00
|
|
|
STATS_DIRECTORIES = [
|
|
|
|
%w(Controllers app/controllers),
|
|
|
|
%w(Helpers app/helpers),
|
2014-08-24 08:41:58 -04:00
|
|
|
%w(Jobs app/jobs),
|
2014-05-25 19:19:53 -04:00
|
|
|
%w(Models app/models),
|
|
|
|
%w(Mailers app/mailers),
|
2016-04-24 01:15:00 -04:00
|
|
|
%w(Channels app/channels),
|
2016-12-02 04:23:57 -05:00
|
|
|
%w(JavaScripts app/assets/javascripts),
|
2014-05-25 19:19:53 -04:00
|
|
|
%w(Libraries lib/),
|
|
|
|
%w(APIs app/apis),
|
|
|
|
%w(Controller\ tests test/controllers),
|
|
|
|
%w(Helper\ tests test/helpers),
|
|
|
|
%w(Model\ tests test/models),
|
|
|
|
%w(Mailer\ tests test/mailers),
|
2015-01-09 04:54:11 -05:00
|
|
|
%w(Job\ tests test/jobs),
|
2014-05-25 19:19:53 -04:00
|
|
|
%w(Integration\ tests test/integration),
|
2016-08-05 09:36:54 -04:00
|
|
|
%w(System\ tests test/system),
|
2014-11-05 08:17:37 -05:00
|
|
|
].collect do |name, dir|
|
2014-05-25 19:19:53 -04:00
|
|
|
[ name, "#{File.dirname(Rake.application.rakefile_location)}/#{dir}" ]
|
|
|
|
end.select { |name, dir| File.directory?(dir) }
|
|
|
|
|
2014-05-23 16:28:06 -04:00
|
|
|
desc "Report code statistics (KLOCs, etc) from the application or engine"
|
2005-09-03 11:13:06 -04:00
|
|
|
task :stats do
|
2017-10-21 09:08:33 -04:00
|
|
|
require "rails/code_statistics"
|
2005-09-05 11:39:20 -04:00
|
|
|
CodeStatistics.new(*STATS_DIRECTORIES).to_s
|
2014-08-24 08:41:58 -04:00
|
|
|
end
|