Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bundler::GemInstaller to avoid exceptions on executable conflicts

(re-enabling Bundler 1.0.x compatibility on Rubygems 1.8.10)
  • Loading branch information...
commit da27033dc75274724c515f37d33767d7788fabb2 1 parent 5321940
@indirect indirect authored
View
1  lib/bundler.rb
@@ -20,6 +20,7 @@ module Bundler
autoload :Dsl, 'bundler/dsl'
autoload :Environment, 'bundler/environment'
autoload :GemHelper, 'bundler/gem_helper'
+ autoload :GemInstaller, 'bundler/gem_installer'
autoload :Graph, 'bundler/graph'
autoload :Index, 'bundler/index'
autoload :Installer, 'bundler/installer'
View
9 lib/bundler/gem_installer.rb
@@ -0,0 +1,9 @@
+require 'rubygems/installer'
+
+module Bundler
+ class GemInstaller < Gem::Installer
+ def check_executable_overwrite(filename)
+ # Bundler needs to install gems regardless of binstub overwriting
+ end
+ end
+end
View
2  lib/bundler/source.rb
@@ -97,7 +97,7 @@ def install(spec)
:env_shebang => true }
options.merge!(:bin_dir => "#{install_path}/bin") unless spec.executables.nil? || spec.executables.empty?
- installer = Gem::Installer.new path, options
+ installer = Bundler::GemInstaller.new path, options
installer.install
end

4 comments on commit da27033

@jeremy
Collaborator

Nice! Worthy of a --pre release? (Rails 3.1 stable release can't be bundled on latest RubyGems + Bundler currently)

@indirect
Owner
@jeremy
Collaborator

Looks like the Installer used for binstubs needs the same override: https://github.com/carlhuda/bundler/blob/master/lib/bundler/source.rb#L364

Using railties (3.1.0) from git://github.com/rails/rails.git (at 3-1-stable) 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. Thanks!
/Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:161:in `check_executable_overwrite': "rails" from railties conflicts with installed executable from rails (Gem::InstallError)
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:356:in `block in generate_bin'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:344:in `each'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:344:in `generate_bin'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/source.rb:380:in `generate_bin'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/source.rb:438:in `generate_bin'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/source.rb:556:in `install'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/installer.rb:64:in `block (2 levels) in run'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/rubygems_integration.rb:98:in `with_build_args'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/installer.rb:63:in `block in run'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/installer.rb:55:in `run'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/installer.rb:12:in `install'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/cli.rb:213:in `install'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.9/bin/bundle:13:in `'
    from ./bin/bundle:15:in `load'
    from ./bin/bundle:15:in `'
@jeremy
Collaborator

(or have Bundler::Source::Installer subclass Bundler::GemInstaller)

Please sign in to comment.
Something went wrong with that request. Please try again.