aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2013-04-09 16:49:01 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2013-04-09 16:49:24 -0700
commit9039c5038823754f79e04f1e83723e46229dbe05 (patch)
tree4618828975c67bfca749f749faeaffac76152697 /railties
parent74be6bba9e2c4c85bd80509857129d3177d41bee (diff)
downloadrails-9039c5038823754f79e04f1e83723e46229dbe05.tar.gz
rails-9039c5038823754f79e04f1e83723e46229dbe05.tar.bz2
rails-9039c5038823754f79e04f1e83723e46229dbe05.zip
Explain how to upgrade bin/ for Rails 4
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/app_rails_loader.rb37
1 files changed, 29 insertions, 8 deletions
diff --git a/railties/lib/rails/app_rails_loader.rb b/railties/lib/rails/app_rails_loader.rb
index c64d1b2552..1c64f2dcc6 100644
--- a/railties/lib/rails/app_rails_loader.rb
+++ b/railties/lib/rails/app_rails_loader.rb
@@ -12,22 +12,43 @@ module Rails
exe ||= find_executable_in_parent_path
return unless exe
- if File.read(exe) =~ /(APP|ENGINE)_PATH/
- # This is a Rails-generated binstub, let's use it
+ contents = File.read(exe)
+
+ # This is the Rails executable, let's use it
+ if contents =~ /(APP|ENGINE)_PATH/
exec RUBY, exe, *ARGV if find_executable
Dir.chdir("..") do
# Recurse in a chdir block: if the search fails we want to be sure
# the application is generated in the original working directory.
exec_app_rails unless cwd == Dir.pwd
end
- elsif exe.match(%r(bin/rails$))
- # this is a Bundler binstub, so we load the app ourselves
+
+ # This is a Bundler binstub. Stop and explain how to upgrade.
+ elsif exe =~ /bin\/rails$/ && contents =~ /This file was generated by Bundler/
+ $stderr.puts <<-end_bin_upgrade_warning
+Looks like your app's ./bin/rails is a stub that was generated by Bundler.
+
+In Rails 4, your app's bin/ directory contains executables that are versioned
+like any other source code, rather than stubs that are generated on demand.
+
+Here's how to upgrade:
+
+ bundle config --delete bin # Turn off Bundler's stub generator
+ rake rails:update:bin # Use the new Rails 4 executables
+ git add bin # Add bin/ to source control
+
+You may need to remove bin/ from your .gitignore as well.
+
+When you install a gem whose executable you want to use in your app,
+generate it and add it to source control:
+
+ bundle binstubs some-gem-name
+ git add bin/new-executable
+
+ end_bin_upgrade_warning
+
Object.const_set(:APP_PATH, File.expand_path('config/application', Dir.pwd))
require File.expand_path('../boot', APP_PATH)
- puts "Rails 4 no longer supports Bundler's --binstubs option. You " \
- "will need to disable it and update your bin/rails file.\n" \
- "Please run: `bundle config --delete bin && rm -rf bin`, then " \
- "`rake rails:update:bin` and add the resulting bin/ to git."
require 'rails/commands'
end
rescue SystemCallError