aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJack Nagel2014-06-27 21:58:15 -0500
committerJack Nagel2014-06-27 21:58:15 -0500
commit346fa5098fdb36cfb97a954c50059de15a28f952 (patch)
tree373578d0d6db5798b24863e39a02d8b1c0b4db6d /Library/Homebrew/cmd
parent982a165e52bfcaccefc9bd7492f94f1046ca53e9 (diff)
downloadbrew-346fa5098fdb36cfb97a954c50059de15a28f952.tar.bz2
Simplify valid_formula_location? method
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/update.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 6166571cd..042214ee3 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -232,13 +232,14 @@ class Report < Hash
end
def valid_formula_location?(relative_path)
- ruby_file = /\A.*\.rb\Z/
parts = relative_path.split('/')[2..-1]
- [
- parts.length == 1 && parts.first =~ ruby_file,
- parts.length == 2 && parts.first == 'Formula' && parts.last =~ ruby_file,
- parts.length == 2 && parts.first == 'HomebrewFormula' && parts.last =~ ruby_file,
- ].any?
+ return false unless File.extname(parts.last) == ".rb"
+ case parts.first
+ when "Formula", "HomebrewFormula"
+ parts.length == 2
+ else
+ parts.length == 1
+ end
end
def new_tapped_formula