Last active
October 24, 2017 23:46
-
-
Save natanael-araujo/e6f9c186f50c8751e70c37fd5cbd1c08 to your computer and use it in GitHub Desktop.
auxiliar a identificação de forks entre muitos projetos
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
require 'git' | |
# auxiliar a identificação de forks em um workspace bagunçado | |
mapping = Hash.new { |h, v| h[v] = [] } | |
Dir.glob('*/').each do |path| | |
last_commit = Git.open(path).log(99999).last | |
mapping["#{last_commit.sha[0,6]} - #{last_commit.message}"].push path | |
end | |
File.open('./projects_index', 'wb') do |file| | |
file.puts("Total of projects: #{mapping.values.flatten.count}\n") | |
mapping.each do |commit, projects| | |
file.puts("\nFirst commit: #{commit}") | |
file.puts("Total of forks: #{projects.count}") | |
projects.each { |project_path| file.puts("\t#{project_path.chop}") } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment