Merge pull request #1333 from vladshablinsky/compare-names-not-formulae
Compare names not formulae
This commit is contained in:
commit
7f3507ee7d
@ -1167,7 +1167,7 @@ class Formula
|
|||||||
# Returns false if the formula wasn't installed with an alias.
|
# Returns false if the formula wasn't installed with an alias.
|
||||||
def installed_alias_target_changed?
|
def installed_alias_target_changed?
|
||||||
target = current_installed_alias_target
|
target = current_installed_alias_target
|
||||||
target && target != self
|
target && target.name != name
|
||||||
end
|
end
|
||||||
|
|
||||||
# Is this formula the target of an alias used to install an old formula?
|
# Is this formula the target of an alias used to install an old formula?
|
||||||
@ -1192,7 +1192,7 @@ class Formula
|
|||||||
# it doesn't make sense to say that other formulae are older versions of it
|
# it doesn't make sense to say that other formulae are older versions of it
|
||||||
# because we don't know which came first.
|
# because we don't know which came first.
|
||||||
return [] if alias_path.nil? || installed_alias_target_changed?
|
return [] if alias_path.nil? || installed_alias_target_changed?
|
||||||
self.class.installed_with_alias_path(alias_path) - [self]
|
self.class.installed_with_alias_path(alias_path).reject { |f| f.name == name }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
|||||||
@ -799,8 +799,8 @@ end
|
|||||||
class AliasChangeTests < Homebrew::TestCase
|
class AliasChangeTests < Homebrew::TestCase
|
||||||
attr_reader :f, :new_formula, :tab, :alias_path
|
attr_reader :f, :new_formula, :tab, :alias_path
|
||||||
|
|
||||||
def make_formula(version)
|
def make_formula(name, version)
|
||||||
f = formula(alias_path: alias_path) { url "foo-#{version}" }
|
f = formula(name, alias_path: alias_path) { url "foo-#{version}" }
|
||||||
f.build = tab
|
f.build = tab
|
||||||
f
|
f
|
||||||
end
|
end
|
||||||
@ -811,8 +811,8 @@ class AliasChangeTests < Homebrew::TestCase
|
|||||||
|
|
||||||
@tab = Tab.empty
|
@tab = Tab.empty
|
||||||
|
|
||||||
@f = make_formula("1.0")
|
@f = make_formula("formula_name", "1.0")
|
||||||
@new_formula = make_formula("1.1")
|
@new_formula = make_formula("new_formula_name", "1.1")
|
||||||
|
|
||||||
Formula.stubs(:installed).returns([f])
|
Formula.stubs(:installed).returns([f])
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user