aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/descriptions.rb
diff options
context:
space:
mode:
authorXu Cheng2015-09-09 13:55:19 +0800
committerXu Cheng2015-09-10 13:37:58 +0800
commitc5536e1e08a13352cf241a2c3f7b2aa75a8e31d6 (patch)
tree8775f7d3e8329e1a03e820a2ef7e985154793a7a /Library/Homebrew/descriptions.rb
parent71be19235feb06b163aa8d494cfd817b483da8b5 (diff)
downloadbrew-c5536e1e08a13352cf241a2c3f7b2aa75a8e31d6.tar.bz2
Descriptions.cache_formulae: secure formulae loading
Diffstat (limited to 'Library/Homebrew/descriptions.rb')
-rw-r--r--Library/Homebrew/descriptions.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb
index e74a84028..5f7f44c4d 100644
--- a/Library/Homebrew/descriptions.rb
+++ b/Library/Homebrew/descriptions.rb
@@ -1,4 +1,5 @@
require "formula"
+require "formula_versions"
require "csv"
class Descriptions
@@ -92,7 +93,13 @@ class Descriptions
# cache. Save the updated cache to disk, unless explicitly told not to.
def self.cache_formulae(formula_names, options = { :save => true })
if self.cache
- formula_names.each { |name| @cache[name] = Formula[name].desc }
+ formula_names.each do |name|
+ begin
+ desc = Formulary.factory(name).desc
+ rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS
+ end
+ @cache[name] = desc
+ end
self.save_cache if options[:save]
end
end