Module: Dafuq::Git

Defined in:
lib/dafuq/git.rb

Class Method Summary collapse

Class Method Details

.pull(base_path, recursive = true) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dafuq/git.rb', line 15

def self.pull(base_path, recursive = true)
  repos(base_path).each{|repo|
    begin
      pid = spawn("cd #{repo} ; git pull ; cd -")
      Dafuq.log_me "Updating: #{repo}; PID##{pid}"
    rescue
      Dafuq.log_me "ERROR: updating repo at #{repo}"
      raise
    end
  }
end

.repos(path, recursive = true) ⇒ Object



8
9
10
11
12
# File 'lib/dafuq/git.rb', line 8

def self.repos(path, recursive=true)
  path = File.expand_path path
  git_configs = FileList["#{path}/#{recursive ? '**/' : ''}.git/config"]
  git_configs.pathmap("%d").pathmap("%d")
end