Created
July 17, 2009 21:12
-
-
Save outoftime/149278 to your computer and use it in GitHub Desktop.
Count lines of Ruby code agnostic to the newline style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'parse_tree' | |
require 'ruby2ruby' | |
count = 0 | |
for file in ARGV | |
file_count = Ruby2Ruby.translate(IO.read(file), nil).count("\n") | |
count += file_count | |
puts sprintf("%5d %s", file_count, file) | |
end | |
puts sprintf("%5d Total", count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment