Class: Bundler::Source::Git
Constant Summary
Constants inherited
from Path
Path::DEFAULT_GLOB
Instance Attribute Summary collapse
Attributes inherited from Path
#version
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Path
#cached!, #hash, #local_specs, #remote!
Constructor Details
#initialize(options) ⇒ Git
Returns a new instance of Git.
482
483
484
485
486
487
488
489
490
491
492
493
494
|
# File 'lib/bundler/source.rb', line 482
def initialize(options)
super
%w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] }
@uri = options["uri"]
@ref = options["ref"] || options["branch"] || options["tag"] || 'master'
@revision = options["revision"]
@submodules = options["submodules"]
@update = false
@installed = nil
end
|
Instance Attribute Details
Returns the value of attribute options.
480
481
482
|
# File 'lib/bundler/source.rb', line 480
def options
@options
end
|
Returns the value of attribute ref.
480
481
482
|
# File 'lib/bundler/source.rb', line 480
def ref
@ref
end
|
#submodules ⇒ Object
Returns the value of attribute submodules.
480
481
482
|
# File 'lib/bundler/source.rb', line 480
def submodules
@submodules
end
|
Returns the value of attribute uri.
480
481
482
|
# File 'lib/bundler/source.rb', line 480
def uri
@uri
end
|
Class Method Details
.from_lock(options) ⇒ Object
496
497
498
|
# File 'lib/bundler/source.rb', line 496
def self.from_lock(options)
new(options.merge("uri" => options.delete("remote")))
end
|
Instance Method Details
#eql?(o) ⇒ Boolean
Also known as:
==
511
512
513
514
515
516
517
518
|
# File 'lib/bundler/source.rb', line 511
def eql?(o)
Git === o &&
uri == o.uri &&
ref == o.ref &&
name == o.name &&
version == o.version &&
submodules == o.submodules
end
|
#install(spec) ⇒ Object
558
559
560
561
562
563
564
565
566
567
|
# File 'lib/bundler/source.rb', line 558
def install(spec)
Bundler.ui.info "Using #{spec.name} (#{spec.version}) from #{to_s} "
unless @installed
Bundler.ui.debug " * Checking out revision: #{ref}"
checkout if allow_git_ops?
@installed = true
end
generate_bin(spec)
end
|
#load_spec_files ⇒ Object
569
570
571
572
573
|
# File 'lib/bundler/source.rb', line 569
def load_spec_files
super
rescue PathError, GitError
raise GitError, "#{to_s} is not checked out. Please run `bundle install`"
end
|
527
528
529
|
# File 'lib/bundler/source.rb', line 527
def name
File.basename(@uri, '.git')
end
|
TODO: actually cache git specs
548
549
550
551
552
553
554
555
556
|
# File 'lib/bundler/source.rb', line 548
def specs
if allow_git_ops? && !@update
cache
checkout
@update = true
end
local_specs
end
|
500
501
502
503
504
505
506
507
508
509
|
# File 'lib/bundler/source.rb', line 500
def to_lock
out = "GIT\n"
out << " remote: #{@uri}\n"
out << " revision: #{revision}\n"
%w(ref branch tag submodules).each do |opt|
out << " #{opt}: #{options[opt]}\n" if options[opt]
end
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
out << " specs:\n"
end
|
522
523
524
525
|
# File 'lib/bundler/source.rb', line 522
def to_s
sref = options["ref"] ? shortref_for_display(options["ref"]) : ref
"#{uri} (at #{sref})"
end
|
543
544
545
|
# File 'lib/bundler/source.rb', line 543
def unlock!
@revision = nil
end
|