diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-12-04 17:22:53 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-12-05 18:18:54 +0900 |
commit | 1843abdf2e29af98fba94c3ae552277bdcc910e2 (patch) | |
tree | a21392195368adc282e99979631554558f6180fd /lib/bundler/templates | |
parent | 030a9c592dd706cfe83f24a7ea1b7187d735e8ca (diff) | |
download | bundler-1843abdf2e29af98fba94c3ae552277bdcc910e2.tar.gz |
Show warning message about binstub outside generation.
Fixes #6149.
Diffstat (limited to 'lib/bundler/templates')
-rwxr-xr-x | lib/bundler/templates/Executable | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable index 4e35e586db..6a022c2506 100755 --- a/lib/bundler/templates/Executable +++ b/lib/bundler/templates/Executable @@ -12,8 +12,15 @@ require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>", Pathname.new(__FILE__).realpath) +def bundle_stub?(path) + return false unless File.file?(path) + return true if File.read(path, 150) =~ /This file was generated by Bundler/ + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") +end + bundle_binstub = File.expand_path("../bundle", __FILE__) -load(bundle_binstub) if File.file?(bundle_binstub) +load(bundle_binstub) if bundle_stub?(bundle_binstub) require "rubygems" require "bundler/setup" |