【问题标题】:Project Lines of Code / LOC from TextMate?来自 TextMate 的项目代码行/LOC?
【发布时间】:2011-04-24 08:53:25
【问题描述】:

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

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

如果没有,还有什么方法可以得到 Rails 的total LOC 估计值?

编辑

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

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 textmate lines-of-code


    【解决方案1】:

    在终端中输入rake stats。它将输出 Code Lines of Code 以及 Test Lines of Code。

    【讨论】:

    • Ryan - 这不会输出 HTML/CSS,是吗?
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多