Skip to content

Instantly share code, notes, and snippets.

@sonsongithub
Created October 23, 2014 10:58
Show Gist options
  • Save sonsongithub/f5e7090478df06f403b1 to your computer and use it in GitHub Desktop.
Save sonsongithub/f5e7090478df06f403b1 to your computer and use it in GitHub Desktop.
line counter for itch
#!/usr/bin/env ruby
paths = []
paths.push(ARGV[0] + "/**/*.h")
paths.push(ARGV[0] + "/**/*.m")
blacklist = ["/imobile/", "/nend/", "/Google/", "/Evernote/", "/admob/", "/TestFlight/", "/UICoderz/"]
lines = 0
files = 0
paths.each{|path|
Dir::glob(path).each {|f|
flag = false
blacklist.each{|blackpath|
if f =~ /#{blackpath}/
flag = true
break
end
}
if flag == false
result = `wc -l #{f}`
elements = result.split(" ")
lines = lines + elements[0].to_i
files = files + 1
end
}
}
puts lines
puts files
puts `git rev-list #{ARGV[0]} HEAD --count`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment