来自TextMate的Code / LOC项目行?

时间:2011-04-24 08:53:25

标签: ruby-on-rails ruby-on-rails-3 textmate loc

我正在尝试找到一种简单的方法来估算我的Rails项目的LOC,包括视图和CSS。

有没有办法使用TextMate来做到这一点?

如果没有,还有什么可以为Rails获得 LOC估计值?

修改

为了澄清,我要求一种方法来确定包含 html和css的值。

2 个答案:

答案 0 :(得分:8)

在终端中输入rake stats。它将输出代码行代码以及代码测试行。

答案 1 :(得分:0)

看看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