Class: Braid::Operations::GitCache
- Inherits:
-
Object
- Object
- Braid::Operations::GitCache
- Includes:
- Singleton
- Defined in:
- lib/braid/operations.rb
Instance Method Summary collapse
Instance Method Details
#fetch(url) ⇒ Object
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/braid/operations.rb', line 447 def fetch(url) dir = path(url) # remove local cache if it was created with --no-checkout if File.exists?("#{dir}/.git") FileUtils.rm_r(dir) end if File.exists?(dir) Dir.chdir(dir) do git.fetch end else FileUtils.mkdir_p(local_cache_dir) git.clone('--mirror', url, dir) end end |
#path(url) ⇒ Object
465 466 467 |
# File 'lib/braid/operations.rb', line 465 def path(url) File.join(local_cache_dir, url.gsub(/[\/:@]/, '_')) end |