<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ben Atkin&#039;s Self-Hosted Blog &#187; ruby</title>
	<atom:link href="http://benatkin.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://benatkin.com</link>
	<description>My true voice on the Internet.</description>
	<lastBuildDate>Wed, 23 May 2012 13:55:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Links: Parsing in Ruby and JavaScript</title>
		<link>http://benatkin.com/2011/12/01/parsing-in-ruby-and-javascript/</link>
		<comments>http://benatkin.com/2011/12/01/parsing-in-ruby-and-javascript/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 06:53:38 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[templating]]></category>

		<guid isPermaLink="false">http://benatkin.com/?p=1067</guid>
		<description><![CDATA[I&#8217;ve been reading quite a bit about parsing and templating in ruby as I attempt to port a templating engine from JavaScript to Ruby. Here are some scattered links: Jison Jison is a parser generator for JavaScript that has separate &#8230; <a href="http://benatkin.com/2011/12/01/parsing-in-ruby-and-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading quite a bit about parsing and templating in ruby as I attempt to port a templating engine from JavaScript to Ruby. Here are some scattered links:</p>
<h3>Jison</h3>
<p>Jison is a parser generator for JavaScript that has separate lex and bnf definitions. It&#8217;s used by <a href="https://github.com/wycats/handlebars.js/">Handlebars.js</a>.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/zaach/jison/">jison</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/zaach/">zaach</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2012-05-19</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">566</span></div><div class="resource-infobox-clear"></div></div>
<h3>Treetop</h3>
<p>Treetop is a parser generator for Ruby. It&#8217;s installed with Ruby On Rails, through the <code>mail</code> gem which is installed by ActionMailer.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/nathansobo/treetop/">treetop</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/nathansobo/">nathansobo</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2012-03-29</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">446</span></div><div class="resource-infobox-clear"></div></div>
<h3>Citrus</h3>
<p>Citrus is another promising parsing gem for Ruby. It seems to be very easy to get started with, and I like many of the design decisions.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/mjijackson/citrus/">citrus</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/mjijackson/">mjijackson</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2012-02-24</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">177</span></div><div class="resource-infobox-clear"></div></div>
<h3>Temple</h3>
<p>Temple is a templating-specific library that helps with a lot of the AST transformation. It doesn&#8217;t seem to have a CFG syntax so it seems that using treetop or citrus would make sense for complex grammars. Otherwise, strscan could be used.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/judofyr/temple/">temple</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/judofyr/">judofyr</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2012-02-26</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">155</span></div><div class="resource-infobox-clear"></div></div>
<h3>temple-mustache</h3>
<p>This is an implementation of a mustache renderer in . It uses strscan to generate the initial parse tree, and Temple to generate the ruby code. It supports mustache sections.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/minad/temple-mustache/">temple-mustache</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/minad/">minad</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2011-05-04</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">1</span></div><div class="resource-infobox-clear"></div></div>
<h3>Slim</h3>
<p>Slim is a Haml-like templating library for Ruby that&#8217;s used in production by many. It uses Temple, with a line-based parser, which works well because it uses significant indentation for nesting.</p>
<div class="resource-infobox"><div class="resource-infobox-field"><span class="resource-infobox-label">Repository</span><a class="resource-infobox-value" href="https://github.com/stonean/slim/">slim</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Owner</span><a class="resource-infobox-value" href="https://github.com/stonean/">stonean</a></div><div class="resource-infobox-field"><span class="resource-infobox-label">Last Commit</span><span class="resource-infobox-value">2012-05-22</span></div><div class="resource-infobox-field"><span class="resource-infobox-label">Watchers</span><span class="resource-infobox-value">1133</span></div><div class="resource-infobox-clear"></div></div>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2011/12/01/parsing-in-ruby-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting from Chrome&#8217;s History</title>
		<link>http://benatkin.com/2011/11/08/deleting-from-chromes-history/</link>
		<comments>http://benatkin.com/2011/11/08/deleting-from-chromes-history/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 08:27:33 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sequel]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://benatkin.com/?p=1034</guid>
		<description><![CDATA[I wrote a script to delete URLs containing a string from Chrome&#8217;s history. It works for me. I don&#8217;t understand everything that it does, though, so it may have serious flaws. Use at your own risk. I really like sqlite &#8230; <a href="http://benatkin.com/2011/11/08/deleting-from-chromes-history/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wrote a script to delete URLs containing a string from Chrome&#8217;s history. It works for me. I don&#8217;t understand everything that it does, though, so it may have serious flaws. Use at your own risk.</p>
<pre class="brush: ruby; title: ; notranslate">
# Removing history entries from Chrome that contain a search phrase
# Exit out of Chrome first
# Back up files and do this at your own risk

# gem install sqlite3 &amp;&amp; gem install sequel

require 'sequel'

search_string = 'reddit'

# Delete history cache files
path = File.expand_path('~/Library/Application Support/Google/Chrome/Default')
cache_dirs = Dir.entries(path).select {|dir| dir != 'History' &amp;&amp; dir.index('History') == 0}.map {|dir| File.join path, dir}
cache_dirs.each {|dir| File.delete dir}

# Delete matching history from sqlite3
DB = Sequel.sqlite File.join(path, 'History')
matching_urls = DB[:urls].filter(:url.like("%#{search_string}%"))
puts %Q[Deleting #{matching_urls.count} urls matching "#{search_string}"]
matching_urls.delete
</pre>
<p>I really like <a href="http://www.sqlite.org/">sqlite</a> and <a href="http://sequel.rubyforge.org/">Sequel</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2011/11/08/deleting-from-chromes-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resources for Learning Rails</title>
		<link>http://benatkin.com/2011/09/26/resources-for-learning-rails/</link>
		<comments>http://benatkin.com/2011/09/26/resources-for-learning-rails/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 03:21:04 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://benatkin.com/?p=947</guid>
		<description><![CDATA[Here is a list of a few awesome sites offering tools for learning Rails: PeepCode Pricing: Starts at $12 for one screencast; Twitter: @peepcode and @topfunky I bought my first PeepCode screencast back in 2008, before Rails and Merb merged. &#8230; <a href="http://benatkin.com/2011/09/26/resources-for-learning-rails/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a list of a few awesome sites offering tools for learning Rails:</p>
<h1><a href="http://peepcode.com/">PeepCode</a></h1>
<p><a href="http://peepcode.com/"><img src="http://benatkin.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-26-at-6.12.41-PM.png" alt="" title="Screen Shot 2011-09-26 at 6.12.41 PM" width="241" height="101" class="alignnone size-full wp-image-948"></a></p>
<p><em>Pricing:</em> Starts at $12 for one screencast; <em>Twitter</em>: <a href="http://twitter.com/peepcode">@peepcode</a> and <a href="http://twitter.com/topfunky">@topfunky</a></p>
<p>I bought my first PeepCode screencast back in 2008, before Rails and Merb merged. It&#8217;s been around for a while, but <a href="https://twitter.com/topfunky">Geoffrey Grosenbach</a> does a great job of keeping it up-to-date. There are now a number of screencasts about current topics of interest to the Ruby on Rails community, including <a href="http://rubyonrails.org/">Rails 3</a>, <a href="http://documentcloud.github.com/backbone/">Backbone.js</a>, <a href="http://www.postgresql.org/">PostgreSQL</a>, <a href="http://coffeescript.com/">CoffeeScript</a>, and <a href="http://www.jbarnette.com/">John Barnette</a>.</p>
<h1><a href="http://railscasts.com/">Railscasts</a></h1>
<p><a href="http://railscasts.com/"><img src="http://benatkin.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-26-at-6.31.31-PM.png" alt="" title="RailsCasts" width="432" height="69" class="alignnone size-full wp-image-949"></a></p>
<p><em>Pricing:</em> Free weekly episodes, additional weekly episodes and revised episodes for $9/mo (RailsCasts Pro); <em>Twitter: <a href="http://twitter.com/railscasts">@railscasts</a></em> </p>
<p><a href="http://railscasts.com/">Railscasts</a> is great for keeping up on Ruby On Rails, and because it&#8217;s free, it&#8217;s also great for recommending to people who are curious about Rails but not ready to spend money to help them learn it. <a href="https://twitter.com/#!/rbates">Ryan Bates</a> is great at explaining things. He covers a wide variety of topics in his screencasts and presents them in a nice format with code snippets.</p>
<p>Update: since I posted this Ryan Bates released <a href="http://railscasts.com/pro">Railscasts Pro</a>, which is fantastic!</p>
<h1><a href="http://ruby.railstutorial.org/">Ruby on Rails Tutorial</a></h1>
<p><a href="http://ruby.railstutorial.org/"><img src="http://benatkin.com/wp-content/uploads/2011/09/railstutorial.png" alt="" title="railstutorial" width="133" height="123" class="alignnone size-full wp-image-950"></a></p>
<p><em>Pricing:</em> $26 (book), $85 (screencasts), $95 (both); <em>Twitter: <a href="http://twitter.com/railstutorial">@railstutorial</a></em> </p>
<p><a href="http://www.michaelhartl.com/about">Michael Hartl</a> is a physicist who does a number of other things (see his about page) including Web Development with Ruby On Rails. I&#8217;ve watched all of his screencasts; they&#8217;re fantastic. He builds a web application TDD-style and teaches many different concepts including MVC and how TDD can help with authorization (which is trickier than authentication IMO).</p>
<h1><a href="http://railsapps.github.com/">Rails Apps</a></h1>
<p><a href="http://railsapps.github.com/"><img src="http://benatkin.com/wp-content/uploads/2011/09/rails_apps.png" alt="" title="rails_apps" width="127" height="133" class="alignnone size-full wp-image-951"></a></p>
<p><em>Pricing:</em> Free; <em>Twitter: <a href="http://twitter.com/rails_apps">@rails_apps</a></em> </p>
<p>I always thought that the <a href="https://github.com/thoughtbot/suspenders">Rails</a> <a href="https://github.com/quickleft/prologue">Starter</a> <a href="https://github.com/relevance/new-world-order">App</a> templates were cool, but they were missing something: <a href="https://github.com/railsapps/rails3-devise-rspec-cucumber/wiki/Tutorial">in-depth tutorials</a> and a <a href="http://railsapps.github.com/rails-examples-tutorials.html">comparison between the many different templates and quick-start tools</a>. <a href="http://danielkehoe.com/">Daniel Kehoe</a> has provided both and many more useful resources in his <a href="http://railsapps.github.com/">Rails Apps</a> GitHub account.</p>
<h1><a href="http://codeschool.com/">Code School</a></h1>
<p><a href="http://codeschool.com/"><img src="http://benatkin.com/wp-content/uploads/2011/09/code_school.png" alt="" title="code_school" width="325" height="81" class="alignnone size-full wp-image-952"></a></p>
<p><em>Pricing:</em> Free (one substantial free product), $45-55 (single paid products); <em>Twitter: <a href="http://twitter.com/codeschool">@codeschool</a></em> </p>
<p><a href="http://www.codeschool.com/">Code School</a> is a set of tutorials designed to help developers to quickly get up to speed building web applications. <a href="http://blog.envylabs.com/">Gregg Pollack</a> and <a href="http://envylabs.com/">Envy Labs</a> have been doing podcasts and screencasts for quite some time, and it&#8217;s not surprising that they still do it, because they&#8217;re very enthusiastic in front of a camera and a microphone.</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2011/09/26/resources-for-learning-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the one-line sinatra app</title>
		<link>http://benatkin.com/2009/05/03/the-one-line-sinatra-app/</link>
		<comments>http://benatkin.com/2009/05/03/the-one-line-sinatra-app/#comments</comments>
		<pubDate>Sun, 03 May 2009 17:23:56 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://benatkin.com/weblog/?p=324</guid>
		<description><![CDATA[The five-line sinatra app on http://www.sinatrarb.com/ is pretty damn impressive: require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end I can do four lines better than that, though: require 'sinatra' So what does that get you? batkin:cholla ben$ ruby &#8230; <a href="http://benatkin.com/2009/05/03/the-one-line-sinatra-app/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The five-line sinatra app on <a href="http://www.sinatrarb.com/">http://www.sinatrarb.com/</a> is pretty damn impressive:</p>
<pre class="prettyprint" style="border: none">require 'rubygems'
require 'sinatra'
get '/hi' do
  "Hello World!"
end</pre>
<p>I can do four lines better than that, though:</p>
<pre class="prettyprint" style="border: none">require 'sinatra'</pre>
<p>So what does that get you?</p>
<pre class="prettyprint" style="border: none">batkin:cholla ben$ ruby -rubygems cholla.rb
== Sinatra/0.9.0.4 has taken the stage on 4567 for development with backup from Thin
&gt;&gt; Thin web server (v1.0.0 codename That's What She Said)
&gt;&gt; Maximum connections set to 1024
&gt;&gt; Listening on 0.0.0.0:4567, CTRL+C to stop
127.0.0.1 - - [03/May/2009 10:13:46] "GET /index.html HTTP/1.1" 200 7 0.0019</pre>
<p><em>A basic http file server, perfect for working with plain html, javascript, and CSS!</em> Just create a <strong>public/</strong> directory alongside the one-line sinatra app, and have at it! If you create an <strong>index.html</strong> file in <strong>public/</strong>, it will be served up when you go to <a href="http://localhost:4567/">http://localhost:4567/</a>. Try it!</p>
<p>Once you decide to add some server-side code, you can simply go in to the sinatra app and add it.</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2009/05/03/the-one-line-sinatra-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practice</title>
		<link>http://benatkin.com/2009/02/28/practice/</link>
		<comments>http://benatkin.com/2009/02/28/practice/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 20:49:50 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[traveling]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.benatkin.com/weblog/?p=260</guid>
		<description><![CDATA[I just watched Corey Haines&#8217; lightning talk from this year&#8217;s acts_as_conference: He makes a lot of really good points in a short amount of time. One of the things he says is that if we have to look at documentation &#8230; <a href="http://benatkin.com/2009/02/28/practice/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just watched <a href="http://www.coreyhaines.com/">Corey Haines&#8217;</a> <a href="http://aac2009.confreaks.com/06-feb-2009-20-30-lightning-talk-under-your-fingers-corey-haines.html">lightning talk</a> from this year&#8217;s <a href="http://www.actsasconference.com/">acts_as_conference</a>:</p>
<p><embed src="http://aac2009.confreaks.com/player.swf" height="380" width="480" allowscriptaccess="always" allowfullscreen="true" flashvars="file=http%3A%2F%2Faac2009.confreaks.com%2Fvideos%2F06-feb-2009-20-30-lightning-talk-under-your-fingers-corey-haines-large.mp4&amp;state=COMPLETED&amp;plugins=viral-1"></embed></p>
<p>He makes a lot of really good points in a short amount of time. One of the things he says is that if we have to look at documentation for a technique, we&#8217;re unlikely to use that technique when we&#8217;re in a time crunch. I think this is a very good point. Another time when I might not use the documentation is when I&#8217;m just dabbling.</p>
<p>To learn things, he suggests doing arbitrary tasks repetitively to get them engrained into our minds.</p>
<p>I spent a number of hours doing arbitrary tasks with vim, and I&#8217;ve gotten pretty good at using vim IMHO. I wish I could say I was as good at jQuery, but I haven&#8217;t got it down as well despite doing real projects in it. I think perhaps it&#8217;s best that I pick an arbitrary task, or at least do a real, but small, task repetitively, or keep trying to improve it, until I start to really get the hang of it.</p>
<p>On a side note, Corey Haines&#8217; has quit working a regular job and started traveling around and pair programming with people in exchange for room and board. He calls himself a <a href="http://programmingtour.blogspot.com/">Software Journeyman</a>. It will be interesting to hear what he learns from the experience. I hope his journey takes him to Arizona at some point!</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2009/02/28/practice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Injecting a gem</title>
		<link>http://benatkin.com/2008/03/28/injecting-a-gem/</link>
		<comments>http://benatkin.com/2008/03/28/injecting-a-gem/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 05:24:48 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.benatkin.com/weblog/?p=82</guid>
		<description><![CDATA[When installing Merb on my laptop, which runs Ubuntu Linux, I ran into a compiler error with hpricot, one of Merb&#8217;s dependencies. Before bothering to see what might be causing it, I checked to see if there was a precompiled &#8230; <a href="http://benatkin.com/2008/03/28/injecting-a-gem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When installing Merb on my laptop, which runs Ubuntu Linux, I ran into a compiler error with hpricot, one of Merb&#8217;s dependencies. Before bothering to see what might be causing it, I checked to see if there was a precompiled apt-get package available. There was! I installed it and tried installing Merb again.</p>
<p>It still tried to install hpricot, however, and when I said to skip it, it said it could not install Merb because it was missing hpricot. I could have used force, or &#8220;pretty please&#8221;, but I wanted to instead tell the packaging system that I have hpricot installed.</p>
<p>I seem to remember a UNIX packaging system having an inject command &#8212; which tells the packaging system a program is already installed. I may have got the terminology wrong. I searched for such a command for rubygems but couldn&#8217;t find one. I did, however, find another way to convince rubygems that I already had hpricot.</p>
<p>I decided to do some digging in the gems directory. To find the gems directory, I typed:</p>
<blockquote>
<pre>ben@magicthise:~$ gem environment
RubyGems Environment:
  - VERSION: 0.9.4 (0.9.4)
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - GEM PATH:
     - /var/lib/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
ben@magicthise:~$ cd /var/lib/gems/1.8/
ben@magicthise:/var/lib/gems/1.8$ ls
bin  cache  doc  gems  source_cache  specifications
ben@magicthise:/var/lib/gems/1.8$ cd specifications/
ben@magicthise:/var/lib/gems/1.8/specifications$ ls
abstract-1.0.0.gemspec          merb-cache-0.9.2.gemspec
actionmailer-2.0.2.gemspec      merb-core-0.9.2.gemspec
...
ben@magicthise:/var/lib/gems/1.8/specifications$</pre>
</blockquote>
<p>I took a look at the gemspec files and found that they contained the name and version of the library. I copied the smallest of the files to hpricot-0.6.gemspec and used the <a href="http://rubygems.org/read/chapter/20">gemspec documentation</a> to find out which parameters are required. I wound up with the following in <em>/var/lib/gems/1.8/specifications/hpricot-1.6.rb</em>.</p>
<blockquote>
<pre class="prettyprint" style="border: none">Gem::Specification.new do |s|
  s.name = %q{hpricot}
  s.version = "0.6"
end</pre>
</blockquote>
<p>I tried running:</p>
<blockquote>
<pre>ben@magicthise:~$ gem install merb --include-dependencies</pre>
</blockquote>
<p>And it worked!</p>
<p>It might not be everything that&#8217;s needed to get it working &#8212; but now I at least know how to inject a package.</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2008/03/28/injecting-a-gem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby AST ramblings&#8230;</title>
		<link>http://benatkin.com/2007/04/19/ruby-ast/</link>
		<comments>http://benatkin.com/2007/04/19/ruby-ast/#comments</comments>
		<pubDate>Thu, 19 Apr 2007 23:33:10 +0000</pubDate>
		<dc:creator>Ben Atkin</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.benatkin.com/weblog/?p=68</guid>
		<description><![CDATA[I just read an article calling for a way to get an AST for Ruby code from within Ruby. I think it&#8217;s a great idea, and I think static analysis, code manipulation/refactoring are great reasons to support such a thing. &#8230; <a href="http://benatkin.com/2007/04/19/ruby-ast/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just read an <a href="http://jroller.com/page/murphee?entry=ruby_let_s_get_an">article calling for a way to get an AST for Ruby code from within Ruby</a>. I think it&#8217;s a great idea, and I think static analysis, code manipulation/refactoring are great reasons to support such a thing. Another consequence would be macros, which are a more controversial feature. The only downside I can think of is that it could be misused, and to leave out a feature for that reason would go against the Ruby philosophy, in my opinion. One of the regulars at the Phoenix Ruby Users&#8217; Group argued against using a dumbed-down &#8220;teaching language&#8221;, saying that when you suggest using a language you don&#8217;t want to use yourself, you&#8217;re talking down to the learner. I agree. I think the best way to keep people from misusing features is not to remove the features, but to educate them. People in the Ruby community have always done a good job of making sure there&#8217;s lots of good example code out there, and giving constructive criticism when someone posts a bad example.</p>
<p>While the reasons in the article are enough, I can think of another good reason for having AST support &#8212; having the ability to constrain code to a certain set of features. There would be two different uses for this:</p>
<ul>
<li>
<b>Running code from an untrusted source</b> &#8211; This could include web template designers, or even users. <a href="http://www.ning.com/">Ning</a> is an example of a site that lets users run their own code &#8212; but there is a huge overhead to facilitate this and to sandbox everything. If it could be verified that code doesn&#8217;t do anything dangerous, I think a new type of Web app plug-ins would emerge. Instead of having to set up an app on a separate site and use REST or SOAP to communicate, people could just throw together a little script in a domain-specific language. One idea I have for this sort of technology would be a Flickr for html and image generators (like <a href="http://www.ajaxload.info/">ajaxload.info</a>).</li>
<li>
<b>Enforcing decoupling</b> &#8211; When managing a large software project, I think it would nice to specify which classes do what, and have it enforced. Maybe there is some class that&#8217;s supposed to be all about math, but that goes in an application that gives output to users. To keep math programmers from putting presentation logic in mathematical code, you could constrain them to a DSL that doesn&#8217;t have strings. Or, you could keep template programmers from doing networking code. The check could be done at runtime, or commit time, with plug-ins to the version control system.</li>
</ul>
<p>There is a Perl library that parses Perl, but it would be nice to have one for Ruby that&#8217;s written in C and optimized for speed, and that with certainty matches up to what the interpreter understands.</p>
<p>I think that once an AST implementation was built, something like RSpec could be created which does compile-time or commit-time analysis. That would be cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://benatkin.com/2007/04/19/ruby-ast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

