This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "spec_helper" | ||
|
||
describe "bundle viz", :if => Bundler.which("dot") do | ||
let(:graphviz_lib) do | ||
graphviz_glob = base_system_gems.join("gems/ruby-graphviz*/lib") | ||
Dir[graphviz_glob].first | ||
end | ||
|
||
it "graphs gems from the Gemfile" do | ||
install_gemfile <<-G | ||
source "file://#{gem_repo1}" | ||
gem "rack" | ||
gem "rack-obama" | ||
G | ||
|
||
bundle "viz", :env => {"RUBYOPT" => "-I #{graphviz_lib}"} | ||
expect(out).to include("gem_graph.png") | ||
end | ||
|
||
it "graphs gems that are prereleases" do | ||
update_repo(gem_repo1) do | ||
build_gem "rack", "1.3.pre" | ||
end | ||
|
||
install_gemfile <<-G | ||
source "file://#{gem_repo1}" | ||
gem "rack", "= 1.3.pre" | ||
gem "rack-obama" | ||
G | ||
|
||
bundle "viz", :env => {"RUBYOPT" => "-I #{graphviz_lib}"} | ||
expect(out).to include("gem_graph.png") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters