Project Lines of Code / LOC from TextMate?
Asked Answered
S

2

5

I'm trying to find a trivially easy way of estimating the LOC for 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.

Scottiescottish answered 24/4, 2011 at 8:53 Comment(0)
S
8

Type rake stats into a terminal. It will output Code Lines of Code as well as Test Lines of Code.

Singleton answered 24/4, 2011 at 10:4 Comment(1)
Ryan - this doesn't output HTML/CSS, does it?Scottiescottish
G
0

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
Gastrin answered 25/4, 2011 at 21:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.