Created
November 27, 2018 15:25
-
-
Save ignazioc/200db191b80aba935cf146e1abccd9ec to your computer and use it in GitHub Desktop.
This file contains 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 'FileUtils' | |
require 'json' | |
require 'date' | |
Dir.chdir('ios-client') do | |
system("git checkout develop") | |
# Collect the commits | |
commit_list = [] | |
result = [] | |
dates = [] | |
200.downto(1) { |i| | |
sha1 = %x[git rev-list -n 1 --before='#{i} weeks ago' develop] | |
date = %x[git show -s --format=%ci #{sha1}] | |
date = Date.parse(date) | |
commit_list << {SHA1: sha1, DATE: date.strftime("%d/%m/%Y") } | |
} | |
# Collect the CLOC | |
commit_list.each do | commit | | |
system("git checkout #{commit[:SHA1]}") | |
output = %x[cloc --fullpath --not-match-d="(vendor|ci-dependencies|Pods|DerivedData|Documentation|fastlane,lib,Provisioning,Screenshots)" --include-lang="Swift,Objective C" --json --ignore-whitespace --quiet .] | |
hash = JSON.parse(output) | |
objc = hash["Objective C"]["code"] | |
swift = 0 | |
unless hash["Swift"].nil? | |
swift = hash["Swift"]["code"] | |
end | |
result << "#{commit[:SHA1].strip!},#{commit[:DATE]},#{objc},#{swift}" | |
end | |
puts result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment