diff --git a/share/install_gems/install_gems b/share/install_gems/install_gems index 9b1da6f65d..d0dd30ac98 100755 --- a/share/install_gems/install_gems +++ b/share/install_gems/install_gems @@ -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