9

I can't seem to find an easy way to identify the latest release of RVM from command line or rvm.beginrescueend.com!?!

I currently type rvm get latest every few days or so to update RVM. If version is same, RVM goes through the download & update process regardless. I'd like to be able to first 'see' if there's an update to get.

Anyone know how? I'm sure I'm missing the obvious...

4 Answers 4

14

you could use this one liner to check version:

$ curl -sS  https://api.github.com/repos/wayneeseguin/rvm/git/refs/tags | awk -F": |\"" '$2=="ref"{sub(/.*\//,"",$5); print $5}' | sort -V | tail -n 1
1.15.8

or a pure ruby one liner:

$ ruby -ropen-uri -rjson -e 'open("https://api.github.com/repos/wayneeseguin/rvm/git/refs/tags"){|r| puts JSON.parse(r.read).map{|l| l["ref"].gsub(/.*\//,"").split(".").map(&:to_i)}.sort.last.join(".") }'
1.15.8

but the simplest thing to do is:

$ curl https://raw.github.com/wayneeseguin/rvm/stable/VERSION
1.15.8
1
  • This is very useful. Now to conditionally update rvm, I do if [[ "$(rvm --version 2> /dev/null | awk '$2 != ""{print $2}')" != "$(curl https://raw.github.com/wayneeseguin/rvm/stable/VERSION 2> /dev/null)" ]]; then rvm get stable; fi
    – nroose
    Nov 22, 2013 at 2:49
5

Curl the rvm repository like this:

curl  https://raw.githubusercontent.com/rvm/rvm/master/VERSION
1

Ok, magic :) Place this into some .rb file :)

require 'open-uri'
require 'openssl'

regex = Regexp.new(/data-name="([0-9]+).([0-9]+).([0-9]+)"/)
f=open("https://github.com/wayneeseguin/rvm",:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
v = []
f.each_line do |l|
  regex.match(l) {|m| v << {:full => m[0], :major => m[1].to_i, :minor => m[2].to_i, :inc => m[3].to_i} }
end
v.sort_by{|m| [m[:major],m[:minor],m[:inc]] }
v=v.first
puts "#{v[:major]}.#{v[:minor]}.#{v[:inc]}"

I have no idea why I just did that.

3
  • Nice, I think!?! Didn't realize it would be this complicated!?! RVM needs an outdated command...
    – Meltemi
    Jun 9, 2011 at 18:21
  • Well, you asked for a way to find latest available RVM version, I wrote a script that parses Github project page for you ;) Aren't we godsent software developers who can create tools? With minimal changes you can use this script to get latest version for almost any other Github repository :)
    – Jake Jones
    Jun 9, 2011 at 19:34
  • 1
    @daekrist your script is complicated, you can do it easier gist.github.com/3546691
    – mpapis
    Aug 31, 2012 at 0:43
0

I used:

$ rvm get head && rvm reload

It ran fast and seemed to do the job. I had installed rvm the week before, rvm 1.15.5, and already there was a newer version, rvm 1.15.8.

This was recommended on:

The Ruby on Rails Tutorial by Michael Hartl http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-install_ruby

2
  • rvm get still performs installation while @Meltemi wants to just check for update. Oct 4, 2012 at 15:59
  • Takes 20 or 30 seconds for me.
    – nroose
    Nov 22, 2013 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.