summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-02 14:08:28 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-17 13:35:54 +0200
commite4cbb91b7df00d497870b6741ce72e8a393a2185 (patch)
tree79a0a96383829fad8dd4c85f78a39837f28b55ae
parentfb587b9ebbcf82cb0a65bb333236ca09103a89b9 (diff)
downloadbundler-e4cbb91b7df00d497870b6741ce72e8a393a2185.tar.gz
Require relatively from exe/ when possible
-rwxr-xr-xexe/bundle22
1 files changed, 19 insertions, 3 deletions
diff --git a/exe/bundle b/exe/bundle
index aaf773745d..b3b1b691d8 100755
--- a/exe/bundle
+++ b/exe/bundle
@@ -7,7 +7,14 @@ Signal.trap("INT") do
exit 1
end
-require "bundler"
+base_path = File.expand_path("../lib", __dir__)
+
+if File.exist?(base_path)
+ require_relative "../lib/bundler"
+else
+ require "bundler"
+end
+
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
@@ -18,9 +25,18 @@ $LOAD_PATH.each do |path|
abort(err)
end
-require "bundler/friendly_errors"
+if File.exist?(base_path)
+ require_relative "../lib/bundler/friendly_errors"
+else
+ require "bundler/friendly_errors"
+end
+
Bundler.with_friendly_errors do
- require "bundler/cli"
+ if File.exist?(base_path)
+ require_relative "../lib/bundler/cli"
+ else
+ require "bundler/cli"
+ end
# Allow any command to use --help flag to show help for that command
help_flags = %w[--help -h]