From f32251d461b7962436593fe7c99d8b01bc277001 Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Tue, 16 Aug 2016 17:00:38 +0100
Subject: [PATCH] extend/fileutils: assume Ruby 2.

---
 Library/Homebrew/extend/fileutils.rb | 59 ----------------------------
 1 file changed, 59 deletions(-)

diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index b54a5cadf0..86abcee853 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -98,54 +98,6 @@ module FileUtils
   end
   module_function :mkdir
 
-  # The #copy_metadata method in all current versions of Ruby has a
-  # bad bug which causes copying symlinks across filesystems to fail;
-  # see #14710.
-  # This was resolved in Ruby HEAD after the release of 1.9.3p194, but
-  # never backported into the 1.9.3 branch. Fixed in 2.0.0.
-  # The monkey-patched method here is copied directly from upstream fix.
-  if RUBY_VERSION < "2.0.0"
-    # @private
-    class Entry_
-      alias_method :old_copy_metadata, :copy_metadata
-      def copy_metadata(path)
-        st = lstat
-        unless st.symlink?
-          File.utime st.atime, st.mtime, path
-        end
-        begin
-          if st.symlink?
-            begin
-              File.lchown st.uid, st.gid, path
-            rescue NotImplementedError
-            end
-          else
-            File.chown st.uid, st.gid, path
-          end
-        rescue Errno::EPERM
-          # clear setuid/setgid
-          if st.symlink?
-            begin
-              File.lchmod st.mode & 01777, path
-            rescue NotImplementedError
-            end
-          else
-            File.chmod st.mode & 01777, path
-          end
-        else
-          if st.symlink?
-            begin
-              File.lchmod st.mode, path
-            rescue NotImplementedError
-            end
-          else
-            File.chmod st.mode, path
-          end
-        end
-      end
-    end
-  end
-
   # Run `scons` using a Homebrew-installed version rather than whatever is in the `PATH`.
   def scons(*args)
     system Formulary.factory("scons").opt_bin/"scons", *args
@@ -187,14 +139,3 @@ module FileUtils
     ENV.update(removed)
   end
 end
-
-# Shim File.write for Ruby 1.8.7, where it's absent
-unless File.respond_to?(:write)
-  class File
-    def self.write(filename, contents)
-      File.open(filename, "w") do |file|
-        file.write contents
-      end
-    end
-  end
-end
-- 
GitLab