Skip to content

Commit 437896e

Browse files
Deobfuscate Rake version error in generated plugin
If the plugin or one of its dependencies requires a version of Rake that is different than the version executing the Rakefile, `require 'bundler/setup'` will raise a LoadError with a helpful error message like: "You have already activated rake 13.0.1, but your Gemfile requires rake 12.3.3. Prepending `bundle exec` to your command may solve this." If that LoadError is swallowed, another LoadError will eventually be raised with a less helpful / more confusing error message like: "cannot load such file -- rake".
1 parent db60199 commit 437896e

File tree

1 file changed

+1
-5
lines changed
  • railties/lib/rails/generators/rails/plugin/templates

1 file changed

+1
-5
lines changed

railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
begin
2-
require 'bundler/setup'
3-
rescue LoadError
4-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5-
end
1+
require 'bundler/setup'
62

73
require 'rdoc/task'
84

0 commit comments

Comments
 (0)