aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorKimmo Lehto2017-02-22 09:21:31 +0200
committerKimmo Lehto2017-02-22 09:21:31 +0200
commitb4a2fe502cc8bef717e9f52efe5926cc27d1e9a6 (patch)
treefbeb22babfbe7f871cfd94a7e8804f8c486e49d3 /Library
parentf5a0ae176a1abed5ecba42a436a8a32595c21a9d (diff)
downloadbrew-b4a2fe502cc8bef717e9f52efe5926cc27d1e9a6.tar.bz2
Proposed changes
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/requirements/ruby_requirement.rb20
1 files changed, 7 insertions, 13 deletions
diff --git a/Library/Homebrew/requirements/ruby_requirement.rb b/Library/Homebrew/requirements/ruby_requirement.rb
index 0caedb5ca..327c13170 100644
--- a/Library/Homebrew/requirements/ruby_requirement.rb
+++ b/Library/Homebrew/requirements/ruby_requirement.rb
@@ -8,10 +8,10 @@ class RubyRequirement < Requirement
super
end
- satisfy(build_env: false) { suitable_ruby }
+ satisfy(build_env: false) { new_enough_ruby }
env do
- ENV.prepend_path "PATH", suitable_ruby
+ ENV.prepend_path "PATH", new_enough_ruby
end
def message
@@ -34,19 +34,20 @@ class RubyRequirement < Requirement
private
- def suitable_ruby
- rubies.detect { |ruby| suitable?(ruby) }
+ def new_enough_ruby
+ rubies.detect { |ruby| new_enough?(ruby) }
end
def rubies
rubies = which_all("ruby")
+ ruby_formula = Formula["ruby"]
if ruby_formula && ruby_formula.installed?
- rubies.unshift Pathname.new(ruby_formula.bin/"ruby")
+ rubies.unshift ruby_formula.bin/"ruby"
end
rubies.uniq
end
- def suitable?(ruby)
+ def new_enough?(ruby)
version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
end
@@ -54,11 +55,4 @@ class RubyRequirement < Requirement
def min_version
@min_version ||= Version.create(@version)
end
-
- def ruby_formula
- @ruby_formula ||= Formula["ruby"]
- rescue FormulaUnavailableError
- nil
- end
-
end