123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Resolver::Base

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/resolver/base.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(base, additional_base_requirements) ⇒ Base

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 6

def initialize(base, additional_base_requirements)
  @base = base
  @additional_base_requirements = additional_base_requirements
end

Instance Method Details

#[](name)

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 11

def [](name)
  @base[name]
end

#base_requirements

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 19

def base_requirements
  @base_requirements ||= build_base_requirements
end

#build_base_requirements (private)

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 39

def build_base_requirements
  base_requirements = {}
  @base.each do |ls|
    dep = Dependency.new(ls.name, ls.version)
    base_requirements[ls.name] = dep
  end
  @additional_base_requirements.each {|d| base_requirements[d.name] = d }
  base_requirements
end

#delete(spec)

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 15

def delete(spec)
  @base.delete(spec)
end

#unlock_deps(deps)

[ GitHub ]

  
# File 'lib/bundler/resolver/base.rb', line 23

def unlock_deps(deps)
  exact, lower_bound = deps.partition(&:specific?)

  exact.each do |exact_dep|
    @base.delete_by_name_and_version(exact_dep.name, exact_dep.requirement.requirements.first.last)
  end

  lower_bound.each do |lower_bound_dep|
    @additional_base_requirements.delete(lower_bound_dep)
  end

  @base_requirements = nil
end