Browse files

setup Bundler in engines `bin/rails` stub.

This is necessary when bundling gems locally using `BUNDLE_PATH`.
Without this patch `bin/rails` fails with:

/Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rails/all (LoadError)
	from /Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from bin/rails:7:in `<main>'
  • Loading branch information...
1 parent e95031f commit 755fd79ff36fad1e41d93e6e49c3f5e486f6745a @senny senny committed Jan 13, 2014
Showing with 4 additions and 0 deletions.
  1. +4 −0 railties/lib/rails/generators/rails/plugin/templates/bin/
@@ -3,5 +3,9 @@
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/<%= name -%>/engine', __FILE__)
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'rails/all'
require 'rails/engine/commands'

0 comments on commit 755fd79

Please sign in to comment.