rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 2k forks source link

bundle viz doesn't work with :path => 'vendor/name' and :git => ''repo" #1762

Closed leikind closed 11 years ago

leikind commented 12 years ago

With the following lines in Gemfile:

gem "wice_grid",  '3.2.0.pre1', :path => 'vendor/wice_grid'
group :development do
  gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
end

bundle viz throws an exception:

Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
/Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find wice_grid (= 3.2.0.pre1) amongst [actionmailer-3.2.2, actionpack-3.2.2, activemodel-3.2.2, activerecord-3.2.2, activeresource-3.2.2, activesupport-3.2.2, arel-3.0.2, bcrypt-ruby-3.0.1, bigdecimal-1.1.0, bootstrap-sass-2.0.1, builder-3.0.0, bundler-1.1.1, bundler-1.1.0, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.2.0, daemons-1.1.8, devise-2.0.4, diff-lcs-1.1.3, erubis-2.7.0, eventmachine-0.12.10, execjs-1.3.0, factory_girl-2.6.3, factory_girl_rails-1.7.0, haml-3.1.4, hike-1.2.1, i18n-0.6.0, io-console-0.3, journey-1.0.3, jquery-rails-2.0.1, json-1.6.5, json-1.5.4, libv8-3.3.10.4-x86_64-darwin-11, mail-2.4.3, mime-types-1.17.2, minitest-2.5.1, multi_json-1.1.0, mysql2-0.3.11, orm_adapter-0.0.6, polyglot-0.3.3, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.2.2, railties-3.2.2, rake-0.9.2.2, rdoc-3.12, rdoc-3.9.4, rspec-2.8.0, rspec-core-2.8.0, rspec-expectations-2.8.0, rspec-mocks-2.8.0, rspec-rails-2.8.1, ruby-graphviz-1.0.5, sass-3.1.15, sass-rails-3.2.4, shoulda-matchers-1.0.0, sprockets-2.1.2, therubyracer-0.9.10, thin-1.3.1, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.32, uglifier-1.2.3, warden-1.1.1, will_paginate-3.0.3] (Gem::LoadError)
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:38:in `block in _populate_relations'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `block in each'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `each_key'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `each'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:37:in `_populate_relations'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:18:in `initialize'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/cli.rb:519:in `new'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/cli.rb:519:in `viz'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/bin/bundle:13:in `<top (required)>'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/bin/bundle:19:in `load'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/bin/bundle:19:in `<main>'

If I remove the line with 'wice_grid' and leave gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git', here is the exception:

Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
/Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find annotate (>= 0) amongst [actionmailer-3.2.2, actionpack-3.2.2, activemodel-3.2.2, activerecord-3.2.2, activeresource-3.2.2, activesupport-3.2.2, arel-3.0.2, bcrypt-ruby-3.0.1, bigdecimal-1.1.0, bootstrap-sass-2.0.1, builder-3.0.0, bundler-1.1.1, bundler-1.1.0, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.2.0, daemons-1.1.8, devise-2.0.4, diff-lcs-1.1.3, erubis-2.7.0, eventmachine-0.12.10, execjs-1.3.0, factory_girl-2.6.3, factory_girl_rails-1.7.0, haml-3.1.4, hike-1.2.1, i18n-0.6.0, io-console-0.3, journey-1.0.3, jquery-rails-2.0.1, json-1.6.5, json-1.5.4, libv8-3.3.10.4-x86_64-darwin-11, mail-2.4.3, mime-types-1.17.2, minitest-2.5.1, multi_json-1.1.0, mysql2-0.3.11, orm_adapter-0.0.6, polyglot-0.3.3, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.2.2, railties-3.2.2, rake-0.9.2.2, rdoc-3.12, rdoc-3.9.4, rspec-2.8.0, rspec-core-2.8.0, rspec-expectations-2.8.0, rspec-mocks-2.8.0, rspec-rails-2.8.1, ruby-graphviz-1.0.5, sass-3.1.15, sass-rails-3.2.4, shoulda-matchers-1.0.0, sprockets-2.1.2, therubyracer-0.9.10, thin-1.3.1, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.32, uglifier-1.2.3, warden-1.1.1, will_paginate-3.0.3] (Gem::LoadError)
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:38:in `block in _populate_relations'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `block in each'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `each_key'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/set.rb:222:in `each'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:37:in `_populate_relations'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/graph.rb:18:in `initialize'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/cli.rb:519:in `new'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/cli.rb:519:in `viz'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.1/bin/bundle:13:in `<top (required)>'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/bin/bundle:19:in `load'
    from /Users/leikind/.rbenv/versions/1.9.3-p125/bin/bundle:19:in `<main>'

