我试图找到一种简单的方法来估计我的 Rails 项目的 LOC,包括视图和 CSS。
有没有办法使用 TextMate 做到这一点?
如果没有,还有什么办法可以得到Rails的总LOC 估计值?
编辑
为了澄清起见,我要求一种方法来确定包含html 和 css 的值。
我试图找到一种简单的方法来估计我的 Rails 项目的 LOC,包括视图和 CSS。
有没有办法使用 TextMate 做到这一点?
如果没有,还有什么办法可以得到Rails的总LOC 估计值?
为了澄清起见,我要求一种方法来确定包含html 和 css 的值。
输入rake stats
终端。它将输出代码行以及代码测试行。
看看 rake 任务 - 添加视图应该不会太难: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