Class: Braid::Operations::GitCache

Inherits:
Proxy
  • Object
show all
Defined in:
lib/braid/operations.rb

Instance Method Summary collapse

Methods inherited from Proxy

command, #require_version, #require_version!, #version

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Braid::Operations::Proxy

Instance Method Details

#init_or_fetch(url, dir) ⇒ Object



287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/braid/operations.rb', line 287

def init_or_fetch(url, dir)
  if File.exists? dir
    msg "Updating local cache of '#{url}' into '#{dir}'."
    FileUtils.cd(dir) do |d|
      status, out, err = exec!("git fetch")
    end
  else
    FileUtils.mkdir_p(Braid::LOCAL_CACHE_DIR)

    msg "Caching '#{url}' into '#{dir}'."
    status, out, err = exec!("git clone --mirror #{url} #{dir}")
  end
end