Added Homebrew.install_gem!
Useful when gem does not install with executable
This commit is contained in:
parent
8307347987
commit
57e1e16fc4
@ -199,7 +199,7 @@ module Homebrew
|
|||||||
_system(cmd, *args)
|
_system(cmd, *args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_gem_setup_path!(name, version = nil, executable = name)
|
def install_gem!(name, version = nil)
|
||||||
# Match where our bundler gems are.
|
# Match where our bundler gems are.
|
||||||
ENV["GEM_HOME"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/vendor/bundle/ruby/#{RbConfig::CONFIG["ruby_version"]}"
|
ENV["GEM_HOME"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/vendor/bundle/ruby/#{RbConfig::CONFIG["ruby_version"]}"
|
||||||
ENV["GEM_PATH"] = ENV["GEM_HOME"]
|
ENV["GEM_PATH"] = ENV["GEM_HOME"]
|
||||||
@ -214,7 +214,8 @@ module Homebrew
|
|||||||
path.prepend(Gem.bindir)
|
path.prepend(Gem.bindir)
|
||||||
ENV["PATH"] = path
|
ENV["PATH"] = path
|
||||||
|
|
||||||
if Gem::Specification.find_all_by_name(name, version).empty?
|
return unless Gem::Specification.find_all_by_name(name, version).empty?
|
||||||
|
|
||||||
ohai "Installing or updating '#{name}' gem"
|
ohai "Installing or updating '#{name}' gem"
|
||||||
install_args = %W[--no-ri --no-rdoc #{name}]
|
install_args = %W[--no-ri --no-rdoc #{name}]
|
||||||
install_args << "--version" << version if version
|
install_args << "--version" << version if version
|
||||||
@ -233,6 +234,9 @@ module Homebrew
|
|||||||
odie "Failed to install/update the '#{name}' gem." if exit_code.nonzero?
|
odie "Failed to install/update the '#{name}' gem." if exit_code.nonzero?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def install_gem_setup_path!(name, version = nil, executable = name)
|
||||||
|
install_gem!(name, version)
|
||||||
|
|
||||||
return if which(executable)
|
return if which(executable)
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
The '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
|
The '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user