diff options
| author | Jack Nagel | 2013-05-06 16:08:49 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-05-06 16:08:49 -0500 |
| commit | f47e43aa2ba6ff772b13db62ea2c321ea513516f (patch) | |
| tree | 4745edafa7570529017686217612652fadae3764 /Library | |
| parent | 9ec3102e57e73c4f5b204f4c370cc51a423ced98 (diff) | |
| download | brew-f47e43aa2ba6ff772b13db62ea2c321ea513516f.tar.bz2 | |
Extract string and class logic from parse_spec
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/dependency_collector.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index e53b8da0a..69e5978c3 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -51,26 +51,26 @@ class DependencyCollector def parse_spec spec, tag case spec when String - if tag && LANGUAGE_MODULES.include?(tag) - LanguageModuleDependency.new(tag, spec) - else - Dependency.new(spec, tag) - end + parse_string_spec(spec, tag) when Symbol parse_symbol_spec(spec, tag) when Dependency, Requirement spec when Class - if spec < Requirement - spec.new(tag) - else - raise "#{spec} is not a Requirement subclass" - end + parse_class_spec(spec, tag) else raise "Unsupported type #{spec.class} for #{spec}" end end + def parse_string_spec(spec, tag) + if tag && LANGUAGE_MODULES.include?(tag) + LanguageModuleDependency.new(tag, spec) + else + Dependency.new(spec, tag) + end + end + def parse_symbol_spec spec, tag case spec when :autoconf, :automake, :bsdmake, :libtool, :libltdl @@ -95,6 +95,14 @@ class DependencyCollector end end + def parse_class_spec(spec, tag) + if spec < Requirement + spec.new(tag) + else + raise "#{spec} is not a Requirement subclass" + end + end + def x11_dep(spec, tag) if MacOS.version >= :mountain_lion Dependency.new(spec.to_s, tag) |
