diff options
| author | Baptiste Fontaine | 2015-12-21 13:33:03 +0100 |
|---|---|---|
| committer | Baptiste Fontaine | 2015-12-26 22:58:26 +0100 |
| commit | 48681c3f3a562709dcc1c3256df97ff747fae4d8 (patch) | |
| tree | 387b66dab7e5c9f96a0a0773511e287638aa11fa | |
| parent | d09698f19f3a57ce00baddc6142aa484d7d908f6 (diff) | |
| download | brew-48681c3f3a562709dcc1c3256df97ff747fae4d8.tar.bz2 | |
minor perf improvements
Closes Homebrew/homebrew#47224.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/pull.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/compilers.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/utils/json.rb | 3 |
6 files changed, 11 insertions, 8 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 83f1147c5..574c3c69d 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -36,7 +36,8 @@ MAXIMUM_STRING_MATCHES = 100 module Homebrew def keg_contains(string, keg, ignores) - @put_string_exists_header, @put_filenames = nil + @put_string_exists_header = nil + @put_filenames = nil def print_filename(string, filename) unless @put_string_exists_header diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index f2de84d4d..423118b12 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -1298,13 +1298,14 @@ module Homebrew first_warning = true methods.each do |method| - begin - out = checks.send(method) - rescue NoMethodError + unless checks.respond_to?(method) Homebrew.failed = true puts "No check available by the name: #{method}" next end + + out = checks.send(method) + unless out.nil? || out.empty? if first_warning $stderr.puts <<-EOS.undent diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb index 1454f9938..959724002 100644 --- a/Library/Homebrew/cmd/pull.rb +++ b/Library/Homebrew/cmd/pull.rb @@ -59,7 +59,7 @@ module Homebrew url = "https://github.com/Homebrew/homebrew/pull/#{arg}" tap = CoreFormulaRepository.instance elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/}) - _, testing_job = *testing_match + testing_job = testing_match[1] url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}" tap = CoreFormulaRepository.instance odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle") diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index ab710a6d0..6ac1809f6 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -33,7 +33,7 @@ class CompilerFailure def self.create(spec, &block) # Non-Apple compilers are in the format fails_with compiler => version if spec.is_a?(Hash) - _, major_version = spec.first + major_version = spec.first[1] name = "gcc-#{major_version}" # so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible version = "#{major_version}.999" diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 36bdb0ffe..250c39bbc 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1271,7 +1271,7 @@ class Formula "root_url" => bottle_spec.root_url, } bottle_info["files"] = {} - bottle_spec.collector.keys.each do |os| + bottle_spec.collector.each_key do |os| checksum = bottle_spec.collector[os] bottle_info["files"][os] = { "url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.revision)}", diff --git a/Library/Homebrew/utils/json.rb b/Library/Homebrew/utils/json.rb index 8a8cb6847..7fe73d22c 100644 --- a/Library/Homebrew/utils/json.rb +++ b/Library/Homebrew/utils/json.rb @@ -24,7 +24,8 @@ module Utils obj.inject({}) do |result, (key, val)| key = key.respond_to?(:to_s) ? key.to_s : key val = stringify_keys(val) - result.merge!(key => val) + result[key] = val + result end else obj |
