aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/compat/requirements/ruby_requirement.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/compat/requirements/ruby_requirement.rb')
-rw-r--r--Library/Homebrew/compat/requirements/ruby_requirement.rb56
1 files changed, 0 insertions, 56 deletions
diff --git a/Library/Homebrew/compat/requirements/ruby_requirement.rb b/Library/Homebrew/compat/requirements/ruby_requirement.rb
deleted file mode 100644
index a9ec8c42d..000000000
--- a/Library/Homebrew/compat/requirements/ruby_requirement.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-class RubyRequirement < Requirement
- fatal true
- default_formula "ruby"
-
- def initialize(tags)
- @version = tags.shift if /(\d\.)+\d/ =~ tags.first
- raise "RubyRequirement requires a version!" unless @version
- super
- end
-
- satisfy(build_env: false) { new_enough_ruby }
-
- env do
- ENV.prepend_path "PATH", new_enough_ruby.dirname
- end
-
- def message
- s = "Ruby >= #{@version} is required to install this formula."
- s += super
- s
- end
-
- def inspect
- "#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
- end
-
- def display_s
- if @version
- "#{name} >= #{@version}"
- else
- name
- end
- end
-
- private
-
- def new_enough_ruby
- rubies.detect { |ruby| new_enough?(ruby) }
- end
-
- def rubies
- rubies = which_all("ruby")
- ruby_formula = Formula["ruby"]
- rubies.unshift ruby_formula.bin/"ruby" if ruby_formula&.installed?
- rubies.uniq
- end
-
- def new_enough?(ruby)
- version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
- version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
- end
-
- def min_version
- @min_version ||= Version.create(@version)
- end
-end