Works well without these two lines

Gemfile.lock:

GIT
  remote: git://github.com/ctran/annotate_models.git
  revision: a43c08f0eb4d69a48c6830630ebb60e35ccb2d2d
  specs:
    annotate (2.4.1.beta1)

PATH
  remote: vendor/wice_grid
  specs:
    wice_grid (3.2.0.pre1)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.2)
      actionpack (= 3.2.2)
      mail (~> 2.4.0)
    actionpack (3.2.2)
      activemodel (= 3.2.2)
      activesupport (= 3.2.2)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.1)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.2)
      activesupport (= 3.2.2)
      builder (~> 3.0.0)
    activerecord (3.2.2)
      activemodel (= 3.2.2)
      activesupport (= 3.2.2)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.2)
      activemodel (= 3.2.2)
      activesupport (= 3.2.2)
    activesupport (3.2.2)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    arel (3.0.2)
    bcrypt-ruby (3.0.1)
    bootstrap-sass (2.0.1)
    builder (3.0.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.2.0)
    daemons (1.1.8)
    devise (2.0.4)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.3)
      railties (~> 3.1)
      warden (~> 1.1.1)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (0.12.10)
    execjs (1.3.0)
      multi_json (~> 1.0)
    factory_girl (2.6.3)
      activesupport (>= 2.3.9)
    factory_girl_rails (1.7.0)
      factory_girl (~> 2.6.0)
      railties (>= 3.0.0)
    haml (3.1.4)
    hike (1.2.1)
    i18n (0.6.0)
    journey (1.0.3)
    jquery-rails (2.0.1)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.6.5)
    libv8 (3.3.10.4)
    mail (2.4.3)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.17.2)
    multi_json (1.1.0)
    mysql2 (0.3.11)
    orm_adapter (0.0.6)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.2)
      actionmailer (= 3.2.2)
      actionpack (= 3.2.2)
      activerecord (= 3.2.2)
      activeresource (= 3.2.2)
      activesupport (= 3.2.2)
      bundler (~> 1.0)
      railties (= 3.2.2)
    railties (3.2.2)
      actionpack (= 3.2.2)
      activesupport (= 3.2.2)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    rspec (2.8.0)
      rspec-core (~> 2.8.0)
      rspec-expectations (~> 2.8.0)
      rspec-mocks (~> 2.8.0)
    rspec-core (2.8.0)
    rspec-expectations (2.8.0)
      diff-lcs (~> 1.1.2)
    rspec-mocks (2.8.0)
    rspec-rails (2.8.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.8.0)
    sass (3.1.15)
    sass-rails (3.2.4)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    shoulda-matchers (1.0.0)
    sprockets (2.1.2)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    therubyracer (0.9.10)
      libv8 (~> 3.3.10)
    thin (1.3.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.32)
    uglifier (1.2.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    warden (1.1.1)
      rack (>= 1.0)
    will_paginate (3.0.3)

PLATFORMS
  ruby

DEPENDENCIES
  annotate!
  bootstrap-sass (~> 2.0.0)
  coffee-rails (~> 3.2.1)
  devise
  factory_girl_rails (~> 1.2)
  haml
  jquery-rails
  mysql2
  rails (= 3.2.2)
  rspec-rails (~> 2.6)
  sass-rails (~> 3.2.3)
  shoulda-matchers
  therubyracer
  thin
  uglifier (>= 1.0.3)
  wice_grid (= 3.2.0.pre1)!
  will_paginate (= 3.0.3)

Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.2'

gem 'mysql2'
gem 'haml'
gem 'devise'

gem 'will_paginate', '3.0.3'
gem "wice_grid",  '3.2.0.pre1', :path => 'vendor/wice_grid'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

group :development do
  gem 'thin'
  gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
end

group :test, :development do
  gem "rspec-rails", "~> 2.6"
  gem "factory_girl_rails", "~> 1.2"
end

group :test do
  gem 'shoulda-matchers'
end

gem 'jquery-rails'
gem 'bootstrap-sass', '~> 2.0.0'
lhm commented 12 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.

hlubek commented 12 years ago

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.

indirect commented 11 years ago

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!