diff options
| author | Xu Cheng | 2016-08-18 14:35:39 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-08-18 14:35:39 +0800 |
| commit | e423617d771b934da4c82ab30683d0a05aa20b45 (patch) | |
| tree | 363d215cf0ec4153b1bd93b303df4f7d0778a678 /Library/Homebrew/extend | |
| parent | af3ad3cb86faf73b3c9f089fa496a0e01f43b9f0 (diff) | |
| download | brew-e423617d771b934da4c82ab30683d0a05aa20b45.tar.bz2 | |
remove ruby 1.8 compatible codes
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/fileutils.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 34 |
2 files changed, 2 insertions, 35 deletions
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index 86abcee85..2b5dcfef3 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -65,8 +65,7 @@ module FileUtils Process.gid end begin - # group_id.to_s makes OS X 10.6.7 (ruby-1.8.7-p174) and earlier happy. - chown(nil, group_id.to_s, tmpdir) + chown(nil, group_id, tmpdir) rescue Errno::EPERM opoo "Failed setting group \"#{Etc.getgrgid(group_id).name}\" on #{tmpdir}" end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 2f0ea7e03..c9cc9d3f3 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -445,39 +445,7 @@ class Pathname end end - # We redefine these private methods in order to add the /o modifier to - # the Regexp literals, which forces string interpolation to happen only - # once instead of each time the method is called. This is fixed in 1.9+. - if RUBY_VERSION <= "1.8.7" - # @private - alias_method :old_chop_basename, :chop_basename - - def chop_basename(path) - base = File.basename(path) - if /\A#{Pathname::SEPARATOR_PAT}?\z/o =~ base - return nil - else - return path[0, path.rindex(base)], base - end - end - private :chop_basename - - # @private - alias_method :old_prepend_prefix, :prepend_prefix - - def prepend_prefix(prefix, relpath) - if relpath.empty? - File.dirname(prefix) - elsif /#{SEPARATOR_PAT}/o =~ prefix - prefix = File.dirname(prefix) - prefix = File.join(prefix, "") if File.basename(prefix + "a") != "a" - prefix + relpath - else - prefix + relpath - end - end - private :prepend_prefix - elsif RUBY_VERSION == "2.0.0" + if RUBY_VERSION == "2.0.0" # https://bugs.ruby-lang.org/issues/9915 prepend Module.new { def inspect |
