commit
						cf71e30180
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
        test "brew", "tests", *tests_args
 | 
			
		||||
        test "brew", "tests", "--generic", *tests_args
 | 
			
		||||
        test "brew", "tests", "--no-compat", *tests_args_no_compat
 | 
			
		||||
@ -704,13 +700,9 @@ 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
 | 
			
		||||
      end
 | 
			
		||||
      end
 | 
			
		||||
      pr_locks = "#{@repository}/.git/refs/remotes/*/pr/*/*.lock"
 | 
			
		||||
      Dir.glob(pr_locks) { |lock| FileUtils.rm_rf lock }
 | 
			
		||||
    end
 | 
			
		||||
@ -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"
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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}"
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -21,14 +21,8 @@ end
 | 
			
		||||
 | 
			
		||||
def curl_output(*args)
 | 
			
		||||
  curl_args = curl_args(args)
 | 
			
		||||
  curl_args -= ["--fail"]
 | 
			
		||||
  if RUBY_TWO
 | 
			
		||||
    curl_args -= ["--silent"]
 | 
			
		||||
  curl_args -= ["--fail", "--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, $?]
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user