<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Multiple versions of ruby with stow</title>
	<atom:link href="http://www.mjwall.com/2008/08/multiple-versions-of-ruby-with-stow/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mjwall.com/2008/08/multiple-versions-of-ruby-with-stow/</link>
	<description>Just a guy and his computer</description>
	<pubDate>Wed, 07 Jan 2009 03:08:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Paul</title>
		<link>http://www.mjwall.com/2008/08/multiple-versions-of-ruby-with-stow/#comment-127</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Wed, 22 Oct 2008 22:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mjwall.com/?p=49#comment-127</guid>
		<description>Thanks. This was really helpful. I wrote this script to make switching easier:

	#!/usr/bin/env ruby

	require 'fileutils'

	stow_dir = '/usr/local/stow'
	ruby_bin = '/usr/local/bin/ruby'

	current = `ls -l #{ruby_bin}`
	current = current.match(/stow\/(ruby-.*)\/bin\/ruby/)[1]

	installed_versions = `ls #{stow_dir}`
	installed_versions = installed_versions.split "\n"
	installed_versions = installed_versions.select {&#124;x&#124; x =~ /^ruby.*/}

	puts "Current Ruby: #{current}"
	puts 'Which version of Ruby would you like to use?'
	installed_versions.each_with_index {&#124;version, index&#124; puts "#{index + 1}. #{version}"}
	puts '  (enter a number): '
	input = gets.chomp!
	input = input.to_i

	raise 'invalid input' if input == 0 &#124;&#124; input &#62; installed_versions.size

	new = installed_versions[input - 1]

	FileUtils.cd stow_dir
	`sudo stow -D #{current} &#38;&#38; sudo stow -R #{new}`

	result = `ls -l #{ruby_bin}`
	result = result.match(/stow\/(ruby-.*)\/bin\/ruby/)[1]
	puts "Switched to: #{result}"</description>
		<content:encoded><![CDATA[<p>Thanks. This was really helpful. I wrote this script to make switching easier:</p>
<p>	#!/usr/bin/env ruby</p>
<p>	require &#8216;fileutils&#8217;</p>
<p>	stow_dir = &#8216;/usr/local/stow&#8217;<br />
	ruby_bin = &#8216;/usr/local/bin/ruby&#8217;</p>
<p>	current = `ls -l #{ruby_bin}`<br />
	current = current.match(/stow\/(ruby-.*)\/bin\/ruby/)[1]</p>
<p>	installed_versions = `ls #{stow_dir}`<br />
	installed_versions = installed_versions.split &#8220;\n&#8221;<br />
	installed_versions = installed_versions.select {|x| x =~ /^ruby.*/}</p>
<p>	puts &#8220;Current Ruby: #{current}&#8221;<br />
	puts &#8216;Which version of Ruby would you like to use?&#8217;<br />
	installed_versions.each_with_index {|version, index| puts &#8220;#{index + 1}. #{version}&#8221;}<br />
	puts &#8216;  (enter a number): &#8216;<br />
	input = gets.chomp!<br />
	input = input.to_i</p>
<p>	raise &#8216;invalid input&#8217; if input == 0 || input &gt; installed_versions.size</p>
<p>	new = installed_versions[input - 1]</p>
<p>	FileUtils.cd stow_dir<br />
	`sudo stow -D #{current} &amp;&amp; sudo stow -R #{new}`</p>
<p>	result = `ls -l #{ruby_bin}`<br />
	result = result.match(/stow\/(ruby-.*)\/bin\/ruby/)[1]<br />
	puts &#8220;Switched to: #{result}&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
