diff options
| author | Mike McQuaid | 2016-08-17 11:07:17 +0100 |
|---|---|---|
| committer | GitHub | 2016-08-17 11:07:17 +0100 |
| commit | cf71e30180d44219836ef129d5e5f00325210dfb (patch) | |
| tree | 220d3832242f35bb9944562b020261d2f4314695 /Library | |
| parent | 5bbc3c21f2235c37be2c01b6d133abcbe2070fb3 (diff) | |
| parent | ed5e2ea3003acc858e0886cb1c4a944f44ba598e (diff) | |
| download | brew-cf71e30180d44219836ef129d5e5f00325210dfb.tar.bz2 | |
Merge pull request #724 from MikeMcQuaid/assume-ruby-two
Assume Ruby 2
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/.rubocop.yml | 8 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/descriptions.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/test-bot.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/fileutils.rb | 59 | ||||
| -rw-r--r-- | Library/Homebrew/global.rb | 1 | ||||
| -rwxr-xr-x | Library/Homebrew/shims/super/cc | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/Gemfile | 4 | ||||
| -rw-r--r-- | Library/Homebrew/utils/curl.rb | 12 |
10 files changed, 14 insertions, 102 deletions
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 74aa17b14..86cff402b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -3,14 +3,6 @@ AllCops: - 'Homebrew/vendor/**/*' - 'Homebrew/test/vendor/**/*' -# Ruby 1.8 compatibility -Style/DotPosition: - EnforcedStyle: trailing -Style/HashSyntax: - EnforcedStyle: hash_rockets -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: no_comma - # ruby style guide favorite Style/StringLiterals: EnforcedStyle: double_quotes 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 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 diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb index d01c70fe6..71e8ebff3 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 @@ -704,11 +700,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" @@ -926,7 +918,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" 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 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 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}" 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 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 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 |
