Fix brew style from #971.

This commit is contained in:
Mike McQuaid 2016-09-19 16:04:32 +01:00
parent c45119de75
commit c9d9e54de6
5 changed files with 22 additions and 22 deletions

View File

@ -55,12 +55,12 @@ module Homebrew
f.pkg_version.to_s
end
outdated_versions = outdated_kegs.
group_by { |keg| Formulary.from_keg(keg) }.
sort_by { |formula, kegs| formula.full_name }.
map do |formula, kegs|
"#{formula.full_name} (#{kegs.map(&:version).join(", ")})"
end.join(", ")
outdated_versions = outdated_kegs
.group_by { |keg| Formulary.from_keg(keg) }
.sort_by { |formula, _kegs| formula.full_name }
.map do |formula, kegs|
"#{formula.full_name} (#{kegs.map(&:version).join(", ")})"
end.join(", ")
puts "#{outdated_versions} < #{current_version}"
else

View File

@ -79,10 +79,10 @@ module Homebrew
def upgrade_formula(f)
formulae_maybe_with_kegs = [f] + f.old_installed_formulae
outdated_kegs = formulae_maybe_with_kegs.
map(&:linked_keg).
select(&:directory?).
map { |k| Keg.new(k.resolved_path) }
outdated_kegs = formulae_maybe_with_kegs
.map(&:linked_keg)
.select(&:directory?)
.map { |k| Keg.new(k.resolved_path) }
fi = FormulaInstaller.new(f)
fi.options = f.build.used_options
@ -123,7 +123,7 @@ module Homebrew
ensure
# restore previous installation state if build failed
begin
outdated_kegs.each(&:link) if !f.installed?
outdated_kegs.each(&:link) unless f.installed?
rescue
nil
end

View File

@ -162,7 +162,7 @@ class Formula
# Defaults to true.
# @return [Boolean]
attr_accessor :follow_installed_alias
alias follow_installed_alias? follow_installed_alias
alias_method :follow_installed_alias?, :follow_installed_alias
# @private
def initialize(name, path, spec, alias_path: nil)

View File

@ -233,9 +233,9 @@ class Formulary
keg = kegs.detect(&:linked?) || kegs.detect(&:optlinked?) || kegs.max_by(&:version)
if keg
from_keg(keg, spec, :alias_path => alias_path)
from_keg(keg, spec, alias_path: alias_path)
else
factory(rack.basename.to_s, spec || :stable, :alias_path => alias_path)
factory(rack.basename.to_s, spec || :stable, alias_path: alias_path)
end
end
@ -247,13 +247,13 @@ class Formulary
spec ||= tab.spec
f = if tap.nil?
factory(keg.rack.basename.to_s, spec, :alias_path => alias_path)
factory(keg.rack.basename.to_s, spec, alias_path: alias_path)
else
begin
factory("#{tap}/#{keg.rack.basename}", spec, :alias_path => alias_path)
factory("#{tap}/#{keg.rack.basename}", spec, alias_path: alias_path)
rescue FormulaUnavailableError
# formula may be migrated to different tap. Try to search in core and all taps.
factory(keg.rack.basename.to_s, spec, :alias_path => alias_path)
factory(keg.rack.basename.to_s, spec, alias_path: alias_path)
end
end
f.build = tab

View File

@ -388,7 +388,7 @@ class FormulaTests < Homebrew::TestCase
def test_alias_paths_with_build_options
alias_path = CoreTap.instance.alias_dir/"another_name"
f = formula(:alias_path => alias_path) { url "foo-1.0" }
f = formula(alias_path: alias_path) { url "foo-1.0" }
f.build = BuildOptions.new({}, {})
assert_equal alias_path, f.alias_path
assert_nil f.installed_alias_path
@ -397,8 +397,8 @@ class FormulaTests < Homebrew::TestCase
def test_alias_paths_with_tab_with_non_alias_source_path
alias_path = CoreTap.instance.alias_dir/"another_name"
source_path = CoreTap.instance.formula_dir/"another_other_name"
f = formula(:alias_path => alias_path) { url "foo-1.0" }
f.build = Tab.new(:source => { "path" => source_path.to_s })
f = formula(alias_path: alias_path) { url "foo-1.0" }
f.build = Tab.new(source: { "path" => source_path.to_s })
assert_equal alias_path, f.alias_path
assert_nil f.installed_alias_path
end
@ -406,8 +406,8 @@ class FormulaTests < Homebrew::TestCase
def test_alias_paths_with_tab_with_alias_source_path
alias_path = CoreTap.instance.alias_dir/"another_name"
source_path = CoreTap.instance.alias_dir/"another_other_name"
f = formula(:alias_path => alias_path) { url "foo-1.0" }
f.build = Tab.new(:source => { "path" => source_path.to_s })
f = formula(alias_path: alias_path) { url "foo-1.0" }
f.build = Tab.new(source: { "path" => source_path.to_s })
assert_equal alias_path, f.alias_path
assert_equal source_path.to_s, f.installed_alias_path
end