1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

feature #914: update rubygems if version older than 1.3.6

This commit is contained in:
Javi Fontan 2011-12-23 10:14:58 -06:00
parent 8db6c0ed57
commit 16a1b24b82

View File

@ -90,6 +90,62 @@ class String
end
end
def good_gem_version?
v=`gem --version`.strip
version=Gem::Version.new(v)
version>=Gem::Version.new('1.3.6')
end
def install_rubygems
if !good_gem_version?
puts(<<-EOT.unindent())
The rubygems version installed is too old to install some required
libraries. We are about to update your rubygems version. If you
want to do this by other means cancel this installation with
CTRL+C now.
Press ENTER to continue...
EOT
STDIN.readline
`gem install rubygems-update --version '= 1.3.6'`
if $?.ecxitstatus!=0
puts "Error updating rubygems"
exit(-1)
end
update_rubygems_path=[
'/usr/bin/update_rubygems',
'/var/lib/gems/1.8/bin/update_rubygems',
'/var/lib/gems/1.9/bin/update_rubygems'
]
installed=false
update_rubygems_path.each do |path|
if File.exist?(path)
`#{path}`
if $?.exitstatus!=0
puts "Error executing update_rubygems"
exit(-1)
end
installed=true
break
end
end
if !installed
puts "Could not find update_rubygems executable"
exit(-1)
end
end
end
def installed_gems
text=`gem list --no-versions --no-details`
if $?.exitstatus!=0
@ -331,6 +387,7 @@ try_library :mkmf, <<-EOT.unindent
* Install the ruby development package for your distro
EOT
install_rubygems
command=''
params=ARGV