<?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>Joey Beninghove&#039;s Blog</title>
	<atom:link href="http://lostechies.com/joeybeninghove/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/joeybeninghove</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Sat, 26 Mar 2011 02:43:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>It&#8217;s not goodbye&#8230;</title>
		<link>http://lostechies.com/joeybeninghove/2010/10/01/it-s-not-goodbye/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/10/01/it-s-not-goodbye/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 17:13:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[blogging]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/10/01/it-s-not-goodbye.aspx</guid>
		<description><![CDATA[Hey there folks, It&#8217;s a bittersweet moment for me, but the time has come for me to relaunch my personal blog/brand back under my own name. &#160;I truly appreciate everything Jason, Joe and everyone else in this community has done&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/10/01/it-s-not-goodbye/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hey there folks,</p>
<p>It&#8217;s a bittersweet moment for me, but the time has come for me to relaunch my personal blog/brand back under my own name. &nbsp;I truly appreciate everything Jason, Joe and everyone else in this community has done for me over the years. &nbsp;There are an awesome group of folks here in this community and I&#8217;ve enjoyed being a part of seeing it grow. &nbsp;I wish everyone here great success and I look forward to seeing where the donkey takes this community. &nbsp;:)</p>
<p>Of course thanks to the twitters and the interwebs, this isn&#8217;t goodbye&#8230; just a relocation or readdressing, if you will.</p>
<p>I&#8217;m still putting some final touches on things, but if you&#8217;re interested in following me at my new home:</p>
<ul>
<li><a href="http://joeybeninghove.com">joeybeninghove.com</a></li>
<li><a href="http://feeds.feedburner.com/joeybeninghove">joeybeninghove.com &#8211; feed</a></li>
</ul>
<div>Thanks everyone!</div>
</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/10/01/it-s-not-goodbye/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vlad, RVM and Bundler sittin&#8217; in a tree</title>
		<link>http://lostechies.com/joeybeninghove/2010/09/17/vlad-rvm-and-bundler-sittin-in-a-tree/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/09/17/vlad-rvm-and-bundler-sittin-in-a-tree/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 05:21:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[bundler]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[vlad the deployer]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/09/17/vlad-rvm-and-bundler-sittin-in-a-tree.aspx</guid>
		<description><![CDATA[(Thanks to Chad for nudging me to write this post Up until now, my only experience with deploying Rails or any other Ruby-based web application has been to use the &#8220;standard&#8221; Capistrano. &#160;For the main Rails 3 application I&#8217;ve been&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/09/17/vlad-rvm-and-bundler-sittin-in-a-tree/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img alt="Vlad the Deployer" style="float: right;margin: 20px" src="//lostechies.com/joeybeninghove/files/2011/03/deployed.png" />(Thanks to Chad for nudging me to write this post <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Up until now, my only experience with deploying Rails or any other Ruby-based web application<br />
has been to use the &#8220;standard&#8221; <a href="http://www.capify.org/index.php/Capistrano">Capistrano</a>. &nbsp;For the main Rails 3 application I&#8217;ve been building<br />
the past few months, Capistrano has been fine and was mostly a set it and forget it kinda thing.</p>
<p>One of my clients asked me to do a small side project to perform a simple task and naturally I chose<br />
the most excellent <a href="http://www.sinatrarb.com/">Sinatra</a> framework.  I could go on and on about the awesomeness of Sinatra, but that&#8217;s<br />
not the point of this post.  Suffice it to say when I finished this small Sinatra application, I needed to<br />
deploy it somehow.  Manual deployments are for the birds, so my first knee-jerk reaction was to get<br />
Capistrano wired up to do the automated deployment.  But after taking a glance at my existing Capistrano<br />
deployment script for my Rails 3 application, it seemed like overkill for this tiny Sinatra ditty.</p>
<p>The first alternative I ran across was a deployment tool named <a href="http://rubyhitsquad.com/Vlad_the_Deployer.html">Vlad the Deployer</a><br />
(which clearly gets an award for the best name ever).  What attracted me right off the bat was the simplicity of its usage<br />
and configuration.  I also liked the fact that it uses pure Rake for everything, instead of some of the<br />
&#8220;magic&#8221; that Capristrano does under the hood.  </p>
<p>Getting Vlad up and running is pretty straightforward, but I did have a couple issues getting it integrated<br />
into my particular deployment process.  Like all good Ruby developers 2 of my must use tools are <a href="http://rvm.beginrescueend.com">RVM</a><br />
&amp; <a href="http://gembundler.com">Bundler</a>. &nbsp;Bundler is great for managing gem dependencies and RVM keeps you sane when working with many different versions<br />
of Ruby and gems at the same time.  </p>
<p>One thing I like to do during deployments is make sure &#8220;bundle install&#8221; gets run on the server. &nbsp;This ensures that any new gems I&#8217;ve introduced in my Gemfile get automatically installed on the server<br />
during deployment.  Usually this wouldn&#8217;t be much of an issue, but I&#8217;m a pretty big fan of RVM, so much<br />
so that I actually run it on my staging/production servers as well.  RVM does some <em>serious</em> magic under<br />
the hood, including altering various environment variables affecting the path.  Here is the series of<br />
steps I had to take to get Vlad to properly run &#8220;bundle install&#8221; during deployment.  (NOTE: I&#8217;m mainly<br />
posting this to hopefully get feedback on a better way.  I really don&#8217;t like my solution too much.)</p>
<h2>Minor server preparation</h2>
<p>Before I show the deploy script itself, you do need to make sure your server is set up properly with<br />
RVM and Bundler installed in the global gemset.  Here are 2 great articles that describe this process:</p>
<ul>
<li><a href="http://www.thoughtsincomputation.com/posts/using-phusion-passenger-and-apache2-on-ubuntu-with-rvm-and-gemsets">Thoughts in Computation &#8211; Using Phusion Passenger and Apache2 on Ubuntu with RVM and Gemsets</a></li>
<li><a href="http://everydayrails.com/2010/09/13/rvm-project-gemsets.html">RVM and project-specific gemsets in Rails</a></li>
</ul>
<p>&nbsp;</p>
<p><a href="http://www.thoughtsincomputation.com/posts/using-phusion-passenger-and-apache2-on-ubuntu-with-rvm-and-gemsets"></a></p>
<h2>Extend Vlad&#8217;s update Rake task</h2>
<p>Since Vlad uses simple Rake tasks for everything, it&#8217;s easy to &#8220;tack on&#8221; steps before or after the<br />
built in Vlad tasks.  In this case I wanted to run my Bundler command right after the built in update<br />
process was complete.  Here&#8217;s one easy way to do that:</p>
</p>
<p>FYI, if you want to run something <em>before</em> the update process starts, you can simply add a dependency<br />
to the built in update task like so:</p>
</p>
<h2>Create a Bundler task</h2>
<p>Next I created a separate task (see next section about remote_task) to perform the Bundler command I<br />
needed to run on the server and invoked it inside of Vlad&#8217;s built in update task:</p>
</p>
<h2>Remotely running commands via SSH</h2>
<p>Before I show the commands necessary, it&#8217;s important to understand that all of this will be run in<br />
the context of an SSH session.  Thankfully, there was a nice feature of Vlad that was extracted out<br />
into its own gem known as <a href="http://github.com/seattlerb/rake-remote_task">remote_task</a>. &nbsp;This is a handy way to run Rake tasks in the context of remote<br />
servers and is used heavily under the hood with Vlad.  We&#8217;re also using it here for our custom Bundler<br />
task and a &#8220;run&#8221; method can be called with whatever commands you want to be run on the remote server in<br />
an SSH session.</p>
<h2>Step by step</h2>
<p>For clarity I put each command into its own local variable, each of which I&#8217;ll describe below.</p>
<h3>Initialize RVM</h3>
<p>When you login to a server via SSH, you have set of environment variables which include how paths<br />
are resolved when running commands.  Luckily, RVM takes care of all of that for us.  Usually when using<br />
RVM you simply <a href="http://rvm.beginrescueend.com/rvm/install">load it via your .bashrc</a>, but for some reason I couldn&#8217;t get this working in the<br />
context of the SSH session used as part of the remote_task.  I&#8217;m sure this is due to my lack of bash and<br />
*nix skills which I&#8217;m actively trying to beef up.  But to work around it for now, I just manually source<br />
the RVM bootstrap script myself:</p>
</p>
<h3>Trust your RVM gemset</h3>
<p>I&#8217;m not going to dive into <a href="http://rvm.beginrescueend.com/gemsets/basics">RVM gemsets</a> as part of this post, but just think of it as a way to manage gems<br />
in isolation from other applications and environments.  I like to use project-specific gemsets for everything<br />
I do to keep things nice and clean.  A nice companion to gemsets is the use of an <a href="http://rvm.beginrescueend.com/workflow/rvmrc">.rvmrc file</a> to<br />
automatically switch to the correct gemset when navigating to your application&#8217;s directory.  Creating a<br />
.rvmrc is stupidly simple:</p>
</p>
<p>Starting in <a href="http://wayneeseguin.beginrescueend.com/2010/08/22/ruby-environment-version-manager-rvm-1-0-0">version 1.0 of RVM</a>,<br />
there was a security measure put in place to force you to &#8220;trust&#8221; .rvmrc<br />
files when changing into a directory with a .rvmrc for the first time.  Normally this is fine, but it<br />
presented an issue in the context of an automated script.  This security measure can be disabled by this<br />
next command:</p>
</p>
<p>This tells RVM that I explicity trust the .rvmrc located in my release_path which is the root of my<br />
application on the server.</p>
<h3>Run bundle install &#8211; take 1</h3>
<p>With RVM all loaded up, we can now issue our bundle command to install any new dependencies if necessary.<br />
So naturally I tried the command below:</p>
</p>
<p>But this blew up in my face with a nasty exception:</p>
</p>
<h3>Run bundle install &#8211; take 2</h3>
<p>I had read somewhere previously (sorry, can&#8217;t remember exactly where) about sometimes needing to<br />
explicitly specify the target path for the &#8220;bundle install&#8221; command.  In this case I can just use<br />
the $BUNDLE_PATH environment variable that RVM manages for me:</p>
</p>
<p>This seems to fix the exception above, but I&#8217;ll be honest, I&#8217;m not exactly sure why yet.  (And yes,<br />
that does bug the heck out of me)</p>
<h2>Putting it all together</h2>
<p>Now that we have all of our commands ready to go, we can simply call the built in &#8220;run&#8221; method<br />
and pass in each command concatenated one after another:</p>
</p>
<p>If all is well, you should see a nice green message from Bundler saying your bundle is complete.</p>
<h2>&lt;/post&gt;</h2>
<p>As I mentioned before I&#8217;m not all that happy with this solution, as it seems like there is probably<br />
a better way to get Vlad, RVM and Bundler all working nicely together.  I&#8217;d be really interested<br />
to know of a better way.</p>
<p>Anyways, I hope this post benefits somebody in the future.  Even if it&#8217;s myself a year from now.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/09/17/vlad-rvm-and-bundler-sittin-in-a-tree/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>RVM, Bash Scripting and Rails 3 Edge</title>
		<link>http://lostechies.com/joeybeninghove/2010/07/19/rvm-bash-scripting-and-rails-3-edge/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/07/19/rvm-bash-scripting-and-rails-3-edge/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 20:34:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/07/19/rvm-bash-scripting-and-rails-3-edge.aspx</guid>
		<description><![CDATA[I&#8217;ve only begun to tap into the power of bash scripting, but I had a need to automate setting up a Rails 3 app on edge, using RVM like I want. &#160;So I decided to whip up a very simple&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/07/19/rvm-bash-scripting-and-rails-3-edge/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only begun to tap into the power of bash scripting, but I had a need to automate setting up a Rails 3 app on edge, using <a href="http://rvm.beginrescueend.com/">RVM</a> like I want. &nbsp;So I decided to whip up a very simple script that does the following for the name of app you&#8217;re creating:</p>
<ol>
<li>Creates a new <a href="http://rvm.beginrescueend.com/gemsets/basics/">RVM gemset</a> for the app</li>
<li>Creates a directory for the app</li>
<li>Creates an <a href="http://rvm.beginrescueend.com/workflow/rvmrc/">.rvmrc</a> file under the new app directory to ensure the proper gemset is used whenever you switch to it
<ol>
<li>Note: This assumes you have <a href="http://www.rubyenterpriseedition.com/">REE 1.8.7</a> installed under rvm (rvm install ree), which is the main ruby I&#8217;m still using for everything</li>
</ol>
</li>
<li>Installs latest prerelease of <a href="http://github.com/carlhuda/bundler">bundler</a></li>
<li>Installs latest <strong><a href="http://github.com/rails/rails">edge</a></strong><a href="http://github.com/rails/rails"> version of rails 3</a></li>
</ol>
<div>Here&#8217;s the bash script:</div>
</p>
<div>What this quickly gives you is a new Rails 3 app running on edge, with everything installed in its own RVM gemset to keep from polluting the rest of your ruby environments or applications.</div>
<div></div>
<div>Of course I&#8217;m no bash expert, so I&#8217;d love to hear any improvements or other bash scripting-fu you guys are doing.</div>
<p>&nbsp;</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/07/19/rvm-bash-scripting-and-rails-3-edge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSX Terminal Automation</title>
		<link>http://lostechies.com/joeybeninghove/2010/07/17/quick-tip-osx-terminal-automation/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/07/17/quick-tip-osx-terminal-automation/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 01:42:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[automation]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/07/16/quick-tip-osx-terminal-automation.aspx</guid>
		<description><![CDATA[My OSX Terminal Environment (as of today) Some of this might be old hat for a lot of you, but maybe this will help at least a few people. &#160;I&#8217;m a pretty big automation addict. &#160;During my Ruby on Rails&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/07/17/quick-tip-osx-terminal-automation/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>My OSX Terminal Environment (as of today)</h2>
<p>Some of this might be old hat for a lot of you, but maybe this will help at least a few people. &nbsp;I&#8217;m a pretty big automation addict. &nbsp;During my Ruby on Rails work, I find myself opening up the same set of terminal windows, positioned in the same way, running the same commands&#8230;all the time. &nbsp;I typically keep at least 3 OSX terminal windows open (some with multiple tabs). &nbsp;But when I sit down to start working with nothing open yet, I usually keep 2 terminal windows tiled to the left, 1 on top of another. &nbsp;</p>
<p>The top one I usually use for most filesystem and git operations. &nbsp;I also use this one to open other tabs for running things like <strong>rails console</strong> or a mongodb console if necessary.</p>
<p>The bottom one I usually have <a title="rstakeout" href="http://github.com/EdvardM/rstakeout">rstakeout</a>&nbsp;running in the background to run my specs or cucumber scenarios automatically. &nbsp;</p>
<p>Then I keep a third terminal window open, tiled to the right at full height running <strong>rails server</strong> in one tab and <strong>compass watch</strong> in another tab.</p>
<h2>Automating It</h2>
<p>First step is to set up specific terminal settings for each window/tab based on how you want them to behave when they start. &nbsp;Here is an example of a basic terminal that changes to the directory I want when started.</p>
<div class="thumbnail"><a href="http://skitch.com/joeybeninghove/dc63t/vk-terminal"><img src="http://img.skitch.com/20100717-gctbsrtgdgnr7trkbj8cnsrsc8.preview.jpg" alt="vk_terminal" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial;font-size: 10px;color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And here is a separate terminal setting for automatically starting Compass when the terminal session is started.</p>
<div class="thumbnail"><a href="http://skitch.com/joeybeninghove/dc63u/terminal-compass"><img src="http://img.skitch.com/20100717-tdmp8wg87144u1m2sk13u5qc8b.preview.jpg" alt="terminal_compass" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial;font-size: 10px;color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And here is a another one for autostarting the rails server when the terminal session is started.</p>
<div class="thumbnail"><a href="http://skitch.com/joeybeninghove/dc63w/terminal-rails-server"><img src="http://img.skitch.com/20100717-mdrfd9mkcibex98uuii4x4wppd.preview.jpg" alt="terminal_rails_server" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial;font-size: 10px;color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>Now, all these can easily be combined into a &#8216;Windows Group&#8217; that can be opened by the OSX Terminal in one shot, opening multiple terminal windows/tabs all at once using separate terminal settings. &nbsp;Just open the terminal windows/tabs and position them how you like them, then just save it as a window group.</p>
<div class="thumbnail"><a href="http://skitch.com/joeybeninghove/dc64a/terminal-windows-group"><img alt="terminal_windows_group" src="http://img.skitch.com/20100717-km1acfs75w7ix6epmhqt8ma4u3.preview.jpg" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial;font-size: 10px;color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>Here&#8217;s a quick video of a window group in action:</p>
</p>
<p><a href="http://vimeo.com/13406868">My OSX Terminal Environment</a> from <a href="http://vimeo.com/user3814096">Joey Beninghove</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>As you can see, I can get my entire terminal environment up and running with a single command. &nbsp;(Even better when I can use the fabulous <a title="ViKing" href="http://www.vikingapp.com">ViKing</a> app by Kevin Colyar to navigate the OSX menus using Vim bindings!)</p>
<h2>Wrap Up</h2>
<p>In case you&#8217;re wondering which OSX terminal theme I&#8217;m using, it&#8217;s my own tweaked version of <a title="IR_Black" href="http://blog.infinitered.com/entries/show/6">IR_Black</a> which I really like. &nbsp;Also, if you want to try out my terminal settings directly, I&#8217;ve exported the terminal settings files and the window grouping and pushed them up to my<a title="terminal" href="http://github.com/joeybeninghove/terminal"> terminal repo on GitHub</a>. &nbsp;Also I&#8217;d LOVE to hear other tips on how you&#8217;re automating your development environments, specifically in OSX!</p>
<p>Happy Automating!</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/07/17/quick-tip-osx-terminal-automation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting plugged into Ruby</title>
		<link>http://lostechies.com/joeybeninghove/2010/06/26/getting-plugged-into-ruby/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/06/26/getting-plugged-into-ruby/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 03:28:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[podcasts]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[screencasts]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/06/26/getting-plugged-into-ruby.aspx</guid>
		<description><![CDATA[Brad Mead asked a question on my previous post about my favorite community hang outs, lists, sites, etc. Instead of posting a long comment reply, I decided to turn it into a post of its own. If you don&#8217;t like&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/06/26/getting-plugged-into-ruby/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Brad Mead asked a question on my <a href="/blogs/joeydotnet/archive/2010/06/23/from-alt-net-to-not-net.aspx">previous<br />
post</a><br />
about my favorite community hang outs, lists, sites, etc.  Instead of posting a long comment reply, I decided to turn it<br />
into a post of its own.</p>
<p>If you don&#8217;t like link posts, then you might want to skip this one.  But I always end up<br />
picking up a couple things from other folks that share their online resources, so maybe this will do that for someone else<br />
too.  This post is kinda aimed at corporate-ish developers that maybe aren&#8217;t already plugged in too much.  For the rest<br />
of you, a lot of this might just be obvious.</p>
<h2>Blogs</h2>
<p>I don&#8217;t follow too many individual bloggers.  In fact, I actually don&#8217;t read that many blogs at all these days.  But the<br />
ones I do check occassionally are usually aggregate blogs that give me a pretty good sense of what&#8217;s going on in the<br />
world of Ruby.</p>
<ul>
<li><a href="http://www.rubyinside.com">Ruby Inside</a></li>
<li><a href="http://www.railsinside.com">Rails Inside</a></li>
<li><a href="http://rubyflow.com">Ruby Flow</a></li>
<li><a href="http://railsdispatch.com">Rails Dispatch</a> &#8211; Just &#8217;cause there are some great Rails 3 articles</li>
<li>many, many more out there, but that&#8217;s just a few</li>
</ul>
<h2>Screencasts</h2>
<p>I&#8217;m a big fan of screencasts.  I tend to learn quite a bit from watching other people write code.  Maybe you do too.</p>
<ul>
<li><a href="http://peepcode.com">Peepcode</a> $$ &#8211; THE place to get your Ruby screencast fix (I&#8217;ve got a full subscription)</li>
<li><a href="http://tekpub.com">Tekpub</a> $$ &#8211; Pretty good series on building your own blog in Rails and a Rack screencast</li>
<li><a href="http://rubyonrails.org/screencasts/rails3">Gregg Pollack&#8217;s Rails 3 Screencasts</a></li>
<li><a href="http://www.rubypulse.com">RubyPulse</a> &#8211; Nice, short ruby screencasts</li>
<li><a href="http://railscasts.com">Railscasts</a> &#8211; Nice, short rails screencasts</li>
<li><a href="http://raleighrb.com">raleigh.rb videos</a> &#8211; Videos of user group talks from Raleigh</li>
<li><a href="http://sdruby.org/podcast">SD Ruby videos</a> &#8211; More good videos of user group talks in San Deigo</li>
<li><a href="http://vimcasts.org">Vimcasts</a> &#8211; Not Ruby related, but had to get my Vim plug in somehow&#8230; <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<h2>Podcasts</h2>
<p>Considering I work at home nearly 100% of the time (with the exception an occasional nomading trip to Starbucks), I<br />
don&#8217;t get much driving time to listen to podcasts.  But I manage to squeeze in some time during my trips to Chipotle and late at<br />
night to listen to a few.  Here are some of the Ruby/OSS related ones.</p>
<ul>
<li><a href="http://thechangelog.com">The Changelog</a></li>
<li><a href="http://5by5.tv/devshow">The Dev Show</a></li>
<li><a href="http://5by5.tv/rubyshow">The Ruby Show</a></li>
<li><a href="http://podcast.rubyonrails.org">Ruby on Rails Podcast</a></li>
<li><a href="http://ruby5.envylabs.com">Ruby5</a></li>
</ul>
<h2>Github</h2>
<p>You&#8217;ll want to get very familiar with GitHub and the community surrounding it.  Since who/what you follow largely<br />
depends on what specific gems or frameworks you&#8217;re using, I won&#8217;t list specific ones here.  But suffice it to say, that<br />
GitHub plays a huge role in bringing the Ruby community together.  Git wit it!</p>
<h2>IRC/Mailing Lists</h2>
<p>I&#8217;m grouping these two together since they tend to go hand in hand.  Once you start using a particular Ruby<br />
gem/framework out there, you&#8217;ll usually find they have an associated mailing list and/or IRC channel.  I like to use<br />
mailing lists mostly for learning interesting tidbits from other people&#8217;s questions and throwing out the occasional<br />
question myself.  IRC is great when you need to get some help (or give some help) in a &#8216;just in time&#8217; type of way.  I<br />
know I mentioned it in my previous post, but it is quite amazing how helpful the folks in the Ruby and open source<br />
communities can be.  Even for newbies like me&#8230; <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Conferences</h2>
<p>I&#8217;ve yet to go to a Ruby-related conference, but hopefully I&#8217;ll make it to one sometime soon.  Probably the best way to<br />
find these is just to <a href="http://www.google.com/search?client=safari&amp;rls=en&amp;q=ruby+conferences&amp;ie=UTF-8&amp;oe=UTF-8">google for<br />
them</a>.</p>
<h2>User Groups</h2>
<p>If you can&#8217;t make it to a conference, perhaps look for (or start) a Ruby users group in your area.  I&#8217;ve started<br />
attending our local <a href="http://cvreg.org">CVREG</a> group and it&#8217;s been great.  I&#8217;ve met some great folks so far and<br />
hope to get much more involved in the local Ruby community.</p>
<h2>Twitter</h2>
<p>I admit that a lot of my community interaction does happen over Twitter.  I went through my followers and created a<br />
<a href="http://twitter.com/joeybeninghove/ruby">Ruby list</a> which you can follow if you&#8217;re interested in some of the Ruby folks<br />
I follow.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/06/26/getting-plugged-into-ruby/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>From ALT.NET to NOT.NET</title>
		<link>http://lostechies.com/joeybeninghove/2010/06/23/from-alt-net-to-not-net/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/06/23/from-alt-net-to-not-net/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 15:44:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[alt.net]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[microprenuer]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/06/23/from-alt-net-to-not-net.aspx</guid>
		<description><![CDATA[For a long time now I&#8217;ve been known as &#8220;joeyDotNet&#8221;. Of course I&#8217;ll never make the mistake tying my name to a particular technology like that again. Especially given some of the recent changes I&#8217;ve made in my career. For&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/06/23/from-alt-net-to-not-net/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For a long time now I&#8217;ve been known as &#8220;joeyDotNet&#8221;.  Of course I&#8217;ll never make the mistake tying my name to a<br />
particular technology like that again.  Especially given some of the recent changes I&#8217;ve made in my career.  For the<br />
past 10 years I&#8217;ve been primarily a web developer using Microsoft-based technologies.  In the latter years I started<br />
to grow pretty frustrated with both the Microsoft development stacks as well as their operating systems.  The ALT.NET<br />
&#8220;movement&#8221; helped a little, but for me, the bloat of the development tools and ceremony required in the languages<br />
overshadowed the well-intentioned ALT.NET efforts.  Of course this is merely my own personal opinion.</p>
<p>A couple months ago I made a pretty big change by leaving .NET completely to start focusing on learning and building<br />
software using tools and frameworks that I enjoy and involve less friction.  But instead of hearing me whine about my<br />
specific issues with .NET development, I thought maybe I would give a glimpse into my experience so far as I&#8217;ve become<br />
part of the NOT.NET crowd.</p>
<p>Perhaps I&#8217;m a glutton for punishment, but I find that in order to really learn something, I have to throw myself into<br />
the lake and basically sink or swim.  That&#8217;s pretty much what I&#8217;ve done by leaving .NET into the world of Ruby.<br />
Today marks exactly 2 months that I&#8217;ve been working exclusively with Ruby/Rails and I have to say it has been a very<br />
enjoyable experience so far (and frustrating at a few times).  I&#8217;ve dabbled with the Ruby language and with Rails a bit<br />
over the past couple years, so I had an idea of what I was getting into.  Doing it 100% day in/out is a completely<br />
different story though.  But at this point, I&#8217;m not looking back a bit.</p>
<h2>Good</h2>
<h3>Operating systems are cool again</h3>
<p>One of things I&#8217;ve very much enjoyed is being able to completely ditch Windows as an operating system in favor of using<br />
my MacBook Pro with OSX for everything.  It&#8217;s no secret that I&#8217;m a pretty big Apple fan, and I think, for good reason.<br />
The simplicity of the OS and the top notch software that is available for OSX makes the actual usage of the various<br />
design and development tools fun and productive again.</p>
<h3>Simple tools, less friction</h3>
<p>Since I&#8217;m a huge fan of Vim, I&#8217;m naturally using MacVim as my main editor, along with a few Terminal windows and a browser.<br />
That&#8217;s it.  No fancy IDEs or designers to get in my way.  Just code.  I am using a couple Vim plugins to allow better<br />
navigation around the code.  <a href="http://www.vim.org/scripts/script.php?script_id=1658">NERDTree</a> and<br />
<a href="http://www.vim.org/scripts/script.php?script_id=3025">Command-T</a> which I would highly recommend.  I&#8217;ve also jumped head<br />
first into Git as my primary source control and I continue to be very happy with that decision.  All those years wasted<br />
on Subversion, which incidentally performs subversive acts on the instituion of actually getting things done!</p>
<h3>Doing more with less</h3>
<p>One of the common themes I&#8217;ve found so far in working with Ruby in general and Rails in particular is how much work you<br />
can actually get done with so little code/effort.  In 2 months time I&#8217;ve been able to build a fairly sizable greenfield<br />
Rails app from the ground up and almost ready for the first production deployment next week.  All while I do a TON of<br />
learning in the process.  I have no clue how long<br />
this would&#8217;ve taken me in .NET, but I&#8217;m certain it would have been significantly longer.  Once you don&#8217;t have to deal<br />
with IDEs, solutions, project files, unnecessarily complex build scripts, high-ceremony languages or even compilation,<br />
you really start to realize how much overhead all of that stuff adds, preventing you from getting real work done, fast!</p>
<h3>Buh-bye IoC containers</h3>
<p>In my experience with C# over the years, it became apparent to me that in order to be productive in building flexible<br />
software in .NET that the use of an IoC container to handle dependency resolution was pretty much required.  And I<br />
totally bought into it, using them heavily for many years.  And for the most part, I think it was a good idea.  However<br />
I will freely admit that a lot of my usage of them was to enable mocking and easier testing.  I think if a lot of<br />
developers were honest about it, they&#8217;d say the same thing.  That&#8217;s not to say that&#8217;s the only reason of course.  IoC<br />
has its place in doing some crazy stuff with decorators/proxies and all kinds of other useful jazz.<br />
Contrast that with Ruby and I can honestly say I have not missed IoC containers one bit.  Being able to work in a much<br />
more open language has been a joy.  Composition over Inheritance is the real deal in Ruby and it&#8217;s being demonstrated<br />
more and more in frameworks like Rails 3 and Mongoid.  Being able to open up and extend any class in Ruby is also<br />
extremely powerful (and dangerous!).</p>
<h3>Feeling the love</h3>
<p>Perhaps one of the more feel-good things about working with open technologies like Ruby is the community.  I honestly<br />
have never experienced a community who is more willing to help out with <em>anything</em> like I&#8217;ve seen in the Ruby community<br />
so far.  I&#8217;ve made a great many friends so far and hope that I can start contributing back to the community once I get<br />
my head above water.  Open source in the .NET world has grown a bit over the years, but it still seems light years away<br />
from the Ruby and related communities.  And I&#8217;m not sure why, but I can&#8217;t help but think it has something to do with a certain corporate<br />
entity behind .NET.</p>
<h3>Making dreams come true</h3>
<p>For quite a few years now I&#8217;ve had an increasing urge to go &#8220;out on my own&#8221; and be &#8220;independent&#8221;.  More specifically<br />
I&#8217;ve dreamed for a long time now about making a living by building my own software. A<br />
<a href="http://www.micropreneur.com">Microprenuer</a>, if you will.<br />
But the whole time I pretty much knew there is absolutely NO way I would build my own software products using Microsoft<br />
technology.  In my opinion technologies like Rails, Node.js and MongoDB are much better suited to building next generation<br />
web applications than anything on the Microsoft stack right now.  I&#8217;m sure many will differ with that opinion, but<br />
that&#8217;s just how I see it.  So in order to move closer to my dreams and goals, I knew I would have to move away from the<br />
Microsoft world at some point.  I&#8217;ll always wish I had done it sooner, but with Rails 3 getting ready to &#8220;ship&#8221; it seems<br />
like a great time to be focusing my efforts there.</p>
<h2>Bad</h2>
<h3>Becoming one with the *nix</h3>
<p>I admit it.  Early on, it has been tough to get up to speed on the <em>nix tools and setting up Linux servers, etc.  I&#8217;ve<br />
always been a pretty big command line junkie.  But I&#8217;ve learned that being a *Windows</em> command line dude is a whole lot<br />
different than sitting down at a Bash shell for the Linux slice you just bought and now need to get setup with a full<br />
Rails stack.  Nevertheless, I&#8217;ve forced my way through it thanks to the interwebs and honestly in great part due to the<br />
great articles over on <a href="http://articles.slicehost.com">Slicehost</a>.  I still have a lot more to learn, but I&#8217;m starting<br />
to realize that those crazy bearded Linux heads are onto something.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Living on the edge</h3>
<p>In accordance with my sink or swim style, I decided to jump on the edge of quite a few things including Rails 3 beta<br />
and all of the associated &#8220;pre&#8221; gems for testing, persistence and others.  That has been painful at times.  Sometimes it<br />
takes you a little bit to troubleshoot a huge stack trace of errors to find an issue with an incompatible gem.  Lots of<br />
times it was fixed by just updating the gem or actually applying specific patches.  All in all, it hasn&#8217;t been too bad<br />
though and it has forced me to dig into the actual code of the frameworks I&#8217;m using which has only increased my learning<br />
of the Ruby language and certain patterns used in the language.</p>
<h2>Ugly</h2>
<p>Well about the only thing ugly so far is probably some of my Ruby code.  I&#8217;ve hit a few roadblocks here and there<br />
because of my lack of some of the advanced capabilities of Ruby as a language.  And sometimes I&#8217;ve had to just get it<br />
working and move on until I get more proficient with Ruby.  Often times I just &#8220;know&#8221; that there is a better way to do a<br />
particular thing, even if I don&#8217;t know exactly what that way is.  Like anything else, I&#8217;m sure I&#8217;ll come back a month<br />
later, a year later and throw up a little in my mouth when I see some of the Ruby I&#8217;m writing.  But I&#8217;m down with the<br />
continuous improvement lifestyle, so I&#8217;ll just keeping moving forward.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Well this was basically a stream of consciousness post, but perhaps it will give some insight into the life of a fellow<br />
geek that is striving to reinvent his career.  </p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/06/23/from-alt-net-to-not-net/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Quick Fix (and a question): Mongoid Edge</title>
		<link>http://lostechies.com/joeybeninghove/2010/06/10/quick-fix-and-a-question-mongoid-edge/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/06/10/quick-fix-and-a-question-mongoid-edge/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 15:44:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[mongodb]]></category>
		<category><![CDATA[mongoid]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/06/10/quick-fix-and-a-question-mongoid-edge.aspx</guid>
		<description><![CDATA[I just went throught the process of upgrading my current app to the latest edge for Rails 3, Mongoid and all of my other gems. And when I went to run my specs, I received this error: Database command 'drop'&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/06/10/quick-fix-and-a-question-mongoid-edge/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just went throught the process of upgrading my current app to the latest edge for Rails 3, Mongoid and all of my other<br />
gems.  And when I went to run my specs, I received this error:</p>
<pre>    Database command 'drop' failed: {"ns"=&gt;"your_db.system.indexes", "errmsg"=&gt;"assertion: can't drop system ns", "ok"=&gt;0.0}
</pre>
<p>The only time a drop is called is in my <strong>spec_helper.rb</strong> file:</p>
<p><strong>/spec/spec_helper.rb</strong></p>
<pre>    Rspec.configure do |config|
      # other config stuff here

      config.before(:each) do
        Mongoid.master.collections.each(&amp;:drop)
      end
    end
</pre>
<p>What that block does is drop all of my Mongoid collections before each spec is run to ensure I have a &#8220;known state&#8221; for<br />
my specs.  This has always worked just fine as is, but it appears that something has changed in the latest Mongoid<br />
causing it to error on attempting to drop &#8220;system.indexes&#8221;.  After some tinkering, this is how I resolved it:</p>
<p><strong>/spec/spec_helper.rb</strong></p>
<pre>    Rspec.configure do |config|
      # other config stuff here

      config.before(:each) do
        Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&amp;:drop)
      end
    end
</pre>
<p>Simple fix, but it gets the job done.  I just simply exclude &#8220;system.indexes&#8221; from the collections to drop and all is<br />
well.  Since this is only for my tests, I think this should be fine.  But&#8230;</p>
<p>I want to know if anyone else knows <em>why</em> this is happening and if there is a better way to resolve it.  Anyone?</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/06/10/quick-fix-and-a-question-mongoid-edge/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cucumber, A Brief Overview</title>
		<link>http://lostechies.com/joeybeninghove/2010/06/01/cucumber/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/06/01/cucumber/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 18:30:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/06/01/cucumber.aspx</guid>
		<description><![CDATA[Cucumber I&#8217;ve found Cucumber to be a pretty nice way of doing high level acceptance/integration testing. It&#8217;s also the first time I&#8217;ve ever thought that ATDD (acceptance test driven development) is actually achievable. The idea is that you write your&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/06/01/cucumber/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Cucumber</h2>
<p>I&#8217;ve found <a href="http://cukes.info">Cucumber</a> to be a pretty nice way of doing<br />
high level acceptance/integration testing.  It&#8217;s also the first time I&#8217;ve ever thought that ATDD (acceptance test driven<br />
development) is actually achievable.  The idea is that you write your &#8220;stories&#8221; in plain english, preferrably<br />
with your client/customer/product owner using the given/when/then style of syntax.  Once written, these stories can be<br />
run through the Cucumber framework where it is parsed and coupled with custom ruby code (some of which you have to<br />
write) to essentially give you executable specifications.  Of all the attempts I&#8217;ve seen out there to achieve ATDD and<br />
executable specifications, Cucumber really seems to have it nailed the best so far.  Writing the stories does take some<br />
getting used to as you do somewhat have to learn to speak the &#8220;language&#8221; of Cucumber.  But after writing your first<br />
couple &#8220;features&#8221;, as Cucumber calls them, you pretty much get the hang of it.</p>
<p><strong>Example</strong></p>
<p>Here is an example of what a Cucumber feature looks like.</p>
<p><strong>/features/users/add_new_user.feature</strong>  </p>
<pre>Feature: Add new user
    In order to allow a new user to access the system
    As an admin
    I want to add a new user to the system

    Scenario: New link is clicked from the users page
        Given I am logged in as an admin
        And I am on the users page
        When I follow "New"
        Then I should be on the new user page

    Scenario Outline: Required text fields are blank 
        Given I am logged in as an admin
        And I am on the new user page
        When I fill in "" for ""
        And I press "Save"
        Then I should see an error for ""

        Examples:
            | field_name |
            | First name |
            | Last name  |
            | Email      |
            | Password   |
</pre>
<p>The first section under the feature name is simply text to describe the feature in a typical As a/I want to/So that<br />
format.  That text is for display purposes only and is not used during execution.</p>
<p>Next comes the scenarios which <strong>are</strong> executed when run through Cucumber.  The first scenario simply verifies that<br />
when a link named &#8220;New&#8221; is clicked from the main users page, that it takes you to the &#8220;New User&#8221; page.  This is a pretty<br />
simple one, but it&#8217;s nice to have some of these as kind of smoke tests.  </p>
<p>The second one is interesting in that it acts as an outline to keep your cucumber features DRY.  If there is one thing<br />
you&#8217;ll notice about the Ruby/Rails community and the tools/frameworks used is that there is an extreme emphasis on<br />
keeping things DRY, which I love.  What this outline does is use tokens in the actual scenario steps, then specify a<br />
simple table representation that is used to plug in each &#8220;example&#8221; value when the scenario is run.  So this scenario<br />
outline actually gets run 4 different times, once with each value for  listed.  The closest parallel I can<br />
think of in .NET land is RowTests with MBUnit, but I&#8217;m sure there are others such as Fitness, which I haven&#8217;t used too<br />
much.</p>
<p>I&#8217;ve used Cucumber to drive out almost every feature so far in this Rails app I&#8217;m building.  And I can definitely<br />
say it&#8217;s been worth it.  Especially when I go to update my gems to a new version or even try out the edge version<br />
straight from the Git repo.  I&#8217;ve been able to lean on my Cucumber features to give me a nice sense at a high level<br />
as to the health of my application from the user&#8217;s point of view.</p>
<h2>Great, so how does all this work?</h2>
<p>Under the hood, Cucumber is actually spinning up the Rails app, opening the pages you tell it and clicking links and<br />
filling out text fields on the actual page.  It does this using a web testing framework such as Capybara or Webrat.<br />
Each one comes with a set of pre-defined steps that you can use to cover a lot of the common actions you need to do<br />
on a web page such as clicking links/buttons, filling out forms and inspecting the content on the page using css or<br />
xpath helpers.  Capybara seems to be taking over Webrat&#8217;s long rule in this space and is the default option when<br />
getting Cucumber set up.  There is also the ability to test javascript/AJAX using Capybara with either EnvJs or<br />
Culerity/Celerity.  Unfortunately I haven&#8217;t been able to get this working yet, but I plan to very soon because<br />
I&#8217;m already starting to build some non-trival client side stuff now that I&#8217;d really like to get some automated<br />
tests around.</p>
<h2>No, really, how DOES this work?!?</h2>
<p>Ok, so the &#8220;magic&#8221; of Cucumber is all in the step definitions, which are defined using Ruby.  There is also some<br />
supporting Ruby code that you get out of the box with Cucumber that can help get you started.  For example, it<br />
creates a file named &#8220;paths.rb&#8221; for you which is where you tell Cucumber where to navigate given a set of text.<br />
So when Cucumber encounters a line like this in your plain text scenario, &#8220;And I am on the users page&#8221;, it<br />
automatically knows the phrase &#8220;I am on&#8221; and signals to Cucumber that you&#8217;re wanting to navigate somewhere.<br />
Then it looks at the text after that, which is &#8220;the users page&#8221; in this case.  This is where you need to give<br />
Cucumber a little help.</p>
<p>Here is an example of how to help a cuke out.</p>
<p><strong>/features/support/paths.rb</strong>  </p>
<pre>  module NavigationHelpers
    def path_to(page_name)
      case page_name
        when /the users page/
          users_path  # rails routing helper method
        when /the new user page/
          new_user_path  # rails routing helper method
      end
    end
  end
</pre>
<p>Since the Cucumber feature files are plain text and you are encouraged to use whatever language feels<br />
natural to you and your customer, you&#8217;re going to inevitably write something that Cucumber just doesn&#8217;t<br />
know how to do out of the box.  This is where custom step definitions come into play.  But don&#8217;t worry,<br />
they&#8217;re not as scary as they may look.</p>
<p>From the scenario above, Cucumber has no idea how to interpret &#8220;Given I am logged in as an admin&#8221; without<br />
a little help.  Below you can see that I&#8217;m specifiying a regular expression for the text that Cucumber<br />
needs help with and then simply using Capybara to visit a page, fill in a couple fields and click a button<br />
to perform the login using the actual login page.  Don&#8217;t let the regular expressions stuff scare you off.<br />
The awesome thing about running your Cucumber features is that when it comes across something it doesn&#8217;t<br />
understand it gives you the exact snippet of Ruby code that you can literally copy/paste from the terminal<br />
into a custom step file like the one show below.  Since I&#8217;m still not a regular expression guru, I LOVE that<br />
Cucumber helps me with that!</p>
<p><strong>/features/step<em>definitions/login</em>steps.rb</strong>  </p>
<pre>  Given /^I am logged in as an admin$/ do
    user = Factory.create(:admin) # I'll get to this later (factory_girl)
    visit(login_url)
    fill_in('Email', :with =&gt; user.email)
    fill_in('Password', :with =&gt; user.password)
    click('Login')
  end
</pre>
<p>Cucumber integration with Capybara (or Webrat) comes with a nice set of web related steps that cover a lot<br />
of the common cases.  But at some point you&#8217;ll definitely want to define your own web related steps.  I just<br />
created a file named &#8220;custom<em>web</em>steps.rb&#8221; to place them in.  This is a simple web step I defined to allow me<br />
to assert that an error is shown on the page containing the text I supply, which comes from my plain text scenario.<br />
Notice that you can chain together other web steps within each other like I&#8217;m doing below.  My custom web step below<br />
is simply leveraging one of the built in Capybara web steps to do what it needs.</p>
<p><strong>/features/step<em>definitions/custom</em>web_steps.rb</strong>  </p>
<pre>  Then /^I should see an error for "([^"]*)"$/ do |text|
    Then "I should see "#{text}" within ".error""
  end
</pre>
<h2>Clear as mud?</h2>
<p>Well hopefully that gives you a little insight into how to get going with using Cucumber to drive top-down development<br />
using acceptance testing.  At least, this has been my experience with it so far.  I&#8217;d be very interested to hear your<br />
feedback and some of the ways you&#8217;ve been successful with acceptance testing using Cucumber or any other framework for<br />
that matter.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/06/01/cucumber/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Ruby/Rails Life &#8211; My Rails 3 Stack &#8211; Part 2</title>
		<link>http://lostechies.com/joeybeninghove/2010/05/28/the-ruby-rails-life-my-rails-3-stack-part-2/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/05/28/the-ruby-rails-life-my-rails-3-stack-part-2/#comments</comments>
		<pubDate>Fri, 28 May 2010 13:00:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[factory_girl]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[rstakeout]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[steak]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/05/28/the-ruby-rails-life-my-rails-3-stack-part-2.aspx</guid>
		<description><![CDATA[Rails Deployment &#38; Testing There are some really nice tools available for deployment and testing rails. Below is a brief description of some of the ones I&#8217;ve been using with success. Capistrano I remember in the early days of my&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/05/28/the-ruby-rails-life-my-rails-3-stack-part-2/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1><strong>Rails Deployment &amp; Testing</strong></h1>
<p>There are some really nice tools available for deployment and testing rails.  Below is a brief description<br />
of some of the ones I&#8217;ve been using with success.</p>
<h3>Capistrano</h3>
<p>I remember in the early days of my attempts of using Rails back in the 1.x days, the deployment/hosting<br />
story was a bit of a headache, even with Capistrano back then.  However things have improved dramatically,<br />
especially with things like <a href="http://modrails.org">Phusion Passenger</a>.  Capistrano is still strong too and I&#8217;ve<br />
found that it makes deploying Rails apps extremely simple.  The ability to make that &#8220;one quick change&#8221; and redeploy<br />
in seconds is an awesome feeling.</p>
<p>Here is a somewhat annotated example of what my deploy script looks like just to give you a glimpse of what a<br />
Capistrano script looks like (with certain information removed of course).  If you&#8217;ve never used Capistrano before<br />
then this might look a bit foreign.  Again, this is just a taste, but you&#8217;ll have to dig in a bit more to really<br />
understand the moving parts here.</p>
<h4>Example</h4>
<p><strong>/config/deploy.rb</strong>  </p>
<pre>    # just some basic info, including where to grab the code from
    set :application, "My Groovy Rails App"
    set :repository,  "[git repo]"
    set :scm, :git

    # there are some SSH options that i don't fully understand yet... <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 
    default_run_options[:pty] = true
    ssh_options[:forward_agent] = true

    # ex. /var/www/my_groovy_rails_app
    set :deploy_to, "[path]" 

    # just some basic server properties
    role :web, "[server]"                   # Your HTTP server, Apache/etc
    role :app, "[server]"                   # This may be the same as your `Web` server
    role :db,  "[server]", :primary =&gt; true # This is where Rails migrations will run

    # configure environment variables to propertly use RVM (Ruby Version Manager) on the server
    # as you can see i'm using Ruby 1.8.7 Enterprise Edition on the server
    set :default_environment, {
      'PATH' =&gt; '/home/you/.rvm/gems/ree-1.8.7-2010.01/bin:/home/you/.rvm/gems/ree-1.8.7-2010.01@global/bin:/home/you/.rvm/rubies/ree-1.8.7-2010.01/bin:/home/you/.rvm/bin:$PATH',
      'RUBY_VERSION' =&gt; 'ree-1.8.7-2010.01',
      'GEM_HOME'     =&gt; '/home/you/.rvm/gems/ree-1.8.7-2010.01',
      'GEM_PATH'     =&gt; '/home/you/.rvm/gems/ree-1.8.7-2010.01:/home/you/.rvm/gems/ree-1.8.7-2010.01@global',
      'BUNDLE_PATH'  =&gt; '/home/you/.rvm/gems/ree-1.8.7-2010.01'  # If you are using bundler.
    }

    # automatically restarts the app after deployment
    namespace :deploy do
      task :start do ; end
      task :stop do ; end
      task :restart, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
        run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
      end
    end

    # tasks for bundler, which is the new way dependencies are managed in Rails 3
    namespace :bundler do
      task :create_symlink, :roles =&gt; :app do
        shared_dir = File.join(shared_path, 'bundle')
        release_dir = File.join(current_release, '.bundle')
        run("mkdir -p #{shared_dir} &amp;&amp; ln -s #{shared_dir} #{release_dir}")
      end

      task :bundle_new_release, :roles =&gt; :app do
        bundler.create_symlink
        run "cd #{release_path} &amp;&amp; bundle install --without test"
      end

      task :lock, :roles =&gt; :app do
        run "cd #{current_release} &amp;&amp; bundle lock;"
      end

      task :unlock, :roles =&gt; :app do
        run "cd #{current_release} &amp;&amp; bundle unlock;"
      end
    end

    # the actual task that runs bundler to ensure all dependencies on the server are up to date
    after "deploy:update_code" do
      bundler.bundle_new_release
    end

</pre>
<ul>
<li><a href="http://www.capify.org/index.php/Capistrano">http://www.capify.org/index.php/Capistrano</a></li>
<li><a href="http://github.com/capistrano/capistrano">http://github.com/capistrano/capistrano</a></li>
<li><a href="http://peepcode.com/products/capistrano-2">http://peepcode.com/products/capistrano-2</a></li>
</ul>
<h3>RSpec 2</h3>
<p>A lot of you have probably at least heard of RSpec, with some of you perhaps even using it now.  It&#8217;s a pretty<br />
awesome testing framework, dare I say, BDD framework.  Surprisingly I&#8217;ve really only scratched the surface as to<br />
what RSpec is capable of, but it&#8217;s a joy to use for sure.  So far I&#8217;m mainly using it for testing my models and a<br />
little bit of controller testing.  However I&#8217;m leaning on my higher level Cucumber integration tests for exercising<br />
my controllers for the most part.  I also haven&#8217;t gotten into mocking all that much yet, which RSpec has support for<br />
as well.  Perhaps at some point I&#8217;ll get into mocking.  This is probably going to get me flamed by the ALT.NET&#8217;ers,<br />
but honestly I just haven&#8217;t felt the pain in the fact that most of my tests DO in fact hit my local test database.<br />
Perhaps that&#8217;s because I&#8217;m using MongoDB as my database which is so fast I don&#8217;t really notice that much of a<br />
performance hit.</p>
<h4>Example</h4>
<p>Here&#8217;s a brief example of a simple model spec in RSpec.</p>
<p><strong>/spec/models/user_spec.rb</strong>  </p>
<pre>describe User do
  context "first name" do
    it "is required" do
      user = User.new
      user.should_not be_valid
      user.errors[:first_name].first.should == "can't be blank"
    end
  end

  context "email" do
    it "is unique" do
      user1 = User.create!(:email =&gt; "abc@123.com")
      user2 = User.new(:email =&gt; "abc@123.com")

      user2.should_not be_valid
      user2.errors[:email].first.should == "is already taken"
    end
  end
end
</pre>
<p>Certainly not an exhaustive example, but it gives you the idea of how a basic spec looks in RSpec.  And even this is<br />
not nearly as elegant as I&#8217;ve been seeing others show lately.  I would highly recommend you watch<br />
<a href="http://twitter.com/l4rk">@l4rk</a>&#8216;s presentation at the Scottish Ruby Conference on<br />
<a href="http://video2010.scottishrubyconference.com/show_video/3/1">Pure RSpec</a>.  I learned a ton from this presentation<br />
and hope to incorporate some of his tips into my specs soon.  Specifically the elegance of &#8220;let&#8221; and &#8220;subject&#8221;.</p>
<p>Oh, one more note.  I&#8217;m using RSpec <strong>2</strong>, which is still in the early stages, but works with Rails 3.  And I&#8217;m<br />
actually running it straight from the master git repo.  So, use at your own risk!</p>
<ul>
<li><a href="http://rspec.info">http://rspec.info</a> &#8211; Only covers RSpec 1.x, but some useful info nonetheless</li>
<li><a href="http://github.com/rspec">http://github.com/rspec</a></li>
<li><a href="http://video2010.scottishrubyconference.com/show_video/3/1">Pure RSpec</a> </li>
</ul>
<h3>Cucumber</h3>
<p>I&#8217;ve named this cute little guy Larry.  If you have kids, then you know why.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   This is a pretty nice way of doing<br />
high level acceptance/integration testing.  It&#8217;s also the first time I&#8217;ve ever thought that ATDD (acceptance test driven<br />
development) is actually achievable.  The idea is that you write your &#8220;stories&#8221; in plain english, preferrably<br />
with your client/customer/product owner using the give/when/then style of syntax.  Once written, these stories can be<br />
run through the Cucumber framework where it is parsed and coupled with custom ruby code (some of which you have to<br />
write) to essentially give you executable specifications.  Of all the attempts I&#8217;ve seen out there to achieve ATDD and<br />
executable specifications, Cucumber really seems to have it nailed the best so far.  Writing the stories does take some<br />
getting used to as you do somewhat have to learn to speak the &#8220;language&#8221; of Cucumber.  But after writing your first<br />
couple &#8220;features&#8221;, as Cucumber calls them, you pretty much get the hang of it.</p>
<h4>Example</h4>
<p><strong>/features/users/add<em>new</em>user.feature</strong>  </p>
<pre>Feature: Add new user
    In order to allow a new user to access the system
    As an admin
    I want to add a new user to the system

    Scenario: New link is clicked from the users page
        Given I am logged in as an admin
        And I am on the users page
        When I follow "New"
        Then I should be on the new user page

    Scenario Outline: Required text fields are blank 
        Given I am logged in as an admin
        And I am on the new user page
        When I fill in "" for ""
        And I press "Save"
        Then I should see an error for ""

        Examples:
            | field_name |
            | First name |
            | Last name  |
            | Email      |
            | Password   |
</pre>
<p>I have another post written that gives a bit more of an overview of Cucumber with more code examples, so look for that<br />
soon.</p>
<ul>
<li><a href="http://cukes.info">http://cukes.info</a></li>
<li><a href="http://github.com/aslakhellesoy/cucumber">http://github.com/aslakhellesoy/cucumber</a></li>
<li><a href="http://peepcode.com/products/cucumber">http://peepcode.com/products/cucumber</a></li>
</ul>
<h3>Steak</h3>
<p>I&#8217;ve only started to play around with this one, but it&#8217;s a pretty interesting take on acceptance/integration testing.<br />
Unlike Cucumber, it doesn&#8217;t use plain text stories.  Instead it&#8217;s basically just a small wrapper of aliases on top<br />
of RSpec that give you same kinda feel as Cucumber, but without the overhead of the English language.  I&#8217;m going to<br />
be spiking a bit more with this one as I think it might come in handy for some of my other integration testing needs.<br />
Oh, and gotta love its logo!  Beef!  It&#8217;s what&#8217;s for&#8230;testing?</p>
<ul>
<li><a href="http://github.com/cavalle/steak">http://github.com/cavalle/steak</a></li>
</ul>
<h3>factory_girl</h3>
<p>Interesting name, very useful tool.  You might have guessed that this is a tool to create objects for you.  Not a whole<br />
lot to say, but it&#8217;s really handy to easily create objects in varying states for testing purposes.</p>
<h4>Example</h4>
<p><strong>/spec/factories.rb</strong></p>
<pre>  # creates a new User model
  Factory.define :user do |u|
    u.first_name 'Bud'
    u.last_name 'Abbott'
    u.email { |x| "#{x.first_name.downcase}.#{x.last_name.downcase}@blah.com" }
    u.password 'secret'
    u.password_confirmation 'secret'
    u.group_ids { [Factory.create(:group, :name =&gt; 'Users').id] }
    u.roles ['manager']
  end
</pre>
<p>You can use this factory in a variety of ways.</p>
<pre>  # instantiates the User model only, does NOT save it to the database
  Factory.build(:user) 

  # creates the User model and saves it to the database
  Factory.create(:user) 

  # returns a hash of attributes representing this user
  # useful for testing controllers simulating params or for validation
  Factory.attributes_for(:user) 

  # I haven't really found a use for this one yet
  Factory.stub(:user)

  # You can override specific values if desired
  # This would build the user setting a name
  # of "Lou Costello" instead of the default "Bud Abbott"
  Factory.build(:user, :first_name =&gt; "Lou", :last_name =&gt; "Costello")
</pre>
<ul>
<li><a href="http://github.com/thoughtbot/factory_girl">http://github.com/thoughtbot/factory_girl</a></li>
</ul>
<h3>rstakeout</h3>
<p>This is a nice little script I got from Geoffrey Grosenbach, of PeepCode fame. I use to automatically run my Cucumber<br />
features and RSpec tests anytime I change a file in my Rails app.  I find rstakeout to be a lot simpler to get going than<br />
Autotest/Autospec.  It has growl integration too.  And yes, I do like my green and red growl notifications.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Example (from a terminal)</h4>
<pre>  rstakeout "cucumber -t @wip"
</pre>
<p>If I run that in my terminal, it automatically watches all files in my Rails app for changes and runs the command I give<br />
it on each change.  In this case, it runs my cucumber features, but only ones I&#8217;ve tagged with @wip, meaning ones I&#8217;m working<br />
on at the given moment.</p>
<p>I&#8217;ve posted a Gist of the rstakeout script I&#8217;m using since there has been some confusion over which version to use.</p>
<ul>
<li><a href="http://gist.github.com/408007">rstakeout script</a></li>
</ul>
<h3>Conclusion</h3>
<p>Well I hope that gives you a taste of some of the deployment and testing tools I&#8217;m using so far in Rails.  I feel like I<br />
still have a ton to learn of course, but so far I&#8217;m really enjoying the testing experience that the Ruby language gives<br />
me.</p>
<p>What are your favorite deployment/testing tools in Ruby/Rails?  Leave a comment and let me know!</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/05/28/the-ruby-rails-life-my-rails-3-stack-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Ruby/Rails Life &#8211; My Rails 3 Stack &#8211; Part 1</title>
		<link>http://lostechies.com/joeybeninghove/2010/05/25/the-ruby-rails-life-my-rails-3-stack-part-1/</link>
		<comments>http://lostechies.com/joeybeninghove/2010/05/25/the-ruby-rails-life-my-rails-3-stack-part-1/#comments</comments>
		<pubDate>Tue, 25 May 2010 02:35:00 +0000</pubDate>
		<dc:creator>Joey Beninghove</dc:creator>
				<category><![CDATA[blueprint]]></category>
		<category><![CDATA[cancan]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[haml]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[mongoid]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">/blogs/joeydotnet/archive/2010/05/24/the-ruby-rails-life-my-rails-3-stack-part-1.aspx</guid>
		<description><![CDATA[As some of you might know, About a month ago I left my almost 10 year career as a Microsoft developer to become an independent Ruby/Rails developer (a term I&#8217;m deeming &#8220;pulling a Gunderloy&#8221;). It was long overdue for me&#160;&#8230; <a href="http://lostechies.com/joeybeninghove/2010/05/25/the-ruby-rails-life-my-rails-3-stack-part-1/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1><span style="font-weight: normal;font-size: 12px">As some of you might know, About a month ago I left my almost 10 year career as a Microsoft developer to become<br />
an independent Ruby/Rails developer (a term I&#8217;m deeming <a href="http://afreshcup.com/home/2006/12/8/what8217s-going-on-here.html">&#8220;pulling a Gunderloy&#8221;</a>).<br />
It was long overdue for me and I couldn&#8217;t be happier to be free from the shackles of Microsoft.<br />
It seems lately there are <a href="http://www.infoq.com/articles/architecting-tekpub">more and more folks</a> coming to the<br />
same realization as I have and are making the jump to work with more open technologies and platforms on the web.<br />
But I&#8217;ll leave that conversation to the twitterverse.</span></h1>
<h2>Big Fat Disclaimer</h2>
<p>As noted above, I&#8217;ve only been doing full-time professional Ruby/Rails development now for about a month.<br />
So what you see below is the outcome of my past month of both struggles and successes.  I don&#8217;t claim to<br />
be anywhere near a Rails expert yet, so please feel free to leave <strong>nice</strong> and <strong>helpful</strong> comments about any misconceptions<br />
I may convey below.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h2>My Rails Stack</h2>
<p>I&#8217;ve been given a pretty great opportunity to build a large greenfield product from the ground up using any<br />
technology stack I want.  Here is a brief overview of the technologies I&#8217;ve chosen to use for my current project,<br />
which I&#8217;m loving so far.  I&#8217;m not going to go into too much detail, but will provide a few useful links for the<br />
relevant projects where you can read up on how to get rolling with them.  I&#8217;m purposefully not including links<br />
to everything I&#8217;m going to talk about because Google is your friend.</p>
<h3>RVM (Ruby Version Manager)</h3>
<p>This is such an awesome tool.  This not only allows you to run completely different Ruby versions<br />
side by side in isolation, but also the entire environment include gems are isolated from each other.<br />
So you can set up different Ruby environments to test out different versions, and the gems you install<br />
in a particular environment don&#8217;t affect anything else.  This is a must have if you&#8217;re experimenting<br />
with different Ruby versions, which I am not yet.</p>
<ul>
<li><a href="http://rvm.beginrescueend.com">http://rvm.beginrescueend.com</a></li>
<li><a href="http://github.com/wayneeseguin/rvm">http://github.com/wayneeseguin/rvm</a></li>
<li><a href="irc://irc.freenode.net/#rvm">irc://irc.freenode.net/#rvm</a></li>
</ul>
<h3>Ruby 1.8.7 (for now)</h3>
<p>I decided to stick with Ruby 1.8.7 for now since it seems to work just fine with Rails 3 and plays<br />
nice with all of the gem dependencies I&#8217;ve taken on so far, some of which may not be up to par yet<br />
with Ruby 1.9.x.  I suspect at some point I&#8217;ll make the switch over to Ruby 1.9 and see how it does.<br />
And most certainly once Rails 3 finally drops.</p>
<ul>
<li><a href="http://www.ruby-lang.org">http://www.ruby-lang.org</a></li>
<li><a href="http://rubyflow.com">http://rubyflow.com</a></li>
<li><a href="http://www.rubyinside.com">http://www.rubyinside.com</a></li>
<li><a href="irc://irc.freenode.net/#ruby-lang">irc://irc.freenode.net/#ruby-lang</a></li>
</ul>
<h3>Rails 3 (Beta 3/Edge)</h3>
<p>I decided to go with Rails 3 for this new project, mainly because Rails 3 is quite a huge update over<br />
<span style="text-decoration: line-through">2.3.5</span> 2.3.8, the current &#8220;offical&#8221; version of Rails.  And because Rails 3 comes with some<br />
really awesome new features and improvements.  I started with just running Beta 3, which is pretty solid,<br />
but decided to switch over to Edge Rails for a while to get some of the benefits of some of the dependencies<br />
I&#8217;m using that take advantage of Edge Rails.  There have been a few minor hiccups along the way,<br />
but nothing major so far.</p>
<p>There are many great resources out there for Rails 3, but if you&#8217;re interested in really nice detailed<br />
posts and screencasts on new Rails 3 features, check out the <a href="http://railsdispatch.com/posts">Rails Dispatch blog</a><br />
where Yehuda himself and other great guys are posting some really great content.  The excellent<br />
<a href="http://guides.rails.info">Rails Guides</a> are also being updated pretty rapidly to cover the changes in Rails 3.<br />
Or if you want to dig directly into the API documentation check out one of my favorite Ruby API sites,<br />
<a href="http://railsapi.com">RailsAPI</a>.  RailsAPI is pretty cool in that it lets<br />
you create a customized API documentation package for Ruby, Rails and popular gems that you can either<br />
browse online or even download.</p>
<ul>
<li><a href="http://rubyonrails.org">http://rubyonrails.org</a></li>
<li><a href="http://github.com/rails/rails">http://github.com/rails/rails</a></li>
<li><a href="http://railsdispatch.com">http://railsdispatch.com</a></li>
<li><a href="http://guides.rails.info">http://guides.rails.info</a></li>
<li><a href="http://railsapi.com">http://railsapi.com</a></li>
<li><a href="irc://irc.freenode.net/#rubyonrails">irc://irc.freenode.net/#rubyonrails</a></li>
</ul>
<h3>Haml</h3>
<p>A lot of folks might already know my LOVE for <a href="http://haml-lang.com">Haml</a>.  I&#8217;ve been using Haml for about a year<br />
and half already in the ASP.NET MVC world using NHaml.  So it was a no brainer for me to choose it for this Rails<br />
project.  Not sure there is really much more I can say about it except you must try it.  <img src='http://lostechies.com/joeybeninghove/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   No, seriously, just do it.<br />
Your hands will thank you!</p>
<ul>
<li><a href="http://haml-lang.com">http://haml-lang.com</a></li>
<li><a href="http://github.com/nex3/haml">http://github.com/nex3/haml</a></li>
<li><a href="irc://irc.freenode.net/#haml">irc://irc.freenode.net/#haml</a></li>
</ul>
<h3>Sass</h3>
<p>The lovely sister to Haml, allowing you to create DRY stylesheets with the use of variables, mixins and all kinds<br />
of other goodness.  This is the first time I&#8217;ve used Sass on a real project and even though I&#8217;m not leveraging<br />
all of its capabilities yet, I love the simplicity of the language.  Hopefully I can dig in a bit more soon to<br />
further improve my stylesheets.</p>
<ul>
<li><a href="http://github.com/nex3/haml">http://github.com/nex3/haml</a></li>
<li><a href="irc://irc.freenode.net/#sass">irc://irc.freenode.net/#sass</a></li>
</ul>
<h3>Compass/Blueprint</h3>
<p>Taking styles and page layout to a whole new level.  Compass is a really nifty &#8220;framework of frameworks&#8221; that sits<br />
on top of Sass and a handful of grid-based CSS frameworks such as Blueprint or 960.gs to name a couple.  I chose to<br />
go with the default of Blueprint and it&#8217;s been pretty good so far.  The out of the box CSS resets, browser-specific<br />
fixes and typography make it really easy to get a decent looking site up and running fast.</p>
<ul>
<li><a href="http://compass-style.org">http://compass-style.org</a></li>
<li><a href="http://github.com/chriseppstein/compass">http://github.com/chriseppstein/compass</a></li>
<li><a href="http://www.blueprintcss.org">http://www.blueprintcss.org</a></li>
<li><a href="http://960.gs">http://960.gs</a></li>
</ul>
<h3>jQuery</h3>
<p>The fact that Rails 3 still ships with Prototype out of the box still kinda boggles my mind.  Nevertheless<br />
with the increased modularity of Rails 3, it&#8217;s really easy to swap out a lot of the parts of Rails with<br />
alternatives.  For example, you can pretty easily swap out Prototype for jQuery as the default javascript in<br />
Rails 3.</p>
<p><strong>/app/views/layouts/application.html.haml</strong></p>
<pre>= javascript_include_tag :defaults</pre>
<p><strong>/config/initializers/jquery.rb</strong></p>
<pre>if ActionView::Helpers::AssetTagHelper.const_defined?(:JAVASCRIPT_DEFAULT_SOURCES)
  ActionView::Helpers::AssetTagHelper.send(:remove_const, "JAVASCRIPT_DEFAULT_SOURCES")
end
ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery-1.4.2.min.js', 'rails.js']
ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
</pre>
<ul>
<li><a href="http://jquery.com">http://jquery.com</a></li>
<li><a href="http://github.com/jquery/jquery">http://github.com/jquery/jquery</a></li>
</ul>
<h3>MongoDB</h3>
<p>After watching the rise of document-oriented databases for a while and some of my own learning/experimentation,<br />
I decided to make the move to MongoDB as my primary database platform.  I say &#8220;primary&#8221; because I&#8217;m a firm believer<br />
in choosing the right tool for the job.  So if there are some models that are, for instance, heavily relational<br />
or need strict transactions then MySQL might be a good fit for those particular pieces.  If I have a set of simple data, say,<br />
lookup data, perhaps throwing it in a wicked fast key/value store like Reddis might be better for that particular data.<br />
However, most of my models so far in this project are well suited for a schema-less document store given their<br />
hierarchical nature and need to be flexible with possible custom attributes.</p>
<p>MongoDB has been an absolute joy to use so far.  It just simple stores whatever you give without complaining.<br />
Don&#8217;t have a database named my<em>cool</em>app yet?  No problem, just attempt to write to a non-existent database and it&#8217;ll create it for you.<br />
Don&#8217;t have a collection named codemonkeys yet?  No problem, just send off a new collection to MongoDB and it&#8217;ll<br />
create a new collection (aka table) for you.  No migrations, no fuss.  I hardly even notice the database is there sometimes.</p>
<ul>
<li><a href="http://www.mongodb.org">http://www.mongodb.org</a></li>
<li><a href="http://github.com/mongodb/mongo">http://github.com/mongodb/mongo</a></li>
<li><a href="irc://irc.freenode.net/#mongodb">irc://irc.freenode.net/#mongodb</a></li>
</ul>
<h3>Mongoid</h3>
<p>There are quite a few mappers out there now for Ruby and MongoDB.  MongoMapper, MongoDoc, Mongoid, Candy and a bunch<br />
of others (sorry if I left your favorite one out).  At the time when I was starting my Rails 3 project Mongoid seemed<br />
to be the most &#8220;Rails 3 friendly&#8221; one since it supports the new ActiveModel abstraction and Rails Validations out of the box.  I<br />
believe some of the others are getting up to speed now as well, but I&#8217;m really liking Mongoid so far.  Each MongoDB mapper<br />
takes a slightly different approach.  Some try to mimic Active Record, while others just give you the bare bones for<br />
you to handle your persistence and querying any way you&#8217;d like.  Right now I like Mongoid because it seems to strike a<br />
pretty good balance.  You get some Active-Record like querying methods, but it also has a very powerful Criteria API.<br />
But like most OSS projects, Mongoid has its own opinions about how you should be persisting your objects.  Specifically,<br />
Mongoid leads you down the path of using embedded documents as much as possible, which is the ideal way to store documents<br />
in MongoDB.  Oh and did I mention that Mongoid heavily favors composition over inheritance, which is a big win for me.<br />
Another interesting tidbit is that Mongoid is the brainchild of Durran Jordan, of Hashrocket fame.  I continue<br />
to be amazed at the number of awesome OSS contributions that come out of the guys at Hashrocket.</p>
<ul>
<li><a href="http://mongoid.org">http://mongoid.org</a></li>
<li><a href="http://github.com/durran/mongoid">http://github.com/durran/mongoid</a></li>
<li><a href="http://vimeo.com/9864311">http://vimeo.com/9864311</a> (Great talk by @modetojoy on MongoDB/Mongoid)</li>
</ul>
<h3>Devise</h3>
<p>One of the first things I needed to tackle in this new Rails 3 project was authentication.  I knew there were a few<br />
good Ruby authentication frameworks out there.  Authlogic is the &#8220;big guy&#8221; in the room here.  But Devise is gaining<br />
quite a bit of traction and after I spiked with it for a bit, I really liked it.  It really takes advantage of Rails 3<br />
and is extremely flexible and extensible.  Devise is one of the few frameworks I&#8217;ve used that has managed to achieve<br />
a high degree of flexibility while maintaining its simplicity.  Then again, I&#8217;m starting to see that characteristic in<br />
a lot of Ruby-based frameworks.  Some of the things that Devise will do for you is database authentication, new user<br />
registration, confirmation, password recovery, &#8220;remember me&#8221; functionality, user login tracking, session timeouts,<br />
validations and account lockout to name a few.  There also a growing number of plugins for Devise for things like<br />
Facebook, LDAP and OpenID authentication.</p>
<ul>
<li><a href="http://blog.plataformatec.com.br/tag/devise">http://blog.plataformatec.com.br/tag/devise</a></li>
<li><a href="http://github.com/plataformatec/devise">http://github.com/plataformatec/devise</a></li>
</ul>
<h3>CanCan</h3>
<p>Of course authorization usually goes hand in hand with authentication.  Don&#8217;t get them confused!  There are quite a<br />
few players solving this problem as well.  Declarative Authorization was the first one I looked at and, while it looked<br />
great, I didn&#8217;t need quite that many features yet.  I found a simpler solution called CanCan by none other than Ryan<br />
Bates of <a href="http://railscasts.com">RailsCasts</a> fame.  CanCan is very easy to sit on top of Devise and all authorization rules are set up in single<br />
model class you define named Ability.  CanCan makes no assumptions about how you want to handle authorization.  Whether<br />
it&#8217;s role-based or custom or both, it&#8217;s pretty easy to write a few simple rules to get things going.  Also very easy to<br />
check your authorization rules in your controllers and views with simple methods like can? and cannot?.</p>
<ul>
<li><a href="http://github.com/ryanb/cancan">http://github.com/ryanb/cancan</a></li>
</ul>
<h2>To Be Continued&#8230;</h2>
<p>That&#8217;s enough for this post I think.  In Part 2, I&#8217;ll talk about the deployment and testing tools I&#8217;m currently using.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/joeybeninghove/2010/05/25/the-ruby-rails-life-my-rails-3-stack-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
