summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-16 17:45:00 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-17 13:39:42 +0200
commitd366cbfe5d9b7559399284bc913d24116e37ce40 (patch)
tree071fee5848c67942c35d4fc803215b8d6cd5bdf5
parent6b0dc20bcec10d26a1105765de068e115b33a45e (diff)
downloadbundler-d366cbfe5d9b7559399284bc913d24116e37ce40.tar.gz
No need to activate the `fileutils` default gem
The version we're vendoring actually relaxed this restriction back to 2.3.0+, so we can always use the vendored version.
-rw-r--r--lib/bundler/vendored_fileutils.rb7
-rw-r--r--spec/bundler/bundler_spec.rb2
-rw-r--r--spec/bundler/settings_spec.rb4
-rw-r--r--spec/support/helpers.rb8
4 files changed, 4 insertions, 17 deletions
diff --git a/lib/bundler/vendored_fileutils.rb b/lib/bundler/vendored_fileutils.rb
index 4b71759224..1be1138ce2 100644
--- a/lib/bundler/vendored_fileutils.rb
+++ b/lib/bundler/vendored_fileutils.rb
@@ -1,9 +1,4 @@
# frozen_string_literal: true
module Bundler; end
-if RUBY_VERSION >= "2.4"
- require_relative "vendor/fileutils/lib/fileutils"
-else
- # the version we vendor is 2.4+
- require "fileutils"
-end
+require_relative "vendor/fileutils/lib/fileutils"
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index 8a4ce729ed..3cae67c52a 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -176,7 +176,7 @@ RSpec.describe Bundler do
let(:bundler_ui) { Bundler.ui }
it "should raise a friendly error" do
allow(File).to receive(:exist?).and_return(true)
- allow(bundler_fileutils).to receive(:remove_entry_secure).and_raise(ArgumentError)
+ allow(::Bundler::FileUtils).to receive(:remove_entry_secure).and_raise(ArgumentError)
allow(File).to receive(:world_writable?).and_return(true)
message = <<EOF
It is a security vulnerability to allow your home directory to be world-writable, and bundler can not continue.
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index 339428eb48..7e1dadded7 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -120,7 +120,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
context "when it's not possible to write to the file" do
it "raises an PermissionError with explanation" do
- expect(bundler_fileutils).to receive(:mkdir_p).with(settings.send(:local_config_file).dirname).
+ expect(::Bundler::FileUtils).to receive(:mkdir_p).with(settings.send(:local_config_file).dirname).
and_raise(Errno::EACCES)
expect { settings.set_local :frozen, "1" }.
to raise_error(Bundler::PermissionError, /config/)
@@ -161,7 +161,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
describe "#set_global" do
context "when it's not possible to write to the file" do
it "raises an PermissionError with explanation" do
- expect(bundler_fileutils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname).
+ expect(::Bundler::FileUtils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname).
and_raise(Errno::EACCES)
expect { settings.set_global(:frozen, "1") }.
to raise_error(Bundler::PermissionError, %r{\.bundle/config})
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index f069911f65..0c05789946 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -593,13 +593,5 @@ module Spec
end
port
end
-
- def bundler_fileutils
- if RUBY_VERSION >= "2.4"
- ::Bundler::FileUtils
- else
- ::FileUtils
- end
- end
end
end