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
49927ed7
Unverified
Commit
49927ed7
authored
7 years ago
by
Mike McQuaid
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #3957 from amancevice/install-gem
Added Homebrew.install_gem!
parents
83073479
57e1e16f
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/utils.rb
+22
-18
22 additions, 18 deletions
Library/Homebrew/utils.rb
with
22 additions
and
18 deletions
Library/Homebrew/utils.rb
+
22
−
18
View file @
49927ed7
...
...
@@ -199,7 +199,7 @@ module Homebrew
_system
(
cmd
,
*
args
)
end
def
install_gem
_setup_path
!
(
name
,
version
=
nil
,
executable
=
name
)
def
install_gem!
(
name
,
version
=
nil
)
# Match where our bundler gems are.
ENV
[
"GEM_HOME"
]
=
"
#{
ENV
[
"HOMEBREW_LIBRARY"
]
}
/Homebrew/vendor/bundle/ruby/
#{
RbConfig
::
CONFIG
[
"ruby_version"
]
}
"
ENV
[
"GEM_PATH"
]
=
ENV
[
"GEM_HOME"
]
...
...
@@ -214,24 +214,28 @@ module Homebrew
path
.
prepend
(
Gem
.
bindir
)
ENV
[
"PATH"
]
=
path
if
Gem
::
Specification
.
find_all_by_name
(
name
,
version
).
empty?
ohai
"Installing or updating '
#{
name
}
' gem"
install_args
=
%W[--no-ri --no-rdoc
#{
name
}
]
install_args
<<
"--version"
<<
version
if
version
# Do `gem install [...]` without having to spawn a separate process or
# having to find the right `gem` binary for the running Ruby interpreter.
require
"rubygems/commands/install_command"
install_cmd
=
Gem
::
Commands
::
InstallCommand
.
new
install_cmd
.
handle_options
(
install_args
)
exit_code
=
1
# Should not matter as `install_cmd.execute` always throws.
begin
install_cmd
.
execute
rescue
Gem
::
SystemExitException
=>
e
exit_code
=
e
.
exit_code
end
odie
"Failed to install/update the '
#{
name
}
' gem."
if
exit_code
.
nonzero?
return
unless
Gem
::
Specification
.
find_all_by_name
(
name
,
version
).
empty?
ohai
"Installing or updating '
#{
name
}
' gem"
install_args
=
%W[--no-ri --no-rdoc
#{
name
}
]
install_args
<<
"--version"
<<
version
if
version
# Do `gem install [...]` without having to spawn a separate process or
# having to find the right `gem` binary for the running Ruby interpreter.
require
"rubygems/commands/install_command"
install_cmd
=
Gem
::
Commands
::
InstallCommand
.
new
install_cmd
.
handle_options
(
install_args
)
exit_code
=
1
# Should not matter as `install_cmd.execute` always throws.
begin
install_cmd
.
execute
rescue
Gem
::
SystemExitException
=>
e
exit_code
=
e
.
exit_code
end
odie
"Failed to install/update the '
#{
name
}
' gem."
if
exit_code
.
nonzero?
end
def
install_gem_setup_path!
(
name
,
version
=
nil
,
executable
=
name
)
install_gem!
(
name
,
version
)
return
if
which
(
executable
)
odie
<<~
EOS
...
...
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