diff options
| author | Xu Cheng | 2015-09-09 13:55:19 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-10 13:37:58 +0800 |
| commit | c5536e1e08a13352cf241a2c3f7b2aa75a8e31d6 (patch) | |
| tree | 8775f7d3e8329e1a03e820a2ef7e985154793a7a | |
| parent | 71be19235feb06b163aa8d494cfd817b483da8b5 (diff) | |
| download | brew-c5536e1e08a13352cf241a2c3f7b2aa75a8e31d6.tar.bz2 | |
Descriptions.cache_formulae: secure formulae loading
| -rw-r--r-- | Library/Homebrew/descriptions.rb | 9 |
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 |
