Class: Vagrant::Bundler::BuiltinSet

Inherits:
Gem::Resolver::Set
  • Object
show all
Defined in:
lib/vagrant/bundler.rb

Overview

This is a custom Gem::Resolver::Set for use with vagrant "system" gems. It allows the installed set of gems to be used for providing a solution while enforcing strict constraints. This ensures that plugins cannot "upgrade" gems that are builtin to vagrant itself.

Instance Method Summary collapse

Constructor Details

#initializeBuiltinSet

Returns a new instance of BuiltinSet.



804
805
806
807
808
# File 'lib/vagrant/bundler.rb', line 804

def initialize
  super
  @remote = false
  @specs = []
end

Instance Method Details

#add_builtin_spec(spec) ⇒ Object



810
811
812
# File 'lib/vagrant/bundler.rb', line 810

def add_builtin_spec(spec)
  @specs.push(spec).uniq!
end

#find_all(req) ⇒ Object



814
815
816
817
818
819
820
821
# File 'lib/vagrant/bundler.rb', line 814

def find_all(req)
  @specs.select do |spec|
    allow_prerelease = spec.name == "vagrant-unbundled" && Vagrant.prerelease?
    req.match?(spec, allow_prerelease)
  end.map do |spec|
    Gem::Resolver::InstalledSpecification.new(self, spec)
  end
end