diff options
author | Adam Prescott <adam@aprescott.com> | 2015-05-07 16:51:45 -0400 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-05-11 18:57:44 -0700 |
commit | e3e9f4add3ab25776c43816b916543995db8fb4e (patch) | |
tree | cac30b1aa3bde1f48fd5c0b24c3cf59c989ee2ac /lib | |
parent | 62987f84dc6d34c94956a5f4a54338abcf240e8f (diff) | |
download | bundler-e3e9f4add3ab25776c43816b916543995db8fb4e.tar.gz |
Allow bundle viz to work with dependencies satisfied by prereleases.
Suppose a Gemfile specifies a dependency, `foo`:
foo
Let's say `foo` requires a certain `bar`:
foo
bar (>= 0.5)
If this dependency happens to be satisfied by a prerelease `bar`, e.g.,
0.6.pre, then `bundle viz` will error.
The cause of this error is that `Bundler::Graph#_populate_relations`
executes
child_dependencies = dependency.to_spec.runtime_dependencies.to_set
and if `dependency` (here, `bar`), is a prerelease, then
`dependency.to_spec` will be `nil` on Rubygems 2.4.0 and higher because
of changes to `#to_spec`.
By forcing `dependency.prerelease = true`, then `to_spec` won't ignore
the prerelease `bar` dependency, which prevents `dependency.to_spec` to
from being `nil`.
This should address GitHub issues 3621 and 3217.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/graph.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 0b5c5723b4..fbb5bd0248 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -36,6 +36,9 @@ module Bundler else tmp = Set.new parent_dependencies.each do |dependency| + # if the dependency is a prerelease, allow to_spec to be non-nil + dependency.prerelease = true + child_dependencies = dependency.to_spec.runtime_dependencies.to_set @relations[dependency.name] += child_dependencies.map(&:name).to_set tmp += child_dependencies |