class Vagrant::Bundler::BuiltinSet

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.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/vagrant/bundler.rb, line 836
def initialize
  super
  @remote = false
  @specs = []
end

Public Instance Methods

add_builtin_spec(spec) click to toggle source
# File lib/vagrant/bundler.rb, line 842
def add_builtin_spec(spec)
  @specs.push(spec).uniq!
end
find_all(req) click to toggle source
# File lib/vagrant/bundler.rb, line 846
def find_all(req)
  r = @specs.select do |spec|
    # When matching requests against builtin specs, we _always_ enable
    # prerelease matching since any prerelease that's found in this
    # set has been added explicitly and should be available for all
    # plugins to resolve against. This includes Vagrant itself since
    # it is considered a prerelease when in development mode
    req.match?(spec, true)
  end.map do |spec|
    Gem::Resolver::InstalledSpecification.new(self, spec)
  end
  # If any of the results are a prerelease, we need to mark the request
  # to allow prereleases so the solution can be properly fulfilled
  if r.any? { |x| x.version.prerelease? }
    req.dependency.prerelease = true
  end
  r
end