From 179ef2bf8cb1fb24622c917ea8d9a7cad70d5de5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:07 +0100 Subject: global: raise unless Ruby 2. --- Library/Homebrew/global.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index f739f5012..95aa568b9 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -31,6 +31,7 @@ else end RUBY_BIN = RUBY_PATH.dirname RUBY_TWO = RUBY_VERSION.split(".").first.to_i >= 2 +raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] HOMEBREW_USER_AGENT_RUBY = "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" -- cgit v1.2.3 From 59b3c085ba74897e90f3986f7ed463115900fef5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:31 +0100 Subject: cmd/audit: assume Ruby 2. --- Library/Homebrew/cmd/audit.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 0845faeb3..b46f47ab5 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -37,8 +37,6 @@ require "cmd/style" require "date" module Homebrew - RUBY_2_OR_LATER = RUBY_VERSION.split(".").first.to_i >= 2 - def audit if ARGV.switch? "D" Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/) @@ -49,7 +47,6 @@ module Homebrew new_formula = ARGV.include? "--new-formula" strict = new_formula || ARGV.include?("--strict") - style = strict && RUBY_2_OR_LATER online = new_formula || ARGV.include?("--online") ENV.activate_extensions! @@ -62,14 +59,15 @@ module Homebrew ff = ARGV.resolved_formulae files = ARGV.resolved_formulae.map(&:path) end - if style + + if strict # Check style in a single batch run up front for performance style_results = check_style_json(files, :realpath => true) end ff.each do |f| options = { :new_formula => new_formula, :strict => strict, :online => online } - options[:style_offenses] = style_results.file_offenses(f.path) if style + options[:style_offenses] = style_results.file_offenses(f.path) if strict fa = FormulaAuditor.new(f, options) fa.audit -- cgit v1.2.3 From 7c278319ed7dd3628c68fb84952a40b8d5a5f259 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: descriptions: assume Ruby 2. --- Library/Homebrew/descriptions.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb index 0d36782cf..9c5341461 100644 --- a/Library/Homebrew/descriptions.rb +++ b/Library/Homebrew/descriptions.rb @@ -110,8 +110,6 @@ class Descriptions @cache.select { |name, desc| (name =~ regex) || (desc =~ regex) } end - results = Hash[results] if RUBY_VERSION <= "1.8.7" - new(results) end -- cgit v1.2.3 From 3ae663c013992d7601f8bfe4a1a27cded8571c55 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: test-bot: assume Ruby 2. --- Library/Homebrew/dev-cmd/test-bot.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb index e3ba7e41e..c8264b5ee 100644 --- a/Library/Homebrew/dev-cmd/test-bot.rb +++ b/Library/Homebrew/dev-cmd/test-bot.rb @@ -421,8 +421,7 @@ module Homebrew def setup @category = __method__ return if ARGV.include? "--skip-setup" - if !ENV["TRAVIS"] && ENV["HOMEBREW_RUBY"] != "1.8.7" && - HOMEBREW_PREFIX.to_s == "/usr/local" + if !ENV["TRAVIS"] && HOMEBREW_PREFIX.to_s == "/usr/local" test "brew", "doctor" end test "brew", "--env" @@ -661,12 +660,9 @@ module Homebrew return if @skip_homebrew if @tap.nil? - tests_args = [] + tests_args = ["--official-cmd-taps"] tests_args_no_compat = [] - if RUBY_TWO - tests_args << "--official-cmd-taps" - tests_args_no_compat << "--coverage" if ARGV.include?("--coverage") - end + tests_args_no_compat << "--coverage" if ARGV.include?("--coverage") test "brew", "tests", *tests_args test "brew", "tests", "--generic", *tests_args test "brew", "tests", "--no-compat", *tests_args_no_compat @@ -699,11 +695,7 @@ module Homebrew HOMEBREW_REPOSITORY.cd do safe_system "git", "checkout", "-f", "master" safe_system "git", "reset", "--hard", "origin/master" - # This will uninstall all formulae, as long as - # HOMEBREW_REPOSITORY == HOMEBREW_PREFIX, which is true on the test bots - unless ENV["HOMEBREW_RUBY"] == "1.8.7" - safe_system "git", "clean", "-ffdx", "--exclude=/Library/Taps/" - end + safe_system "git", "clean", "-ffdx", "--exclude=/Library/Taps/" end end pr_locks = "#{@repository}/.git/refs/remotes/*/pr/*/*.lock" @@ -921,7 +913,7 @@ module Homebrew ENV["HOMEBREW_DEVELOPER"] = "1" ENV["HOMEBREW_SANDBOX"] = "1" - ENV["HOMEBREW_RUBY_MACHO"] = "1" if RUBY_TWO + ENV["HOMEBREW_RUBY_MACHO"] = "1" ENV["HOMEBREW_NO_EMOJI"] = "1" ENV["HOMEBREW_FAIL_LOG_LINES"] = "150" ENV["HOMEBREW_EXPERIMENTAL_FILTER_FLAGS_ON_DEPS"] = "1" -- cgit v1.2.3 From 7dddc4df9f4930a05ef98365fb61b710201a1cd2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: exceptions: assume Ruby 2. --- Library/Homebrew/exceptions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index ba04a1d5a..4d1559c28 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -350,7 +350,7 @@ class BuildError < RuntimeError end end puts - if RUBY_VERSION >= "1.8.7" && issues && !issues.empty? + if issues && !issues.empty? puts "These open issues may also help:" puts issues.map { |i| "#{i["title"]} #{i["html_url"]}" }.join("\n") end -- cgit v1.2.3 From f32251d461b7962436593fe7c99d8b01bc277001 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: extend/fileutils: assume Ruby 2. --- Library/Homebrew/extend/fileutils.rb | 59 ------------------------------------ 1 file changed, 59 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index b54a5cadf..86abcee85 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 -- cgit v1.2.3 From ee6c43ebee3e8e847e9fd783a8858688d7bcb38a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: shims/super/cc: assume Ruby 2. --- Library/Homebrew/shims/super/cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index e7ab6500f..a016af777 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -359,6 +359,6 @@ if __FILE__ == $PROGRAM_NAME log(basename, ARGV, tool, args) - args << { :close_others => false } if RUBY_VERSION >= "2.0" + args << { :close_others => false } exec "#{dirname}/xcrun", tool, *args end -- cgit v1.2.3 From 495da233d74d2eea37deb35d5e28bc3e4c5a3b0e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: test/Gemfile: assume Ruby 2. --- Library/Homebrew/test/Gemfile | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile index 605d6017f..df6429f50 100644 --- a/Library/Homebrew/test/Gemfile +++ b/Library/Homebrew/test/Gemfile @@ -14,8 +14,4 @@ group :coverage do :branch => "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1 :require => false gem "coveralls", "0.8.14", :require => false - - # We need to pin the version of this Coveralls dependency because it is the - # last one to support Ruby 1.8. Remove as soon as we stop using Ruby 1.8. - gem "json", "~> 1.8", :require => false end -- cgit v1.2.3 From ed5e2ea3003acc858e0886cb1c4a944f44ba598e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Aug 2016 17:00:38 +0100 Subject: utils/curl: assume Ruby 2. --- Library/Homebrew/utils/curl.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index db3534542..68474c976 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -21,14 +21,8 @@ end def curl_output(*args) curl_args = curl_args(args) - curl_args -= ["--fail"] - if RUBY_TWO - curl_args -= ["--silent"] - Open3.popen3(*curl_args) do |_, stdout, stderr, wait_thread| - [stdout.read, stderr.read, wait_thread.value] - end - else - output = Utils.popen_read_text(*curl_args) - [output, nil, $?] + curl_args -= ["--fail", "--silent"] + Open3.popen3(*curl_args) do |_, stdout, stderr, wait_thread| + [stdout.read, stderr.read, wait_thread.value] end end -- cgit v1.2.3