Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
No need to activate the fileutils default gem
Browse files Browse the repository at this point in the history
The version we're vendoring actually relaxed this restriction back to
2.3.0+, so we can always use the vendored version.
  • Loading branch information
deivid-rodriguez committed Aug 17, 2019
1 parent 856fd17 commit 97ddcb4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
7 changes: 1 addition & 6 deletions 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"
2 changes: 1 addition & 1 deletion spec/bundler/bundler_spec.rb
Expand Up @@ -176,7 +176,7 @@
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.
Expand Down
4 changes: 2 additions & 2 deletions spec/bundler/settings_spec.rb
Expand Up @@ -120,7 +120,7 @@

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/)
Expand Down Expand Up @@ -161,7 +161,7 @@
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})
Expand Down
8 changes: 0 additions & 8 deletions spec/support/helpers.rb
Expand Up @@ -593,13 +593,5 @@ def find_unused_port
end
port
end

def bundler_fileutils
if RUBY_VERSION >= "2.4"
::Bundler::FileUtils
else
::FileUtils
end
end
end
end

0 comments on commit 97ddcb4

Please sign in to comment.