Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
0b33428e
Commit
0b33428e
authored
8 years ago
by
Mike McQuaid
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2083 from kke/prepend_suitable_ruby_to_path
Prepend suitable ruby to path
parents
76ca97b4
b4a2fe50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/requirements/ruby_requirement.rb
+29
-7
29 additions, 7 deletions
Library/Homebrew/requirements/ruby_requirement.rb
with
29 additions
and
7 deletions
Library/Homebrew/requirements/ruby_requirement.rb
+
29
−
7
View file @
0b33428e
...
...
@@ -8,16 +8,14 @@ class RubyRequirement < Requirement
super
end
satisfy
build_env:
false
do
which_all
(
"ruby"
).
detect
do
|
ruby
|
version
=
/\d\.\d/
.
match
Utils
.
popen_read
(
ruby
,
"--version"
)
next
unless
version
Version
.
create
(
version
.
to_s
)
>=
Version
.
create
(
@version
)
end
satisfy
(
build_env:
false
)
{
new_enough_ruby
}
env
do
ENV
.
prepend_path
"PATH"
,
new_enough_ruby
end
def
message
s
=
"Ruby
#{
@version
}
is required to install this formula."
s
=
"Ruby
>=
#{
@version
}
is required to install this formula."
s
+=
super
s
end
...
...
@@ -33,4 +31,28 @@ class RubyRequirement < Requirement
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"
]
if
ruby_formula
&&
ruby_formula
.
installed?
rubies
.
unshift
ruby_formula
.
bin
/
"ruby"
end
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment