Class: Vagrant::Bundler::BuiltinSet
- Inherits:
-
Gem::Resolver::Set
- Object
- Gem::Resolver::Set
- Vagrant::Bundler::BuiltinSet
- 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
- #add_builtin_spec(spec) ⇒ Object
- #find_all(req) ⇒ Object
-
#initialize ⇒ BuiltinSet
constructor
A new instance of BuiltinSet.
Constructor Details
#initialize ⇒ BuiltinSet
Returns a new instance of BuiltinSet.
849 850 851 852 853 |
# File 'lib/vagrant/bundler.rb', line 849 def initialize super @remote = false @specs = [] end |
Instance Method Details
#add_builtin_spec(spec) ⇒ Object
855 856 857 |
# File 'lib/vagrant/bundler.rb', line 855 def add_builtin_spec(spec) @specs.push(spec).uniq! end |
#find_all(req) ⇒ Object
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
# File 'lib/vagrant/bundler.rb', line 859 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 |