versions: silence 'aka' warning and syntax errors
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
b695dfb18c
commit
d10f2afbac
@ -63,15 +63,21 @@ class Formula
|
|||||||
path = Pathname.new(Pathname.pwd+"#{name}.rb")
|
path = Pathname.new(Pathname.pwd+"#{name}.rb")
|
||||||
path.write text_from_sha(sha)
|
path.write text_from_sha(sha)
|
||||||
|
|
||||||
# Unload the class so Formula#version returns the correct value.
|
# Determine the version by loading the old class file.
|
||||||
# Note that this means that the command will error out after it
|
# Note that this means that the command will error out after it
|
||||||
# encounters a formula that won't import. This doesn't matter
|
# encounters a formula that won't import. This doesn't matter
|
||||||
# for most formulae, but e.g. Bash at revision aae084c9db has a
|
# for most formulae, but e.g. Bash at revision aae084c9db has a
|
||||||
# syntax error and so `versions` isn't able to walk very far back
|
# syntax error and so `versions` isn't able to walk very far back
|
||||||
# through the history.
|
# through the history.
|
||||||
|
|
||||||
|
# Unload the class so Formula#version returns the correct value.
|
||||||
# FIXME shouldn't have to do this?
|
# FIXME shouldn't have to do this?
|
||||||
Object.send(:remove_const, "#{Formula.class_s(name)}")
|
Object.send(:remove_const, Formula.class_s(name))
|
||||||
Formula.factory(path).version
|
begin
|
||||||
|
nostdout { Formula.factory(path).version }
|
||||||
|
rescue SyntaxError
|
||||||
|
nil
|
||||||
|
end
|
||||||
end rescue nil
|
end rescue nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user