require 'code_statistics' STATS_DIRECTORIES = [ %w(Library lib/), %w(Behavior\ tests features/), %w(Unit\ tests spec/) ].collect { |name, dir| [ name, "#{dir}" ] }.select { |name, dir| File.directory?(dir) } desc "Report code statistics (KLOCs, etc) from the application" task :stats do CodeStatistics::CodeStatistics.new(*STATS_DIRECTORIES).to_s end