aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-12-26 23:00:38 +0100
committerBaptiste Fontaine2015-12-26 23:00:38 +0100
commit169b8fc03942397bd0f73bb008e915b834605cff (patch)
tree437c7421ae4bc9c0960a63d4e5a0632b729a4990
parent48681c3f3a562709dcc1c3256df97ff747fae4d8 (diff)
downloadbrew-169b8fc03942397bd0f73bb008e915b834605cff.tar.bz2
Revert "minor perf improvements"
This reverts commit 16a2a8274a7808e63a6c78475e12a7c0ef5812ef.
-rw-r--r--Library/Homebrew/cmd/bottle.rb3
-rw-r--r--Library/Homebrew/cmd/doctor.rb7
-rw-r--r--Library/Homebrew/cmd/pull.rb2
-rw-r--r--Library/Homebrew/compilers.rb2
-rw-r--r--Library/Homebrew/formula.rb2
-rw-r--r--Library/Homebrew/utils/json.rb3
6 files changed, 8 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 574c3c69d..83f1147c5 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -36,8 +36,7 @@ MAXIMUM_STRING_MATCHES = 100
module Homebrew
def keg_contains(string, keg, ignores)
- @put_string_exists_header = nil
- @put_filenames = nil
+ @put_string_exists_header, @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 423118b12..f2de84d4d 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -1298,14 +1298,13 @@ module Homebrew
first_warning = true
methods.each do |method|
- unless checks.respond_to?(method)
+ begin
+ out = checks.send(method)
+ rescue NoMethodError
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 959724002..1454f9938 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[1]
+ _, testing_job = *testing_match
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 6ac1809f6..ab710a6d0 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[1]
+ _, major_version = spec.first
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 250c39bbc..36bdb0ffe 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.each_key do |os|
+ bottle_spec.collector.keys.each 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 7fe73d22c..8a8cb6847 100644
--- a/Library/Homebrew/utils/json.rb
+++ b/Library/Homebrew/utils/json.rb
@@ -24,8 +24,7 @@ module Utils
obj.inject({}) do |result, (key, val)|
key = key.respond_to?(:to_s) ? key.to_s : key
val = stringify_keys(val)
- result[key] = val
- result
+ result.merge!(key => val)
end
else
obj