summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-27 09:19:26 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-27 09:19:26 +0100
commit525d4b2748f7381e66cd36907c3d3d6cbfeccb05 (patch)
tree005b5e77acb6c7c5ad4d6e593c66f193bb7617b0
parentd368aa9e6257a27fab31efe0396069c8977cdc99 (diff)
downloadbundler-vendor_last_fileutils.tar.gz
Bump vendored fileutils to 1.2.0vendor_last_fileutils
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb57
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils/version.rb5
2 files changed, 38 insertions, 24 deletions
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb
index 3a48e80293..fb7777eb49 100644
--- a/lib/bundler/vendor/fileutils/lib/fileutils.rb
+++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb
@@ -1,4 +1,13 @@
# frozen_string_literal: true
+
+begin
+ require 'rbconfig'
+rescue LoadError
+ # for make mjit-headers
+end
+
+require "bundler/vendor/fileutils/lib/fileutils/version"
+
#
# = fileutils.rb
#
@@ -56,7 +65,7 @@
#
# There are some `low level' methods, which do not accept any option:
#
-# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference = false)
+# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
# Bundler::FileUtils.copy_stream(srcstream, deststream)
# Bundler::FileUtils.remove_entry(path, force = false)
@@ -84,13 +93,8 @@
# files/directories. This equates to passing the <tt>:noop</tt> and
# <tt>:verbose</tt> flags to methods in Bundler::FileUtils.
#
-
-require 'rbconfig'
-
module Bundler::FileUtils
- VERSION = "1.1.0"
-
def self.private_module_function(name) #:nodoc:
module_function name
private_class_method name
@@ -110,12 +114,14 @@ module Bundler::FileUtils
#
# Changes the current directory to the directory +dir+.
#
- # If this method is called with block, resumes to the old
- # working directory after the block execution finished.
+ # If this method is called with block, resumes to the previous
+ # working directory after the block execution has finished.
+ #
+ # Bundler::FileUtils.cd('/') # change directory
#
- # Bundler::FileUtils.cd('/', :verbose => true) # chdir and report it
+ # Bundler::FileUtils.cd('/', :verbose => true) # change directory and report it
#
- # Bundler::FileUtils.cd('/') do # chdir
+ # Bundler::FileUtils.cd('/') do # change directory
# # ... # do something
# end # return to original directory
#
@@ -519,13 +525,12 @@ module Bundler::FileUtils
if destent.exist?
if destent.directory?
raise Errno::EEXIST, d
- else
- destent.remove_file if rename_cannot_overwrite_file?
end
end
begin
File.rename s, d
- rescue Errno::EXDEV
+ rescue Errno::EXDEV,
+ Errno::EPERM # move from unencrypted to encrypted dir (ext4)
copy_entry s, d, true
if secure
remove_entry_secure s, force
@@ -543,11 +548,6 @@ module Bundler::FileUtils
alias move mv
module_function :move
- def rename_cannot_overwrite_file? #:nodoc:
- /emx/ =~ RbConfig::CONFIG['host_os']
- end
- private_module_function :rename_cannot_overwrite_file?
-
#
# Remove file(s) specified in +list+. This method cannot remove directories.
# All StandardErrors are ignored when the :force option is set.
@@ -698,7 +698,7 @@ module Bundler::FileUtils
f.chown euid, -1
f.chmod 0700
}
- rescue EISDIR # JRuby in non-native mode can't open files as dirs
+ rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
File.lstat(dot_file).tap {|fstat|
unless fu_stat_identical_entry?(st, fstat)
# symlink (TOC-to-TOU attack?)
@@ -1145,8 +1145,11 @@ module Bundler::FileUtils
module StreamUtils_
private
- def fu_windows?
- /mswin|mingw|bccwin|emx/ =~ RbConfig::CONFIG['host_os']
+ case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
+ when /mswin|mingw/
+ def fu_windows?; true end
+ else
+ def fu_windows?; false end
end
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
@@ -1271,9 +1274,15 @@ module Bundler::FileUtils
def entries
opts = {}
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
- Dir.entries(path(), opts)\
- .reject {|n| n == '.' or n == '..' }\
- .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
+
+ files = if Dir.respond_to?(:children)
+ Dir.children(path, opts)
+ else
+ Dir.entries(path(), opts)
+ .reject {|n| n == '.' or n == '..' }
+ end
+
+ files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
end
def stat
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils/version.rb b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
new file mode 100644
index 0000000000..6d8504ccd5
--- /dev/null
+++ b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+module Bundler::FileUtils
+ VERSION = "1.2.0"
+end