diff options
| author | Jack Nagel | 2013-08-31 16:10:35 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2013-08-31 16:16:54 -0500 | 
| commit | ab49abcd0f976cc1575a631514149b26452b9a15 (patch) | |
| tree | 565f6e0d760d541f37dc62fc83d3bc09511cbea2 /Library/Homebrew/build_options.rb | |
| parent | ca7205ea9cfb2e245453c398f54561b0503ddce5 (diff) | |
| download | homebrew-ab49abcd0f976cc1575a631514149b26452b9a15.tar.bz2 | |
Push dependency option generation into BuildOptions
Diffstat (limited to 'Library/Homebrew/build_options.rb')
| -rw-r--r-- | Library/Homebrew/build_options.rb | 9 | 
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 18285a7a5..0cd3a5a46 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -20,6 +20,15 @@ class BuildOptions      @options << Option.new(name, description)    end +  def add_dep_option(dep) +    name = dep.name.split("/").last # strip any tap prefix +    if dep.optional? && !has_option?("with-#{name}") +      add("with-#{name}", "Build with #{name} support") +    elsif dep.recommended? && !has_option?("without-#{name}") +      add("without-#{name}", "Build without #{name} support") +    end +  end +    def has_option? name      any? { |opt| opt.name == name }    end  | 
