Class: Bundler::Source::Git
- Inherits:
-
Path
- Object
- Path
- Bundler::Source::Git
show all
- Defined in:
- lib/bundler/source.rb
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.
464
465
466
467
468
469
470
471
472
473
474
475
|
# File 'lib/bundler/source.rb', line 464
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
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
462
463
464
|
# File 'lib/bundler/source.rb', line 462
def options
@options
end
|
#ref ⇒ Object
Returns the value of attribute ref.
462
463
464
|
# File 'lib/bundler/source.rb', line 462
def ref
@ref
end
|
#submodules ⇒ Object
Returns the value of attribute submodules.
462
463
464
|
# File 'lib/bundler/source.rb', line 462
def submodules
@submodules
end
|
#uri ⇒ Object
Returns the value of attribute uri.
462
463
464
|
# File 'lib/bundler/source.rb', line 462
def uri
@uri
end
|
Class Method Details
.from_lock(options) ⇒ Object
477
478
479
|
# File 'lib/bundler/source.rb', line 477
def self.from_lock(options)
new(options.merge("uri" => options.delete("remote")))
end
|
Instance Method Details
#eql?(o) ⇒ Boolean
Also known as:
==
492
493
494
495
496
497
498
499
|
# File 'lib/bundler/source.rb', line 492
def eql?(o)
Git === o &&
uri == o.uri &&
ref == o.ref &&
name == o.name &&
version == o.version &&
submodules == o.submodules
end
|
#install(spec) ⇒ Object
539
540
541
542
543
544
545
546
547
548
|
# File 'lib/bundler/source.rb', line 539
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
550
551
552
553
554
|
# File 'lib/bundler/source.rb', line 550
def load_spec_files
super
rescue PathError, GitError
raise GitError, "#{to_s} is not checked out. Please run `bundle install`"
end
|
#name ⇒ Object
508
509
510
|
# File 'lib/bundler/source.rb', line 508
def name
File.basename(@uri, '.git')
end
|
#specs ⇒ Object
TODO: actually cache git specs
529
530
531
532
533
534
535
536
537
|
# File 'lib/bundler/source.rb', line 529
def specs
if allow_git_ops? && !@update
cache
checkout
@update = true
end
local_specs
end
|
#to_lock ⇒ Object
481
482
483
484
485
486
487
488
489
490
|
# File 'lib/bundler/source.rb', line 481
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
|
#to_s ⇒ Object
503
504
505
506
|
# File 'lib/bundler/source.rb', line 503
def to_s
sref = options["ref"] ? shortref_for_display(options["ref"]) : ref
"#{uri} (at #{sref})"
end
|
#unlock! ⇒ Object
524
525
526
|
# File 'lib/bundler/source.rb', line 524
def unlock!
@revision = nil
end
|