Project Lines of Code / LOC from TextMate?
I'm trying to find a trivially easy way of estimating the LOC for 开发者_StackOverflow中文版my Rails project, including views and CSS.
Is there a way to do this using TextMate?
If not, how else can one go about getting a total LOC estimate for Rails?
Edit
For clarification, I'm asking for a way to determine a value that includes html and css.
Type rake stats
into a terminal. It will output Code Lines of Code as well as Test Lines of Code.
Take a look at the rake task - it should not be too difficult to add the views: https://github.com/rails/rails/blob/master/railties/lib/rails/tasks/statistics.rake
STATS_DIRECTORIES = [
%w(Controllers app/controllers),
%w(Helpers app/helpers),
%w(Models app/models),
%w(Libraries lib/),
%w(APIs app/apis),
%w(Integration\ tests test/integration),
%w(Functional\ tests test/functional),
%w(Unit\ tests test/unit)
].collect { |name, dir| [ name, "#{Rails.root}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
desc "Report code statistics (KLOCs, etc) from the application"
task :stats do
require 'rails/code_statistics'
CodeStatistics.new(*STATS_DIRECTORIES).to_s
end
精彩评论