Method: Codger::Manager#cache

Defined in:
lib/codger/manager.rb

#cache(identifier) ⇒ Object

Clone the specified repo into #cached_base.



86
87
88
89
90
91
92
93
94
95
# File 'lib/codger/manager.rb', line 86

def cache identifier
  return if settings[:cached][identifier]
  identifier = File.expand_path identifier if File.exist?(identifier) # hacky
  FileUtils.mkdir_p cached_base
  next_id = Dir.entries(cached_base).map(&:to_i).max + 1
  clone = File.join cached_base, next_id.to_s
  Git.clone identifier, clone
  @global_settings[:cached][identifier] = clone
  save_globals
end