Skip to content

Instantly share code, notes, and snippets.

@compleatang
Created July 16, 2013 15:55
Show Gist options
  • Select an option

  • Save compleatang/6010018 to your computer and use it in GitHub Desktop.

Select an option

Save compleatang/6010018 to your computer and use it in GitHub Desktop.
Log all the Repos
#!/usr/bin/env ruby
#^jist -u 6010018 logrepos
require 'yaml'
Dir.chdir(ENV['HOME'])
@file = "/home/coda/Dropbox/Dot-Files/repositories"
@repos = `find . -name '*.git' -type d`.split("\n").reject{|e| e[/\A\.\/\.antigen/]}
@repos = @repos.dup.inject({}) do |hash, repo|
repo = repo.split("/")[0..-2].join("/")
Dir.chdir(repo)
r = `git remote -v`.split("\n").inject({}){|h,e| q=e.split("\t"); h[q[0]] = q[1].split(" ").first; h }
b = `git branch`.split("\n").each{|e| e.gsub!("*", ""); e.lstrip!}
hash[repo] = {"remotes"=>r,"branches"=>b}
Dir.chdir(ENV['HOME'])
hash
end
File.open(@file, "w") {|f| f.write( YAML.dump(@repos) ) }
#!/usr/bin/env ruby
require 'yaml'
Dir.chdir(ENV['HOME'])
@file = "/home/coda/Dropbox/Dot-Files/repositories"
@repos = `find . -name '*.git' -type d`.split("\n").reject{|e| e[/\A\.\/\.antigen/]}
@repos = @repos.dup.inject({}) do |hash, repo|
repo = repo.split("/")[0..-2].join("/")
Dir.chdir(repo)
r = `git remote -v`.split("\n").inject({}){|h,e| q=e.split("\t"); h[q[0]] = q[1].split(" ").first; h }
b = `git branch`.split("\n").each{|e| e.gsub!("*", ""); e.lstrip!}
hash[repo] = {"remotes"=>r,"branches"=>b}
Dir.chdir(ENV['HOME'])
hash
end
File.open(@file, "w") {|f| f.write( YAML.dump(@repos) ) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment