-
-
Save jbrains/9451941 to your computer and use it in GitHub Desktop.
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
GFILE = "Gemfile.lock" | |
list = File.read(GFILE) | |
gems = [] | |
list.each_line do |line| | |
line = line.strip | |
break if line.include?("PLATFORMS") | |
next if line.include?("GEM") | |
next if line.include?("remote:") | |
next if line.include?("specs:") | |
next if line.empty? | |
gems.push(line.split(' ').first) | |
end | |
total = 0 | |
gems.each do |gem| | |
puts "Processing #{gem}" | |
contents = `gem contents #{gem}`.split | |
local = 0 | |
contents.each do |file| | |
output = `wc -l #{file}` | |
amount = output.strip.split(' ').first.to_i | |
local += amount | |
end | |
puts " LOC: #{local}" | |
total += local | |
end | |
puts "Total Lines: #{total}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't care about the interim line count in each gem, then we can remove the duplicate
count_lines
concept, replacing the whole thing with this, in approximate Haskell, of course: