summaryrefslogtreecommitdiff
path: root/lib/bundler/templates
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-12-05 18:28:52 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-12-05 18:53:42 +0900
commite7243396706e9c29de25638351e7d30027313d59 (patch)
tree909913cdcf2de365043484eadb45dab621a29b00 /lib/bundler/templates
parent1843abdf2e29af98fba94c3ae552277bdcc910e2 (diff)
downloadbundler-e7243396706e9c29de25638351e7d30027313d59.tar.gz
expand toplevel method definition about stub file detection
Diffstat (limited to 'lib/bundler/templates')
-rwxr-xr-xlib/bundler/templates/Executable13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable
index 6a022c2506..414a75898d 100755
--- a/lib/bundler/templates/Executable
+++ b/lib/bundler/templates/Executable
@@ -12,16 +12,17 @@ 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/
+bundle_binstub = File.expand_path("../bundle", __FILE__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
+ load(bundle_binstub)
+ else
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
end
-bundle_binstub = File.expand_path("../bundle", __FILE__)
-load(bundle_binstub) if bundle_stub?(bundle_binstub)
-
require "rubygems"
require "bundler/setup"