Class: GemOnDemand::Checkout

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_on_demand/checkout.rb

Constant Summary collapse

NotFound =
Class.new(Exception)
NOT_FOUND =
"not-found"
UPDATED_AT =
"updated_at"
DIR =
File.expand_path("~/.gem-on-demand/cache")
CACHE_DURATION =

for project tags

15 * 60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, project) ⇒ Checkout

Returns a new instance of Checkout.



11
12
13
14
15
# File 'lib/gem_on_demand/checkout.rb', line 11

def initialize(user, project)
  self.user = user
  self.project = project
  Utils.ensure_directory(dir)
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



9
10
11
# File 'lib/gem_on_demand/checkout.rb', line 9

def project
  @project
end

#userObject

Returns the value of attribute user.



9
10
11
# File 'lib/gem_on_demand/checkout.rb', line 9

def user
  @user
end

Instance Method Details

#cacheObject



22
23
24
# File 'lib/gem_on_demand/checkout.rb', line 22

def cache
  @cache ||= FileCache.new("#{dir}/cache")
end

#chdir(&block) ⇒ Object



17
18
19
20
# File 'lib/gem_on_demand/checkout.rb', line 17

def chdir(&block)
  clone_or_refresh
  Dir.chdir(dir, &block)
end