Class: Bundler::GitSource

Inherits:
DirectorySource show all
Defined in:
lib/bundler08/source.rb

Instance Attribute Summary collapse

Attributes inherited from DirectorySource

#required_specs, #specs

Attributes inherited from Source

#bundle

Instance Method Summary collapse

Methods inherited from DirectorySource

#==, #add_spec, #locate_gemspecs, #merge_defined_specs, #validate_gemspec

Constructor Details

#initialize(bundle, options) ⇒ GitSource

Returns a new instance of GitSource.



302
303
304
305
306
307
# File 'lib/bundler08/source.rb', line 302

def initialize(bundle, options)
  super
  @uri = options[:uri]
  @branch = options[:branch] || 'master'
  @ref = options[:ref] || "origin/#{@branch}"
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



300
301
302
# File 'lib/bundler08/source.rb', line 300

def branch
  @branch
end

#refObject (readonly)

Returns the value of attribute ref.



300
301
302
# File 'lib/bundler08/source.rb', line 300

def ref
  @ref
end

#uriObject (readonly)

Returns the value of attribute uri.



300
301
302
# File 'lib/bundler08/source.rb', line 300

def uri
  @uri
end

Instance Method Details

#download(spec) ⇒ Object



325
326
327
# File 'lib/bundler08/source.rb', line 325

def download(spec)
  # Nothing needed here
end

#gemsObject



319
320
321
322
323
# File 'lib/bundler08/source.rb', line 319

def gems
  update if Bundler.remote?
  checkout if Bundler.writable?
  super
end

#local?Boolean

Returns:

  • (Boolean)

Raises:



309
310
311
312
# File 'lib/bundler08/source.rb', line 309

def local?
  raise SourceNotCached, "Git repository '#{@uri}' has not been cloned yet" unless location.directory?
  super
end

#locationObject



314
315
316
317
# File 'lib/bundler08/source.rb', line 314

def location
  # TMP HAX to get the *.gemspec reading to work
  bundle.gem_path.join('dirs', File.basename(@uri, '.git'))
end

#to_sObject



329
330
331
# File 'lib/bundler08/source.rb', line 329

def to_s
  "git: #{uri}"
end