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.



592
593
594
595
596
# File 'lib/vagrant/bundler.rb', line 592

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

Instance Method Details

#add_builtin_spec(spec) ⇒ Object



598
599
600
# File 'lib/vagrant/bundler.rb', line 598

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

#find_all(req) ⇒ Object



602
603
604
605
606
607
608
609
# File 'lib/vagrant/bundler.rb', line 602

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