Class: GitExplorer::Explorer

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/git_explorer.rb

Instance Method Summary collapse

Instance Method Details

#explore(root_dir = "./") ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/git_explorer.rb', line 29

def explore(root_dir="./")
  run("find #{root_dir} -type d -name .git", config={:capture=>true, :verbose=>false})
      .split("\n")
      .map{|file| file >> GitExplorer::extract_dir_name}
      .map{|dir| run("basename `git -C #{dir} rev-parse --show-toplevel`; git -C #{dir} status", config={:capture=>true, :verbose=>false})}
      .map{|status| status >> GitExplorer::extract_status}
      .map{|status| say(message="#{status.project_name} is #{status.status} on branch #{status.branch}\n#{status.files.map{|f| "\t#{f}\n"}.join}", color=(:red if status.status.equal?(:not_staged)))}
end