Closed leikind closed 11 years ago
I could reproduce this using the latest bundler (1.1.3) and ruby 1.9.3.
Steps to reproduce:
mkdir -p /tmp/bviz-test
cd /tmp/bviz-test/
rvm use ruby-1.9.3-p0@bviz-test --create
gem install bundler && gem install ruby-graphviz
bundle init
echo "gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'" >> Gemfile
bundle install
bundle viz
I believe the problem has something to do with that bundler isn't fully initialized when the specs are loaded. rubygems' dependency calls #to_specs, which calls Gem::Specification.all - this differs depending on whether Bundler.require was called or not:
lars@mbp-4:/tmp/bviz-test$ ruby -e 'puts Gem::Specification.all.inspect'
NOTE: Specification.all called from -e:1:in `<main>'
[#<Gem::Specification name=bundler version=1.1.3>, #<Gem::Specification name=rake version=0.9.2.2>, #<Gem::Specification name=ruby-graphviz version=1.0.5>]
lars@mbp-4:/tmp/bviz-test$ bundle exec 'ruby -e "puts Gem::Specification.all.inspect"'
NOTE: Specification.all called from -e:1:in `<main>'
#<Bundler::SpecSet:0x000001008f9e30 @specs=[#<Gem::Specification name=annotate version=2.4.1.beta1>, #<Gem::Specification name=bundler version=1.1.3>], @sorted=[#<Gem::Specification name=annotate version=2.4.1.beta1>, #<Gem::Specification name=bundler version=1.1.3>]>
In the first case bundler is not active, and thus the activate gem cannot be found, since it is installed as a git repo. In the second case, bundler is active and annotate is found.
I think the fix would be to add a 'Bundler.require' in the 'viz' command before calling 'Graph' . However then rubygems-graphviz needs to be in the Gemfile or somehow injected into the dependencies - I couldn't make that work yet, though.
I experienced the same issue with a vendored gem and bundler 1.1.5 with ruby 1.9.3. It would be great to fix this issue.
I have tested viz with git and path gems in Bundler 1.3.4 and it is working now, so I'm closing this as fixed. Thanks for the feedback!
With the following lines in Gemfile:
bundle viz throws an exception:
If I remove the line with 'wice_grid' and leave gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git', here is the exception:
Works well without these two lines
Gemfile.lock:
Gemfile: