aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Rakefile4
-rw-r--r--lib/bundler/graph.rb3
-rw-r--r--spec/commands/viz_spec.rb34
-rw-r--r--spec/support/rubygems_ext.rb4
4 files changed, 43 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index fd3bfdd9..ba098941 100644
--- a/Rakefile
+++ b/Rakefile
@@ -114,8 +114,10 @@ namespace :spec do
system "sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd"
# Strip secure_path so that RVM paths transmit through sudo -E
system "sudo sed -i '/secure_path/d' /etc/sudoers"
- # Install groff for the ronn gem
+ # Install groff so ronn can generate man/help pages
sh "sudo apt-get install groff -y"
+ # Install graphviz so that the viz specs can run
+ sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
if RUBY_VERSION < '1.9'
# Downgrade Rubygems on 1.8 so Ronn can be required
# https://github.com/rubygems/rubygems/issues/784
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index 0b5c5723..fbb5bd02 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
diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb
new file mode 100644
index 00000000..8039b055
--- /dev/null
+++ b/spec/commands/viz_spec.rb
@@ -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
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 6d71d32e..3426deff 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -12,7 +12,7 @@ module Spec
unless File.exist?("#{Path.base_system_gems}")
FileUtils.mkdir_p(Path.base_system_gems)
- puts "fetching fakeweb, artifice, sinatra, rake, rack, and builder for the tests to use..."
+ puts "installing gems for the tests to use..."
`gem install fakeweb artifice --no-rdoc --no-ri`
`gem install sinatra --version 1.2.7 --no-rdoc --no-ri`
# Rake version has to be consistent for tests to pass
@@ -20,6 +20,8 @@ module Spec
# 3.0.0 breaks 1.9.2 specs
`gem install builder --version 2.1.2 --no-rdoc --no-ri`
`gem install rack --no-rdoc --no-ri`
+ # ruby-graphviz is used by the viz tests
+ `gem install ruby-graphviz --no-rdoc --no-ri`
end
ENV['HOME'] = Path.home.to_s