Skip to content

Instantly share code, notes, and snippets.

@ehowe
Created January 13, 2012 15:41
Show Gist options
  • Save ehowe/1607028 to your computer and use it in GitHub Desktop.
Save ehowe/1607028 to your computer and use it in GitHub Desktop.
module ArshCommands
def self.rvm(command)
command = command.join(' ')
output = %x{bash -c "source #{ENV['HOME']}/.rvm/scripts/rvm; rvm #{command}; env | grep -i rvm"}
output.split("\n").select { |l| l[/=/] }.each do |n|
var, value = n.split(/=/,2)
ENV[var.upcase] = value
end
case command
when /^use /
puts "\e[32mUsing #{ENV['GEM_HOME']}\e[0m"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment