Replace sh() with sh_safe()

This commit is contained in:
Henrik Lissner 2014-06-18 15:51:08 -04:00
parent 31f535f2a6
commit a2cdbf26da

View file

@ -8,27 +8,27 @@ module Rbenv
def self.bootstrap def self.bootstrap
unless self.is_installed? unless self.is_installed?
BREWS.each { |pkg| Homebrew.install pkg } BREWS.each { |pkg| Homebrew.install pkg }
sh 'exec $SHELL -l' sh_safe 'exec $SHELL -l'
end end
end end
def self.destroy def self.destroy
if self.is_installed? if self.is_installed?
BREWS.each { |pkg| Homebrew.remove pkg } BREWS.each { |pkg| Homebrew.remove pkg }
# sh "rm -rf #{Homebrew.prefix 'rbenv'}" # sh_safe "rm -rf #{Homebrew.prefix 'rbenv'}"
end end
end end
def self.install(version, gems=[]) def self.install(version, gems=[])
unless self.is_version_installed?(version) unless self.is_version_installed?(version)
sh "rbenv install #{version}" sh_safe "rbenv install #{version}"
end end
sh "RBENV_VERSION=#{version} gem install #{gems.join(' ')}" sh_safe "RBENV_VERSION=#{version} gem install #{gems.join(' ')}"
end end
def self.update(version) def self.update(version)
sh "RBENV_VERSION=#{version} gem update" sh_safe "RBENV_VERSION=#{version} gem update"
sh "RBENV_VERSION=#{version} gem clean" sh_safe "RBENV_VERSION=#{version} gem clean"
end end
def self.is_installed? def self.is_installed?
@ -36,7 +36,7 @@ module Rbenv
end end
def self.is_version_installed?(version) def self.is_version_installed?(version)
system("rbenv versions | grep -w #{version}") system("rbenv versions | grep -w #{version} &>/dev/null")
end end
def self.installed_versions def self.installed_versions