Class: Braid::Operations::GitCache
- Defined in:
- lib/braid/operations.rb
Instance Method Summary collapse
Methods inherited from Proxy
command, #require_version, #require_version!, verbose, #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
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/braid/operations.rb', line 299 def init_or_fetch(url, dir) if File.exists? dir # bail if the local cache was created with --no-checkout if File.exists? "#{dir}/.git" raise LocalCacheDirBroken.new(dir) end 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 |