summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-06-10 08:22:01 +0000
committerBundlerbot <bot@bundler.io>2019-06-10 08:22:01 +0000
commitaa2a882a6e23f6fc58362a4337cca735cc2fb8da (patch)
tree337b2a0df24d90ea6748cfea0aac9fba834db778
parentac832fe4496e75ac69ce57b582f2c267502f0552 (diff)
parentd9d2bf6d522dd36d1ef2732e87cef8b7cba729fd (diff)
downloadbundler-aa2a882a6e23f6fc58362a4337cca735cc2fb8da.tar.gz
Merge #7193
7193: More `require_relative` r=deivid-rodriguez a=deivid-rodriguez This is a follow up to #7062 and #7100, migrating the last missing internal requires to use `require_relative`. I thought I had migrated everything already, but I had not. As a note, I'm migrating thor's code here. I will open a PR to upstream's thor to incorporate this changes, but thor is still stuck with 1.8 support, so we have to wait a bit. Given the very low activity thor has, it's fine to make the changes here first, and wait until we can incorporate them upstream. ### What was the end-user problem that led to this PR? The problem was that sometimes we can end up requiring the default version of bundler, instead of the current copy that's being run, and that's dangerous and can cause version mismatch issues. ### What is your fix for the problem, implemented in this PR? My fix is to always use `require_relative` for internal requires. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rwxr-xr-xexe/bundle6
-rw-r--r--lib/bundler.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions.rb14
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/create_file.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/create_link.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/directory.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/base.rb18
-rw-r--r--lib/bundler/vendor/thor/lib/thor/group.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/line_editor.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser.rb8
-rw-r--r--lib/bundler/vendor/thor/lib/thor/runner.rb8
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/color.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/html.rb2
-rw-r--r--lib/bundler/vendored_thor.rb2
16 files changed, 39 insertions, 39 deletions
diff --git a/exe/bundle b/exe/bundle
index aaf773745d..fccece038b 100755
--- a/exe/bundle
+++ b/exe/bundle
@@ -7,7 +7,7 @@ Signal.trap("INT") do
exit 1
end
-require "bundler"
+require_relative "../lib/bundler"
# 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 +18,9 @@ $LOAD_PATH.each do |path|
abort(err)
end
-require "bundler/friendly_errors"
+require_relative "../lib/bundler/friendly_errors"
Bundler.with_friendly_errors do
- require "bundler/cli"
+ require_relative "../lib/bundler/cli"
# Allow any command to use --help flag to show help for that command
help_flags = %w[--help -h]
diff --git a/lib/bundler.rb b/lib/bundler.rb
index d8f9462c6d..735750f59d 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -564,7 +564,7 @@ EOF
private
def eval_yaml_gemspec(path, contents)
- Kernel.send(:require, "bundler/psyched_yaml")
+ require_relative "bundler/psyched_yaml"
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
diff --git a/lib/bundler/vendor/thor/lib/thor.rb b/lib/bundler/vendor/thor/lib/thor.rb
index 999e8b7e61..6017ee9ad8 100644
--- a/lib/bundler/vendor/thor/lib/thor.rb
+++ b/lib/bundler/vendor/thor/lib/thor.rb
@@ -1,5 +1,5 @@
require "set"
-require "bundler/vendor/thor/lib/thor/base"
+require_relative "thor/base"
class Bundler::Thor
class << self
diff --git a/lib/bundler/vendor/thor/lib/thor/actions.rb b/lib/bundler/vendor/thor/lib/thor/actions.rb
index b06feac2a0..5681d5a7c6 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions.rb
@@ -1,11 +1,11 @@
require "uri"
-require "bundler/vendor/thor/lib/thor/core_ext/io_binary_read"
-require "bundler/vendor/thor/lib/thor/actions/create_file"
-require "bundler/vendor/thor/lib/thor/actions/create_link"
-require "bundler/vendor/thor/lib/thor/actions/directory"
-require "bundler/vendor/thor/lib/thor/actions/empty_directory"
-require "bundler/vendor/thor/lib/thor/actions/file_manipulation"
-require "bundler/vendor/thor/lib/thor/actions/inject_into_file"
+require_relative "core_ext/io_binary_read"
+require_relative "actions/create_file"
+require_relative "actions/create_link"
+require_relative "actions/directory"
+require_relative "actions/empty_directory"
+require_relative "actions/file_manipulation"
+require_relative "actions/inject_into_file"
class Bundler::Thor
module Actions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb b/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb
index 97d22d9bbd..330fc08cae 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/actions/empty_directory"
+require_relative "empty_directory"
class Bundler::Thor
module Actions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb b/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
index 3a664401b4..70504a2c1f 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/actions/create_file"
+require_relative "create_file"
class Bundler::Thor
module Actions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/directory.rb b/lib/bundler/vendor/thor/lib/thor/actions/directory.rb
index f555f7b7e0..03c97bf630 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/directory.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/directory.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/actions/empty_directory"
+require_relative "empty_directory"
class Bundler::Thor
module Actions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb b/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
index 349b26ff65..cf651a4e78 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/actions/empty_directory"
+require_relative "empty_directory"
class Bundler::Thor
module Actions
diff --git a/lib/bundler/vendor/thor/lib/thor/base.rb b/lib/bundler/vendor/thor/lib/thor/base.rb
index f55b14fbfc..7d7cd3b5fe 100644
--- a/lib/bundler/vendor/thor/lib/thor/base.rb
+++ b/lib/bundler/vendor/thor/lib/thor/base.rb
@@ -1,12 +1,12 @@
-require "bundler/vendor/thor/lib/thor/command"
-require "bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access"
-require "bundler/vendor/thor/lib/thor/core_ext/ordered_hash"
-require "bundler/vendor/thor/lib/thor/error"
-require "bundler/vendor/thor/lib/thor/invocation"
-require "bundler/vendor/thor/lib/thor/parser"
-require "bundler/vendor/thor/lib/thor/shell"
-require "bundler/vendor/thor/lib/thor/line_editor"
-require "bundler/vendor/thor/lib/thor/util"
+require_relative "command"
+require_relative "core_ext/hash_with_indifferent_access"
+require_relative "core_ext/ordered_hash"
+require_relative "error"
+require_relative "invocation"
+require_relative "parser"
+require_relative "shell"
+require_relative "line_editor"
+require_relative "util"
class Bundler::Thor
autoload :Actions, File.expand_path("actions", __dir__)
diff --git a/lib/bundler/vendor/thor/lib/thor/group.rb b/lib/bundler/vendor/thor/lib/thor/group.rb
index 30db46529e..7861d05345 100644
--- a/lib/bundler/vendor/thor/lib/thor/group.rb
+++ b/lib/bundler/vendor/thor/lib/thor/group.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/base"
+require_relative "base"
# Bundler::Thor has a special class called Bundler::Thor::Group. The main difference to Bundler::Thor class
# is that it invokes all commands at once. It also include some methods that allows
diff --git a/lib/bundler/vendor/thor/lib/thor/line_editor.rb b/lib/bundler/vendor/thor/lib/thor/line_editor.rb
index ce81a17484..5c0c336e7a 100644
--- a/lib/bundler/vendor/thor/lib/thor/line_editor.rb
+++ b/lib/bundler/vendor/thor/lib/thor/line_editor.rb
@@ -1,5 +1,5 @@
-require "bundler/vendor/thor/lib/thor/line_editor/basic"
-require "bundler/vendor/thor/lib/thor/line_editor/readline"
+require_relative "line_editor/basic"
+require_relative "line_editor/readline"
class Bundler::Thor
module LineEditor
diff --git a/lib/bundler/vendor/thor/lib/thor/parser.rb b/lib/bundler/vendor/thor/lib/thor/parser.rb
index 08f80e565d..45394732ca 100644
--- a/lib/bundler/vendor/thor/lib/thor/parser.rb
+++ b/lib/bundler/vendor/thor/lib/thor/parser.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/parser/argument"
-require "bundler/vendor/thor/lib/thor/parser/arguments"
-require "bundler/vendor/thor/lib/thor/parser/option"
-require "bundler/vendor/thor/lib/thor/parser/options"
+require_relative "parser/argument"
+require_relative "parser/arguments"
+require_relative "parser/option"
+require_relative "parser/options"
diff --git a/lib/bundler/vendor/thor/lib/thor/runner.rb b/lib/bundler/vendor/thor/lib/thor/runner.rb
index 65ae422d7f..ed44853a00 100644
--- a/lib/bundler/vendor/thor/lib/thor/runner.rb
+++ b/lib/bundler/vendor/thor/lib/thor/runner.rb
@@ -1,6 +1,6 @@
-require "bundler/vendor/thor/lib/thor"
-require "bundler/vendor/thor/lib/thor/group"
-require "bundler/vendor/thor/lib/thor/core_ext/io_binary_read"
+require_relative "../thor"
+require_relative "group"
+require_relative "core_ext/io_binary_read"
require "yaml"
require "digest/md5"
@@ -111,7 +111,7 @@ class Bundler::Thor::Runner < Bundler::Thor #:nodoc: # rubocop:disable ClassLeng
desc "version", "Show Bundler::Thor version"
def version
- require "bundler/vendor/thor/lib/thor/version"
+ require_relative "version"
say "Bundler::Thor #{Bundler::Thor::VERSION}"
end
diff --git a/lib/bundler/vendor/thor/lib/thor/shell/color.rb b/lib/bundler/vendor/thor/lib/thor/shell/color.rb
index da289cb50c..6c821d4a09 100644
--- a/lib/bundler/vendor/thor/lib/thor/shell/color.rb
+++ b/lib/bundler/vendor/thor/lib/thor/shell/color.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/shell/basic"
+require_relative "basic"
class Bundler::Thor
module Shell
diff --git a/lib/bundler/vendor/thor/lib/thor/shell/html.rb b/lib/bundler/vendor/thor/lib/thor/shell/html.rb
index 83d2054988..55262f19cc 100644
--- a/lib/bundler/vendor/thor/lib/thor/shell/html.rb
+++ b/lib/bundler/vendor/thor/lib/thor/shell/html.rb
@@ -1,4 +1,4 @@
-require "bundler/vendor/thor/lib/thor/shell/basic"
+require_relative "basic"
class Bundler::Thor
module Shell
diff --git a/lib/bundler/vendored_thor.rb b/lib/bundler/vendored_thor.rb
index b0b7e7be84..0666cfc9b9 100644
--- a/lib/bundler/vendored_thor.rb
+++ b/lib/bundler/vendored_thor.rb
@@ -2,7 +2,7 @@
module Bundler
def self.require_thor_actions
- Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
+ require_relative "vendor/thor/lib/thor/actions"
end
end
require_relative "vendor/thor/lib/thor"