From 0a4bc8494dddad1d843c51d4707a0d290b2a148d Mon Sep 17 00:00:00 2001 From: "Bob W. Hogg" Date: Sun, 18 Sep 2016 12:11:30 -0400 Subject: [PATCH] switch to using extend pattern --- Library/Homebrew/dependency_collector.rb | 12 ++++++------ Library/Homebrew/extend/os/linux/ant_dep.rb | 4 ++++ Library/Homebrew/extend/os/mac/ant_dep.rb | 5 +++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 Library/Homebrew/extend/os/linux/ant_dep.rb create mode 100644 Library/Homebrew/extend/os/mac/ant_dep.rb diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index ed9fc3a851..20bf39d83e 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -5,6 +5,12 @@ require "requirement" require "requirements" require "set" +if OS.mac? + require "extend/os/mac/ant_dep" +elsif OS.linux? + require "extend/os/linux/ant_dep" +end + ## A dependency is a formula that another formula needs to install. ## A requirement is something other than a formula that another formula ## needs to be present. This includes external language modules, @@ -135,12 +141,6 @@ class DependencyCollector end end - def ant_dep(spec, tags) - if MacOS.version >= :mavericks || !OS.mac? - Dependency.new(spec.to_s, tags) - end - end - def resource_dep(spec, tags) tags << :build strategy = spec.download_strategy diff --git a/Library/Homebrew/extend/os/linux/ant_dep.rb b/Library/Homebrew/extend/os/linux/ant_dep.rb new file mode 100644 index 0000000000..adc85ebb07 --- /dev/null +++ b/Library/Homebrew/extend/os/linux/ant_dep.rb @@ -0,0 +1,4 @@ +def ant_dep(spec, tags) + # Always use brewed ant on Linux + Dependency.new(spec.to_s, tags) +end diff --git a/Library/Homebrew/extend/os/mac/ant_dep.rb b/Library/Homebrew/extend/os/mac/ant_dep.rb new file mode 100644 index 0000000000..397eb0e720 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/ant_dep.rb @@ -0,0 +1,5 @@ +def ant_dep(spec, tags) + if MacOS.version >= :mavericks + Dependency.new(spec.to_s, tags) + end +end