<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:ent="http://www.purl.org/NET/ENT/1.0/">
  <channel>
    <title>Curiouser and Curiouser! on iterm</title>
    <link>http://matt.blogs.it/</link>
    <description>RSS feed for topic iterm</description>
    <copyright>Copyright 2010 Matt Mower. Some rights reserved.</copyright>
    <generator>Squib/0.5.0.382</generator>
    <managingEditor>self@mattmower.com</managingEditor>
    <webMaster>self@mattmower.com</webMaster>
    <language>en-gb</language>
    <item>
      <title>Easy interaction with Ruby code</title>
      <link>http://matt.blogs.it/entries/00003019.html</link>
      <pubDate>Tue, 13 Jul 2010 11:22:33 +0100</pubDate>
      <description>&lt;p&gt;I really wanted to be able to interact with some Ruby code I was writing in a back and forth with TextMate. So I added this command as "Interact" (and bound to Cmd+Ctrl+R) to my Ruby bundle:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/ruby

require 'rubygems'
require 'appscript'

$TERM = Appscript::app( 'iTerm' )
$SESSION = $TERM.current_terminal.sessions.end.make( :new =&amp;gt; :session )
$SESSION.exec( :command =&amp;gt; 'bash -l' )
$SESSION.write( :text =&amp;gt; "/usr/bin/irb -r #{ENV['TM_FILEPATH']}" )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Since I use &lt;code&gt;iTerm&lt;/code&gt; and always have at least one window open what this does is to tell iTerm to spawn a new window with a bash shell and then execute IRB, requiring my code.&lt;/p&gt;

&lt;p&gt;The net result is that hitting Cmd+Ctrl+R gives me my code in an IRB session ready to test via the REPL.&lt;/p&gt;</description>
      <guid isPermaLink="true">http://matt.blogs.it/entries/00003019.html</guid>
      <ent:cloud ent:href="http://matt.blogs.it/topics/">
      </ent:cloud>
    </item>
  </channel>
</rss>
