<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>coding in the rain</title>
	<link type="application/atom+xml" href="http://ascarter.net/atom.xml" rel="self" />
	<link type="text/html" href="http://ascarter.net/" rel="alternate" />
	<id>tag:ascarter.net,2009-12-31:/atom.xml</id>
	<updated>2010-07-28T09:02:39-07:00</updated>
	
	<entry>
		<title>Next</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/07/12/next.html" rel="alternate" />
		<updated>2010-07-12T21:30:35-07:00</updated>
		<id>tag:ascarter.net,2010-07-12:/2010/07/12/next</id>
		<content type="html">&lt;p&gt;After nearly three years, last Friday was my last day at &lt;a href='http://gettyimages.com'&gt;Getty Images&lt;/a&gt;. The time had come to move on to the next challenge. It was time to change direction and take some control for myself.&lt;/p&gt;

&lt;p&gt;Last February was my five year anniversary from leaving Microsoft. When I left, my dream was to start my own company. The same dream is there but what it looks like has changed dramatically since 2005. I expected to build a desktop applications. People like &lt;a href='http://inessential.com/'&gt;Brent Simmons&lt;/a&gt; and &lt;a href='http://shapeof.com/'&gt;Gus Mueller&lt;/a&gt; were my models. They ran successful indie software business on the Mac and built amazing applications. I experimented with some ideas that never went anywhere. So instead, I pursued another interest in open source software by joining Source Labs. That began a series of jobs at startups with varying degrees of success. It all reached an implosion at &lt;a href='http://www.jobster.com/'&gt;Jobster&lt;/a&gt;, a prime example of the decaying dot com mentality. Despite the lack of success at startups, I was gaining a new insight into another passion - the web. The single biggest gift Jobster gave me was Ruby on Rails. I was in the right place at the right time. Rails was just taking off and Jobster had jumped on board early.&lt;/p&gt;

&lt;p&gt;Rails began to show me a new path. My thoughts were now entirely on the web. Rails was a tool that made creation of a new class of applications easy. I had done some of the large machinery that sits behind frameworks like Rails. But this was the link I needed to what I had done at Microsoft and what I wanted to do. My goal was no longer to build desktop applications but to build great web services.&lt;/p&gt;

&lt;p&gt;I landed at Getty Images in 2007. I was feeling pretty destroyed from my tour of the startup world. I was tired of empty promises and working for 8 months on software that went into the toilet. I wanted to accomplish something instead of vaporware. I was fortunate to work on a skunkworks Rails project my friend &lt;a href='http://www.hishma.com/'&gt;Jeff Johnston&lt;/a&gt; had started. Together with a small team, we built a portal that opened up a new way for Getty to work with their artists. We shipped it. It succeeded. It was fantastic. We were rewarded with the Flickr integration project where we provided the bridge between Flickr and Getty Images - a new market and a pairing of the old with the new. We again launched and in most ways, we succeeded. But it was costly to me personally. It was a death march unlike any I had done since my earliest days of SQL Server. I felt beaten down by the project and in many ways never felt the pride or satisfaction I should have.&lt;/p&gt;

&lt;p&gt;A lot changed after that. The team became very different, our role changed too. When I joined the team, I was the only one with any significant Rails experience. Now we had a team that had launched three major apps on Rails. In many ways, I had outgrown my usefulness for the team. We always like to think we are way more important than we really are. That has hit home these past few days. I decided it was time to do something else.&lt;/p&gt;

&lt;p&gt;When I surveyed what was out there, I found I just couldn&amp;#8217;t get excited about joining up with another startup whose ambitions had no grounding in reality. And I could not stomach going back to a large company and dealing with the complexities of modern corporations. Mobile applications have moved front and center. I got serious about iPhone development and took a side contract to build an application. That sparked the last connection - linking mobile with web services. Blurring the line between local and cloud or whatever you wish to call it. I loved that one person could again build the whole thing. I could fit the app in my head. I wrote UI code. It was exciting and different. I did this for a few months. Soon other project opportunities emerged. I decided this is what I wanted to spend my time on.&lt;/p&gt;

&lt;p&gt;So now I&amp;#8217;m an independent developer. I formed my own web development firm &lt;a href='http://www.sourceblueprints.com/'&gt;Source Blueprints, LLC&lt;/a&gt;. I&amp;#8217;m doing contract projects using the technology I want. I&amp;#8217;ve got some jobs to get started. I&amp;#8217;ve been amazed at how many people have come forth with interesting ideas.&lt;/p&gt;

&lt;p&gt;I have a new set of goals. I want to build a small team of developers with the same focus. My model is the way &lt;a href='http://www.37signals.com/'&gt;37signals&lt;/a&gt; works. I have some ideas I want to build. It&amp;#8217;s easier than ever to bootstrap yourself. That&amp;#8217;s what I want to do. Balance contract work with building my own creations. No endless meetings, no commute. I want to look at my day and feel like I did something. I want to write code not talk about it. And I hope to have a better balance between work and life.&lt;/p&gt;

&lt;p&gt;This is the dream anyway. The reality can be much more harsh. Right now, it&amp;#8217;s a good time to be available as an independent. A gold rush is underway in mobile. It is actually driving down the price though. There is a dot com bubble forming. There will be a crash. Too many hacks are muddying the waters right now. But I&amp;#8217;m confident in my skills and my experience. I&amp;#8217;m avoiding the stuff that is purely derivative. I&amp;#8217;m looking for the projects that mix both web and mobile. Those are more likely to succeed. I won&amp;#8217;t do the cookie cutter apps nor the &amp;#8220;anyone can be a developer&amp;#8221; tools. That&amp;#8217;s not the work I want.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m going into this with my eyes open. I can&amp;#8217;t say what tomorrow will be. But I&amp;#8217;ve been through multiple &amp;#8220;revolutions&amp;#8221; now. In many ways, I&amp;#8217;ve done it all and heard it all. I&amp;#8217;m going to focus on what I want now. That applies to the work and it applies to taking back my time. I know I&amp;#8217;ll now be home much more to see my daughter. And that&amp;#8217;s more important to me than anything else right now.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>RailsConf 2010 Day 3</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/06/13/railsconf-2010-day-3.html" rel="alternate" />
		<updated>2010-06-13T23:59:33-07:00</updated>
		<id>tag:ascarter.net,2010-06-13:/2010/06/13/railsconf-2010-day-3</id>
		<content type="html">&lt;p&gt;I&amp;#8217;m a few days late posting my wrap up of the final day of &lt;a href='http://en.oreilly.com/rails2010'&gt;RailsConf&lt;/a&gt;. Traveling and getting back home delayed it.&lt;/p&gt;

&lt;h1 id='keynote'&gt;Keynote&lt;/h1&gt;

&lt;p&gt;&amp;#8220;Uncle Bob&amp;#8221; Martin gave the morning keynote titled &lt;strong&gt;Twenty-Five Zeros&lt;/strong&gt;. The premise of the speech was built on the notion that hardware has advanced by extraordinary amounts while software hasn&amp;#8217;t kept pace. Mr. Martin states that we are writing code today that is not very different from the first FORTRAN programs 50 years ago. As he stated it, &amp;#8220;sequence, selection, iteration&amp;#8221; form the basis for programming both then and now. Objects and other innovations still fundamentally use the same pattern.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;d agree that hardware advances have dwarfed software. And I also agree with the premise that Moore&amp;#8217;s Law is likely dead. Advances will need to be driven from the software side rather than hardware. But I did find his apparent dissatisfaction with using fundamentals from 1957 questionable. To me, these represent basic truths in programming. Computer hardware is still built on the same digital fundamentals as well. We&amp;#8217;ve gone from transistors to solid state. That doesn&amp;#8217;t mean that 1&amp;#8217;s and 0&amp;#8217;s are fundamentally wrong. Or that logic networks or any of the other basics that form computer hardware.&lt;/p&gt;

&lt;p&gt;I think he may have meant his talk to be a rallying cry. To me, it seemed like it was a misguided critique that didn&amp;#8217;t apply. I also find the whole &amp;#8220;Uncle Bob&amp;#8221; schtick annoying.&lt;/p&gt;

&lt;h1 id='migrating_plugins_and_gems_to_rails_3'&gt;Migrating Plugins and Gems to Rails 3&lt;/h1&gt;

&lt;p&gt;The first talk of the day I attended was Clinton Nixon of Vigent Labs on plugins and gems in Rails 3. The talk covered highlights of what gem authors should do to get their gem on Rails 3. In particular, there are some new locations you should be putting things like generators and rake tasks, using &lt;code&gt;Rails.*&lt;/code&gt; instead of &lt;code&gt;RAILS_*&lt;/code&gt;, and adapting to using Thor instead of Rubigen. One obvious piece of advice is to convert plugins to gems. I think everyone knows this but it&amp;#8217;s always a question of whether it is worth the effort to take an old plugin and get it into a gem.&lt;/p&gt;

&lt;p&gt;The second part of Clinton&amp;#8217;s talk was a case study for migrating the Rails footnotes gem. It seemed like most of the problems for this gem were caused by how it was injecting itself into the core of Rails. I think this case was a bit extreme in that most gems don&amp;#8217;t touch Rails at such a low level. Nevertheless, it was an enlightening exercise to see how to take a complex gem and get it on Rails 3.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve begun to question relying on gems and plugins at all. This talk just reinforced it. The best case is to have no gem to upgrade. I&amp;#8217;m not saying &amp;#8220;don&amp;#8217;t use gems&amp;#8221;. Rather, I feel like the smarter course of action is to use a gem as a last resort.&lt;/p&gt;

&lt;h1 id='rails_next_top_model'&gt;Rails Next Top Model&lt;/h1&gt;

&lt;p&gt;Adam Keys presented a talk on ActiveModel and ActiveRelation. These are two very important additions to Rails 3. ActiveModel represents much of the ActiveRecord DSL in a form that you could apply to a pure Ruby object easily. This means you can hook in validations (&lt;em&gt;validates_presence_of&lt;/em&gt;, etc.) and serialization. You also can use your ActiveModel classes easily in ActionView forms.&lt;/p&gt;

&lt;p&gt;ActiveRelation (Arel) adds the new predicate syntax. It also provides the dynamic finder DSL seen in ActiveRecord. Like ActiveModel, this is another module you could apply to pure Ruby objects. In both ActiveModel and Arel, you include the modules in your code instead of deriving from a base like ActiveRecord. I have a couple ideas in mind for exposing some of our legacy systems as ActiveModels.&lt;/p&gt;

&lt;h1 id='agile_the_pivotal_way'&gt;Agile the Pivotal Way&lt;/h1&gt;

&lt;p&gt;The last talk I attended was a presentation by Ian McFarland on how Pivotal Labs does agile. I wasn&amp;#8217;t sure what the talk would be like but we do agile/scrum at my job. It&amp;#8217;s not always been the smoothest process. I was curious to see how an experienced agile firm like Pivotal does it.&lt;/p&gt;

&lt;p&gt;Pivotal is heavily into pairing (maybe even exclusively pairing). They even go so far as to eliminate personal workspace and create nothing but pairing stations. Part of me thinks this is crazy yet I can see the value. I&amp;#8217;ve been at this for 15 years so I&amp;#8217;m willing to admit my reluctance could be just as much ingrained habit as real rejection of the notion. Lately, our team has been doing this on their own. About half our team has effectively left their personal workspace in preference to a side-by-side setup for more effective pairing.&lt;/p&gt;

&lt;p&gt;I liked that Pivotal seems to make a strong effort to serve their employees. They run an in-house tech library. They have lots of useable displays in conference rooms for meetings. They keep a build monitor up so everyone can always see the state of the continuous integration server. All good stuff.&lt;/p&gt;

&lt;p&gt;My key takeaway though was don&amp;#8217;t go half way on agile and paring. If you are going to do it, really do it.&lt;/p&gt;

&lt;h1 id='closing_keynote'&gt;Closing Keynote&lt;/h1&gt;

&lt;p&gt;The closing was given by Gary Vaynerchuck. I had no idea who he was. I do now.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s hard to describe his keynote accurately. You should just go &lt;a href='http://www.youtube.com/watch?v=-QWHkcCP3tA'&gt;watch&lt;/a&gt; it (warning - lots of adult language).&lt;/p&gt;

&lt;p&gt;Gary is one intense dude. And I think he really is genuine. He is in the same mold as Jason Fried and 37signals. Work hard for your customers, care about what you do. He says all the things you&amp;#8217;d love to hear if you are sick of faceless and gutless corporate entities. He&amp;#8217;s dynamic and certainly inspiring.&lt;/p&gt;

&lt;p&gt;He&amp;#8217;s on my short list of someone I&amp;#8217;d love to have a beer or three with.&lt;/p&gt;

&lt;h1 id='wrap_up'&gt;Wrap Up&lt;/h1&gt;

&lt;p&gt;So there it is. My third RailsConf in the books. Like any conference, there were good and bad sessions. But I love the inspiration I get from being around so many people working on things they care about.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>RailsConf 2010 Day 2</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/06/09/railsconf-2010-day-2.html" rel="alternate" />
		<updated>2010-06-09T22:51:34-07:00</updated>
		<id>tag:ascarter.net,2010-06-09:/2010/06/09/railsconf-2010-day-2</id>
		<content type="html">&lt;p&gt;The second day of RailsConf was another long one. My session choices were more misses than hits today.&lt;/p&gt;

&lt;h1 id='keynote'&gt;Keynote&lt;/h1&gt;

&lt;p&gt;I didn&amp;#8217;t find either the keynote by Neal Ford or Evan Phoenix particularly compelling. Neal Ford riffed on the idea coding as art. They may be some truth to that but I didn&amp;#8217;t find it reasonating with the audience. Evan&amp;#8217;s keynote was more of a skit. The premise was supposed to be Engine Yard&amp;#8217;s usage of open source. That&amp;#8217;s certainly not what he talked about.&lt;/p&gt;

&lt;h1 id='million_dollar_mongo'&gt;Million Dollar Mongo&lt;/h1&gt;

&lt;p&gt;I made a last minute decision to go to Obie Fernandez&amp;#8217;s case study of Hashrocket&amp;#8217;s application of MongoDB. One of my goals for this conference was to understand the implications of No-SQL solutions. I also respect Obie&amp;#8217;s work, particularly his book Rails Way.&lt;/p&gt;

&lt;p&gt;The presentation was mostly good. They made a strong case for why they chose MongoDB. They also highlighted political pitfalls they encountered. None of the issues they experienced seemed to be technical. It&amp;#8217;s likely common to meet with the kind of resistance they encountered when changing out such a fundamental systme. It is good to know that the technical merits seem to hold up.&lt;/p&gt;

&lt;p&gt;The Hashrocket guys ended with a surprise airing of dirty laundry between them and another firm Intridea. While Hashrocket might have some legitimate issues with Intridea, it seemed a rather brash thing to do to call them out publicly at a developer conference. I don&amp;#8217;t care much for the soap-opera stuff.&lt;/p&gt;

&lt;p&gt;I skipped the RVM talk to go to this one. I think that was still the right thing to do. Wayne has done such an amazing job with his documentation and support, I didn&amp;#8217;t feel I needed to go the session.&lt;/p&gt;

&lt;h1 id='redis_rails_and_resque'&gt;Redis, Rails, and Resque&lt;/h1&gt;

&lt;p&gt;Next up was Chris Wanstrath&amp;#8217;s talk on how GitHub uses Redis, Rails, and Resque. It was a good talk. But Chris really needs to calm down. He goes at breakneck speed and without slides. So I was furiously making notes as he was flying along.&lt;/p&gt;

&lt;p&gt;Chris did a great job in setting up the parts and what they are used for. Redis looks like a fantastic piece of software. If the performance is anywhere near memcache, Redis is a much better solution than memcache.&lt;/p&gt;

&lt;p&gt;He spent a fair amount of time discussion Unicorn. I was a little surprised by that until he connected it up with how Resque works. They both have similar philosophies in that they leverage Unix. They handle child processes in very similar fashion.&lt;/p&gt;

&lt;p&gt;Chris explained how GitHub had used Delayed Job (which we use currently). He highlighted the issues they had with it (which we have also seen to a small degree). The management piece and the dependency on SQL seemed to be the two biggest reasons they moved off Delayed Job.&lt;/p&gt;

&lt;p&gt;Their current solution is to use Resque. Resque is very light in that it is a thin wrapper around the Redis API. In particular, I really liked the concept of using named queues over priorities. We absolutely could use that right now. We had issues with how priorities are implemented in Delayed Job. Consequently, we don&amp;#8217;t use priority despite the fact we really need it.&lt;/p&gt;

&lt;p&gt;Resque is a master process that forks child processes to run the jobs. This means each job runs in its own clean process space. That&amp;#8217;s a very good characteristic.&lt;/p&gt;

&lt;p&gt;Resque uses a plugins interface that allows the user to define much of the job capabilities.&lt;/p&gt;

&lt;p&gt;I don&amp;#8217;t like the idea of swapping out our background processing yet again but I think it will only be a matter of time before we move to Redis/Resque.&lt;/p&gt;

&lt;h1 id='cassandra__cassandraobject'&gt;Cassandra &amp;amp; CassandraObject&lt;/h1&gt;

&lt;p&gt;The next talk I went to was Michael Koziarski&amp;#8217;s presentation on Cassandra. I was interested in finding out what Cassandra is about compared to MongoDB. It has a very nice distribution model that allows you to introduce fault tolerance into the store. Depending on the configuration, any key you add to the store can be in 1 or more nodes. Consistency can be simply recording it on one node to using a quorum to determine the correct value. It seems a little like RAID for your key value store.&lt;/p&gt;

&lt;p&gt;While I liked the architecture, I didn&amp;#8217;t like the way data is structured. This is not a document system like Mongo or Couch. It defines a &lt;em&gt;columns&lt;/em&gt; concept that is not the same as relational. It&amp;#8217;s more of a two level JSON object.&lt;/p&gt;

&lt;p&gt;Cassandra on the surface doesn&amp;#8217;t fit the usage we would need. MongoDB seems like a more logical fit.&lt;/p&gt;

&lt;h1 id='rocket_fueled_cucumbers'&gt;Rocket Fueled Cucumbers&lt;/h1&gt;

&lt;p&gt;Joseph Wilk gave a very good presentation on managing large sets of Cucumber features and what happens when the build time gets large. The primary tips would apply to any test framework, not just cucumber.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Development favors speed over confidence&lt;/li&gt;

&lt;li&gt;Test favors confidence over speed&lt;/li&gt;

&lt;li&gt;10 minutes is a good target for a test run&lt;/li&gt;

&lt;li&gt;Use Spork to help with Rails startup time in cucumber&lt;/li&gt;

&lt;li&gt;Mock services that are slow&lt;/li&gt;

&lt;li&gt;Cucover as a coverage aid&lt;/li&gt;

&lt;li&gt;Run the tests more likely to fail frequently, the ones that never fail less&lt;/li&gt;

&lt;li&gt;Worry about the tests that matter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two other interesting tools were highlighted by Joseph. One is Capybara as a better webrat. The other is a javascript environment that doesn&amp;#8217;t use a browser called envjs. Both looked like good cucumber aids.&lt;/p&gt;

&lt;h1 id='beyond_no_sql'&gt;Beyond (No) SQL&lt;/h1&gt;

&lt;p&gt;Sarah Mei from Pivotal Labs gave what turned out to be a very brief talk on No-SQL vs. relational. While I think she had good knowledge, it was not an indepth talk. It was really databases 101. The tradeoffs between relational and No-SQL was interesting. However, it was not the talk I had hoped it would be.&lt;/p&gt;

&lt;h1 id='lightning_talks'&gt;Lightning Talks&lt;/h1&gt;

&lt;p&gt;Since the No-SQL talk was so short, I caught part of the lightning talks. It always great to see people talk about projects that they have so much passion about.&lt;/p&gt;

&lt;h1 id='closing_keynote'&gt;Closing Keynote&lt;/h1&gt;

&lt;p&gt;Derek Sivers (of CD Baby fame) gave an entertaining talk. His personal story and relating how finding a way to work with others is important is a good lesson. He spent a lot of time developing CD Baby himself on a custom PHP framework. That proved difficult to expand with other developers of course. He has come back to looking at Rails seriously. I don&amp;#8217;t know that I got much useful information but it as a nice talk nonetheless.&lt;/p&gt;

&lt;h1 id='closing_thoughts'&gt;Closing Thoughts&lt;/h1&gt;

&lt;p&gt;Tomorrow is the closing of the conference. The talks are usually a little more erratic on the last day but I&amp;#8217;m hoping to pick up a few things. I haven&amp;#8217;t seen much on Javascript. I expected a little more in this area or I managed to miss those talks.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>RailsConf 2010 Day 1</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/06/08/railsconf-2010-day-1.html" rel="alternate" />
		<updated>2010-06-08T23:08:25-07:00</updated>
		<id>tag:ascarter.net,2010-06-08:/2010/06/08/railsconf-2010-day-1</id>
		<content type="html">&lt;h1 id='keynote'&gt;Keynote&lt;/h1&gt;

&lt;p&gt;David Heinemeier Hansson and Michael Feathers each spoke at the &lt;a href='http://railsconf.blip.tv/'&gt;opening keynote&lt;/a&gt;. &lt;a href='http://s3.amazonaws.com/dhhmix/rails3-railsconf2010.pdf'&gt;David&amp;#8217;s talk&lt;/a&gt; captures what Rails 3 is about. Incremental, steady change. It&amp;#8217;s all about improvements and making stuff easier without breaking what has worked well. This was the first time I&amp;#8217;ve seen the new ActiveRelation syntax in any detail. It looks like a major improvement.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a flavor of the new query syntax:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Chaining works
# SELECT * FROM users WHERE name = &amp;quot;david&amp;quot; LIMIT 20
users = Users.where(:name =&amp;gt; &amp;quot;David&amp;quot;).limit(20)
users.where(&amp;quot;age &amp;gt; 29&amp;quot;)

# Lazy execution. Can build up the query until
# a call is made that needs the data!
# SELECT * FROM USERS
# WHERE name = &amp;quot;david&amp;quot; AND age &amp;gt; 29
# ORDER BY name
# LIMIT 20
users.order(:name).each { |user| puts user.name }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There are also nice improvements for the &lt;code&gt;:scope&lt;/code&gt; syntax supporting the ActiveRelation syntax. I&amp;#8217;m not clear about what happens if you add conflicting conditions.&lt;/p&gt;

&lt;p&gt;Another nice improvement is in the routes functionality. RESTful routes are accepted as the norm and the syntax reflects this. It requires more code now to declare a resource route but it makes much more sense:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;resources :people do
  resource :avatar

  member do
    get  :republish_deep_links
    post :resend
    put  :accessible_projects, :upload_preferences
  end
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I find it much easier to understand despite the fact that it is more lines of code.&lt;/p&gt;

&lt;p&gt;Finally, David touched on a couple ideas for Rails 3.1. He called out how CSS and Javascript are in the &amp;#8220;junk drawer&amp;#8221; known as public. These files really deserve to be in the &lt;code&gt;app/&lt;/code&gt; hierarchy. I totally agree. I always find it annoying to search for Javascript and CSS in public. Additionally, he thinks that all javascript and CSS should be compiled into a single file like &lt;code&gt;application.js&lt;/code&gt; and &lt;code&gt;application.css&lt;/code&gt;. I agree with this as well. Like David said, we are all compiling and minifying Javascript anyway.&lt;/p&gt;

&lt;p&gt;Michael Feathers gave the other keynote talk. It was focused on dealing with legacy code. While it is necessary, I didn&amp;#8217;t find much in his talk compelling. I did like his advice to &amp;#8220;cut your losses&amp;#8221;. I agree that often rewriting code can be a better solution than fixing something that is fundamentally flawed.&lt;/p&gt;

&lt;h1 id='builing_apis_with_rails'&gt;Builing API&amp;#8217;s with Rails&lt;/h1&gt;

&lt;p&gt;This talk was on building an API for your Rails application. It was a panel format with Joe Ferris (thoughtbot), Jeremy Kemper (37signals), Marcel Molina (Twitter), Rick Olson (GitHub), and Derek Willis (NY Times). Most people seemed disappointed by this session and I would agree. Some of the stuff was pretty obvious to anyone who has built an API. It wasn&amp;#8217;t very deep technically. All the panelists emphasized using OAuth. The other takeaway was that versioning is pointless and you should support multiple versions only long enough to get your clients off the old API and onto a new one.&lt;/p&gt;

&lt;h1 id='dont_repeat_yourself_repeat_others'&gt;Don&amp;#8217;t Repeat Yourself, Repeat Others&lt;/h1&gt;

&lt;p&gt;John Nunemaker presented a lessons learned talk from his experience building &lt;a href='http://mongomapper.com'&gt;MongoMapper&lt;/a&gt;. If anything, it was an enjoyable talk (although John should slow down a bit - he really goes fast). He made some great points about the value of just creating. Reinventing the wheel can be ok if it provides insight you would not otherwise have. The rest of it was pretty standard stuff - apply patterns, understand how dynamic Ruby is, steal from others.&lt;/p&gt;

&lt;h1 id='the_present_future_of_oauth'&gt;The Present Future of OAuth&lt;/h1&gt;

&lt;p&gt;Michael Bleigh&amp;#8217;s talk was a nice survey of the state of OAuth. OAuth has been on my list of things to review for a long time. It seems like now is the right time to get on board. The most useful metaphor was Michael&amp;#8217;s desription of OAuth tokens being like hotel keys. That&amp;#8217;s a great analogy. It gets to the heart of what OAuth does - provide limited access for limited time.&lt;/p&gt;

&lt;p&gt;I would have like him to touch on OpenID as well. I know they aren&amp;#8217;t directly related (OAuth is service to service, OpenID is user identity) but it is interesting to think about a user on your site logging in with his Twitter OpenID and then accessing Twitter via your site via OAuth.&lt;/p&gt;

&lt;p&gt;Consuming OAuth seems very easy given there is a gem for it. Acting as a provider is a bit more complicated in that you have to write it yourself. My largest concern is with the flows. These allow for different ways of accessing the site (web server, mobile, device, password, etc). Something about all the flows seem poised to be a problem (6 different flows in the spec).&lt;/p&gt;

&lt;h1 id='bundler'&gt;Bundler&lt;/h1&gt;

&lt;p&gt;This was the most useful talk of the day for me. I admit I have ignored &lt;a href='http://gembundler.com'&gt;Bundler&lt;/a&gt; for the most part. I have had bundling fatigue after using config.gem and the merb bundler. However, the Bundler gem surprised me. Every question I would ask was answered. It clearly is going to solve our deployment issues. It is also now compatible with RVM which means you can pair the two for creating just the right gems and Ruby interpreter.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s the short list of why I&amp;#8217;m excited about bundler:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gemfile as a single manifest (and can be versioned)&lt;/li&gt;

&lt;li&gt;Dependency resolution before install (so no more conflicting gem versions)&lt;/li&gt;

&lt;li&gt;Lock version at install time (even if you don&amp;#8217;t provide a version)&lt;/li&gt;

&lt;li&gt;Allow gems to be used directly from git repos (local and remote)&lt;/li&gt;

&lt;li&gt;bundle install vendor eliminates the need for RPM&amp;#8217;s for native gems&lt;/li&gt;

&lt;li&gt;Multiplatform support (MacOSX for dev and Linux for deploy)&lt;/li&gt;

&lt;li&gt;Can be used for Rails 2.x&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I see no critical downsides in going with Bundler. I&amp;#8217;ll be looking to get it in place for our existing 2.3.5 apps soon.&lt;/p&gt;

&lt;h1 id='ruby_tips'&gt;Ruby Tips&lt;/h1&gt;

&lt;p&gt;Evan Phoenix and Charles Nutter were the presenters in the last session I attended. The talk was fun but honestly not that useful. It dove into some metaprogramming concepts that I haven&amp;#8217;t seen the need to use. The threading advice was solid but anyone who&amp;#8217;s written threaded programs (Ruby or otherwise) probably knew these tips. I am confused though on how good Ruby 1.9.x (MRI) is at running threads.&lt;/p&gt;

&lt;h1 id='closing_thoughts'&gt;Closing Thoughts&lt;/h1&gt;

&lt;p&gt;As usual, RailsConf was an exciting torrent of information. I&amp;#8217;m very experienced now in Ruby and Rails so I don&amp;#8217;t get overwhelmed like when I first started with it. Now my brain goes into overdrive as I think about all the ways to leverage the new ideas.&lt;/p&gt;

&lt;p&gt;There is certainly a different vibe to this conference. Maybe it is being in Baltimore instead of the west. But it does feel a little more like the rebel is giving way to the pragmatic. I sense more people are more interested in getting things done with Rails and less about changing the world. It&amp;#8217;s a natural progression. In many ways Rails 3 reflects this new maturity. It&amp;#8217;s still the toolset to beat. I think the second decade of Rails will see many more good things.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>RailsConf 2010</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/06/07/railsconf-2010.html" rel="alternate" />
		<updated>2010-06-07T05:57:56-07:00</updated>
		<id>tag:ascarter.net,2010-06-07:/2010/06/07/railsconf-2010</id>
		<content type="html">&lt;p&gt;I&amp;#8217;m off to &lt;a href='http://en.oreilly.com/rails2010'&gt;RailsConf&lt;/a&gt; in Baltimore. This should be a great conference. Rails 3 will be a centerpiece. I&amp;#8217;m particularly looking forward to learing about all the great scalability solutions including Redis and the various No-SQL storage solutions.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m going to go to more UI and Javascript talks this year. I&amp;#8217;m very experienced on the back end solutions so I want to look at things I don&amp;#8217;t know as well. Also plan to explore the test driven talks. I&amp;#8217;ve been at odds with both RSpec and Cucumber and would like to overcome that.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m going to try out &lt;a href='http://ascarter.tumblr.com'&gt;Tumblr&lt;/a&gt; for quick posts I come across during the conference. I also plan to do a daily write up.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>Ruby Version Manager</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/05/30/ruby-version-manager.html" rel="alternate" />
		<updated>2010-05-30T20:48:50-07:00</updated>
		<id>tag:ascarter.net,2010-05-30:/2010/05/30/ruby-version-manager</id>
		<content type="html">&lt;p&gt;Framework library and dependency management is always a concern when developing software. For a rapidly changing system like &lt;a href='http://www.ruby-lang.org'&gt;Ruby&lt;/a&gt;, it is an even bigger issue. Take the upcoming Rails 3 release as an example. I would like to begin using Rails 3 to create new projects. At the same time, I have existing projects I don&amp;#8217;t want to convert. You can have multiple versions of gems installed and use version references to determine which one to use. It doesn&amp;#8217;t take long before you build up a large set of gems with multiple versions. Compounding this problem, if you want to use a different Ruby interpreter (like the 1.9.1 version), you now need to manage both the interpreter and the gems.&lt;/p&gt;

&lt;p&gt;Thankfully, Wayne Seguin has created an excellent solution with &lt;a href='http://rvm.beginrescueend.com/'&gt;Ruby Version Manager&lt;/a&gt;. RVM is an elegant tool for both managing the Ruby interpreter and gems. It also allows you to create custom sets of gems for your application.&lt;/p&gt;

&lt;p&gt;RVM leverages a very basic notion in Ruby. Using the right paths, you can sandbox a Ruby interpreter and point it at any set of gems you wish. For example, you could create &lt;code&gt;/usr/local/ruby1.8&lt;/code&gt; and &lt;code&gt;/usr/local/ruby1.9&lt;/code&gt; directories. Inside each of those you could build a version of ruby and then install a separate version of Rubygems. By setting the paths correctly, you can run two different configurations.&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s the basic idea behind RVM. I created a crude version of this for our production system. We install what we need into a user space account and use environment settings to control what is run. Our solution is hand-crafted and is not very flexible. It was custom built for our specific application. Using it again would take a fair amount of work.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m sure I&amp;#8217;m not the only one to come up with something like this. Many other people likely have their own variation of this approach. If you have done any work with Java, this should sound very familiar (installing a specific JDK/JRE for an application).&lt;/p&gt;

&lt;p&gt;RVM does the same thing while providing a wonderful set of tools and management utilities. It is so good that I think the best approach for Ruby development is to take a clean machine and install RVM before writing a single line of code.&lt;/p&gt;

&lt;p&gt;I recently have been switching over all my development to using RVM. I had to undo my previous setup on my primary development machine (MacBook Pro) since I had lots of installed gems for various projects. I plan to roll RVM out to our test and production environments once I get a little more familiar with it.&lt;/p&gt;

&lt;p&gt;RVM runs on Mac OS X, Linux, Solaris, and any other Unix-based environment. My notes are from converting my MacBook Pro to using RVM. For the most part, these instructions should work just fine on Linux.&lt;/p&gt;

&lt;h1 id='restore_default_gems'&gt;Restore default gems&lt;/h1&gt;

&lt;p&gt;If you have been developing with Ruby on Rails for some time, you likely have added numerous gems to your system install. You don&amp;#8217;t have to touch it if you don&amp;#8217;t want to. RVM supports the default system install. Additionally, system components have begun to use Ruby. It is likely you will now have software that expects a version of Ruby to be installed.&lt;/p&gt;

&lt;p&gt;I decided I wanted to sandbox all my Rails development and restore my system to the original Ruby install. I figure I can get the best of both worlds. I have a system version of Ruby that I can always fall back on while setting up any number of Ruby configurations for development and experimentation.&lt;/p&gt;

&lt;p&gt;It turns out to be easy to restore a Mac to the default configuration. Apple has divided the standard ruby install into several directories. The system versions are masked when you install gems or update. The two directories involved are &lt;code&gt;/usr/lib/ruby/site_ruby&lt;/code&gt; and &lt;code&gt;/usr/lib/ruby/user-gems&lt;/code&gt;. These two directories in reality are symlinks to directories in &lt;code&gt;/Library/Ruby&lt;/code&gt;. These are what you need to cleanup to get back to the defaults which are kept in &lt;code&gt;/usr/lib/ruby/1.8&lt;/code&gt; and &lt;code&gt;/usr/lib/ruby/gems&lt;/code&gt;. If you want to play it safe, you can tar ball the entire &lt;code&gt;/usr/lib/ruby&lt;/code&gt; directory first. You can also go through and uninstall each gem individually.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ cd /usr/lib/ruby/site_ruby/1.8
$ sudo rm -Rf gauntlet_rubygems.rb rbconfig/ rubygems/ rubygems.rb ubygems.rb
$ cd ../../user-gems/1.8
$ sudo rm -Rf */**&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now you should have a Ruby setup that looks just like a new Snow Leopard install. It is likely the last time you will use the Apple supplied version of Ruby.&lt;/p&gt;

&lt;h1 id='install_and_setup'&gt;Install and setup&lt;/h1&gt;

&lt;p&gt;RVM can be installed from source or via a gem. Wayne takes an unusual approach for supporting RVM. If you catch him on IRC, he will often fix the problem right there and commit the fix to the GitHub repository. Consequently, it is best to install directly from GitHub in order to easily pull changes.&lt;/p&gt;

&lt;p&gt;There is a bootstrap script that you can run to get RVM installed. It will create a &lt;code&gt;~/.rvm&lt;/code&gt; directory, use git to clone the repository, and check it out:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ bash &amp;lt; &amp;lt;( curl http://rvm.beginrescueend.com/releases/rvm-install-head )&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once it is installed, you should update your shell profile. You need to run the RVM script to add it to the path and initialize the RVM environment. You can also optionally add the RVM environment to your prompt and add bash completion. The following can be added to your &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if [[ -s &amp;quot;$HOME/.rvm/scripts/rvm&amp;quot; ]] ; then source &amp;quot;$HOME/.rvm/scripts/rvm&amp;quot; ; fi
PS1=&amp;quot;\$(~/.rvm/bin/rvm-prompt) $PS1&amp;quot;
if [[ -r $rvm_path/scripts/completion ]] ; then source $rvm_path/scripts/completion ; fi&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After install, you can update RVM itself at any time using the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm update --head&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will update the git enlistment and update any RVM components.&lt;/p&gt;

&lt;h1 id='rvm_command_line'&gt;RVM Command Line&lt;/h1&gt;

&lt;p&gt;All commands follow a standard structure:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rvm action [interpreter] [flags] [options]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Use &lt;code&gt;rvm --help&lt;/code&gt; will explain all the available commands.&lt;/p&gt;

&lt;p&gt;The available interpreters include the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ruby      - MRI/YARV Ruby {1.8.6,1.8.7,1.9.1,1.9.2...}
jruby     - JRuby, Ruby interpreter on the Java Virtual Machine.
rbx       - Rubinius
ree       - Ruby Enterprise Edition
macruby   - MacRuby
maglev    - GemStone Ruby
mput      - shyouhei(mput)&amp;#39;s github repository
system    - use the system ruby (eg. pre-rvm state)
default   - use rvm set default ruby and system if it hasn&amp;#39;t been set.&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, all the important Ruby implementations are available. You are able to pick which interpreter and version you want to use. RVM will download the source and build it. Then it will create a private gem instance for any interpreter installed.&lt;/p&gt;

&lt;h1 id='install_a_ruby_interpreter'&gt;Install a Ruby Interpreter&lt;/h1&gt;

&lt;p&gt;Installing a specific Ruby is easy. The following commands install two different Ruby interpreters:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm install ruby-1.8.7
$ rvm install ruby-1.9.1-p378&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After install, you will now have Ruby version 1.8.7p238 and Ruby 1.9.1p378. Use &lt;code&gt;rvm list&lt;/code&gt; to see what is installed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm list

rvm rubies

=&amp;gt; ruby-1.8.7-p249 [ x86_64 ]
   ruby-1.9.1-p378 [ x86_64 ]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When installing, you can provide just a version number to get the current stable version for that line. You provide a specific patch version as well.&lt;/p&gt;

&lt;p&gt;To use a ruby version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm use ruby-1.9.1-p378
$ ruby --version
Using ruby 1.9.1 p378
$ ruby --version
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.3.0]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You now are using Ruby 1.9.1 instead of the system version.&lt;/p&gt;

&lt;p&gt;To choose a default:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm --default ruby-1.8.7&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id='gemsets'&gt;Gemsets&lt;/h1&gt;

&lt;p&gt;Now that you can install multiple version of the ruby interpreter, the next step is to manage gems. When installing, a base set of gems is automatically setup. By default, the only gems are:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ gem list

*** LOCAL GEMS ***

rake (0.8.7)
rdoc (2.5.8)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The standard gem commands are used to install other gems just like normal. The one thing to keep in mind is that these run in &lt;strong&gt;user space&lt;/strong&gt; - you don&amp;#8217;t need to use &lt;code&gt;sudo&lt;/code&gt; for any of them.&lt;/p&gt;

&lt;p&gt;It gets even better. You can also define custom sets of gems. This means you can swap out completely different gem configurations easily. For example, you might want to test your application against multiple versions of Rails. Create a separate gemset for each Rails version and then swap them out to test them.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm gemset create rails238 rails222
$ rvm ruby-1.8.7@rails238
$ gem install rails -v 2.3.8
$ rvm ruby-1.8.7@rails222
$ gem install rails -v 2.2.2&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Gemsets can be copied, exported, and imported as well. The special gemset &lt;code&gt;@global&lt;/code&gt; is a template used when creating a gemset.&lt;/p&gt;

&lt;h1 id='perproject_rvm'&gt;Per-Project RVM&lt;/h1&gt;

&lt;p&gt;The last thing I&amp;#8217;ll explain is using RVM at the project level. This is an incredibly powerful feature. Using a file in the root of your project, you can automatically run a ruby interpreter and gemset anytime you change to that path.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ rvm ruby-1.8.7@rails238
$ cd Projects
$ rails mytestproject
$ echo &amp;quot;rvm ruby-1.8.7@rails238&amp;quot; &amp;gt; mytestproject/.rvmrc
$ rvm ruby-1.8.7@rails222
$ rails --version
Rails 2.2.2
$ cd mytestproject
$ rails --version
Rails 2.3.8
$ gem env gemdir
/Users/andrew/.rvm/gems/ruby-1.8.7-p249@rails2.3.8&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id='using_rvm_in_dev_test_and_production'&gt;Using RVM in Dev, Test, and Production&lt;/h1&gt;

&lt;p&gt;Using RVM for development is a major asset. It becomes much easier to manage multiple versions as well as experiment with new features. These attributes can carry over into Test and Production as well. It can be used to stabilize the base Ruby configuration you use in each environment. Since it can bootstrap itself via source installs, it is easy to script and setup. It also normally runs in user space instead of privileged root. This is a major security advantage.&lt;/p&gt;

&lt;p&gt;The RVM website has lots more information. I&amp;#8217;ve barely scratched the surface. The RVM project is extremely active and should be a primary tool for any Rails developer.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>Rails Development on Ubuntu 10.04</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html" rel="alternate" />
		<updated>2010-05-10T22:31:33-07:00</updated>
		<id>tag:ascarter.net,2010-05-10:/2010/05/10/rails-development-on-ubuntu-10.04</id>
		<content type="html">&lt;p&gt;April means a new release of &lt;a href='http://ubuntu.com/'&gt;Ubuntu&lt;/a&gt;. This time is version 10.04 which is also a long term release. It should be a particularly good version to adopt given the long support cycle.&lt;/p&gt;

&lt;p&gt;I previously posted my recipe for setting up &lt;a href='http://ascarter.net/2010/01/04/rails-development-on-ubuntu-9.10.html'&gt;Rails on Ubuntu 9.10&lt;/a&gt;. Most of the recipe is still valid. For convenience, I&amp;#8217;m reposting the entire recipe with updates for Ubuntu 10.04&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This recipe is based on my own experience and is what I recommend. You will find many other ways to do this. I highly recommend you study each step and understand what packages or functionality you are enabling. When it comes time to deploy to production, you want a minimal configuration.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id='assumptions'&gt;Assumptions&lt;/h1&gt;

&lt;p&gt;The steps are done assuming a new clean install of Ubuntu 10.04. I use 64-bit Alternate for my installs. It should be nearly identical for 32-bit, Desktop, and Server installs as well. I&amp;#8217;ll use &lt;code&gt;apt-*&lt;/code&gt; commands so you can do everything from the command line. Use synaptic or dpkg if you wish.&lt;/p&gt;

&lt;h1 id='prerequisites'&gt;Pre-requisites&lt;/h1&gt;

&lt;p&gt;By default, Ubuntu now ships with GCC and everything you need to compile out of the box. I found you no longer need to install any packages to start compiling. Inclusion of a &lt;strong&gt;C&lt;/strong&gt; compiler should be a basic computing right. No computer should ever be without one.&lt;/p&gt;

&lt;h1 id='ruby'&gt;Ruby&lt;/h1&gt;

&lt;p&gt;Ubuntu 10.04 includes both Ruby 1.8 and 1.9 in the package system. Ruby 1.8 is still more widely used for Rails development. With Rails 3 looming on the horizon, Ruby 1.9 finally looks poised to take over. I think it is highly likely Ruby 1.9.2 and Rails 3 will be the standard configuration by the end of 2010. Until then, you should stick with Ruby 1.8. Note that you can install Ruby 1.8 and 1.9 side by side. However, a much better solution is to use &lt;a href='http://rvm.beginrescueend.com/'&gt;Ruby Version Manager (RVM)&lt;/a&gt; instead. RVM lets you install Ruby and matching gems for multiple verisons. More on this later but it is definitely the way to go.&lt;/p&gt;

&lt;p&gt;For now, install the default Ruby 1.8 stack. This allows you to get up and running. Also, other non-Rails packages may need Ruby support. It is good to have Ruby 1.8 as a base Ruby install for things other than development.&lt;/p&gt;

&lt;p&gt;There are a couple other libraries you should install from packages as well. These include native libraries for SSL and readline. I also install RDoc, RI and irb from packages. You need to install &lt;code&gt;ruby-dev&lt;/code&gt; to be able to compile native ruby gems later.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s the install for the ruby stack:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Another optional install is the first edition of the &lt;a href='http://www.ruby-doc.org/docs/ProgrammingRuby/'&gt;Ruby Book&lt;/a&gt;. It might be handy but you do have a &lt;a href='http://www.pragprog.com/titles/ruby3/programming-ruby-1-9'&gt;newer version&lt;/a&gt; than that don&amp;#8217;t you?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install rubybook&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It will be installed to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/usr/share/doc/rubybook/html/index.html&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id='rubygems'&gt;Rubygems&lt;/h1&gt;

&lt;p&gt;So far, setup has been easy since everything comes from the package system. Now we start to deviate. Rubygems has been a &lt;a href='http://pkg-ruby-extras.alioth.debian.org/rubygems.html'&gt;source of contention&lt;/a&gt; between Debian and the Rubygems developers. The core problem is that both are package systems. Rubygems can (and arguably should) manage all gem packages. On Debian systems, dpkg should own all the packages installed in the system. This could include gems as well. This is where the friction starts.&lt;/p&gt;

&lt;p&gt;No matter which side of the argument you might find yourself, the good news is that installing rubygems from source is easy. Building it installs in the system location anyway since that is where Ruby already is installed. The net result is basically the same. The advantage is you can update Rubygems directly. The package system will trail far behind new gem builds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My rule for gems:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Only use apt to install supporting C-libraries to allow native gems to build. Install gems themselves via a source install for rubygems.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When I build from source and install to the system, I prefer to put the source in &lt;code&gt;/usr/local/src&lt;/code&gt;. But feel free to install anywhere you like. To install rubygems, you need to download the latest tarball. As of this writing, it is 1.3.6. Then extract the archive and install:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd /usr/local/src
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz
tar xzvf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The gem binary is now installed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/usr/bin/gem1.8&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you want to have &lt;code&gt;gem&lt;/code&gt; point to the 1.8 binary:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, run a gem system update to be sure you are on the latest version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem update --system&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Rubygems should now be installed and ready to go.&lt;/p&gt;

&lt;h1 id='rails_and_other_gems'&gt;Rails and Other Gems&lt;/h1&gt;

&lt;p&gt;Rubygems installs dependencies automatically. Installing the Rails gem which will bring in ActionPack, ActiveRecord, and other supporting gems.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem install rails SystemTimer ruby-debug ruby-debug-ide&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The following are a few useful tools that are delivered via gems:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem install cheat ghost gist&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id='imagemagickrmagick'&gt;ImageMagick/RMagick&lt;/h3&gt;

&lt;p&gt;Unlike on Mac OS X, &lt;a href='http://www.imagemagick.org/'&gt;ImageMagick&lt;/a&gt; and &lt;a href='http://rmagick.rubyforge.org/'&gt;RMagick&lt;/a&gt; are very easy to install:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install imagemagick libmagickcore-dev
sudo gem install rmagick&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id='databases'&gt;Databases&lt;/h1&gt;

&lt;p&gt;The database landscape is changing. Choices in the RDMS space have become more complicated. The rise of document oriented storage systems (aka NoSQL) has added yet another dimension.&lt;/p&gt;

&lt;p&gt;For most developers, RDMS is likely the best choice. You should install two different database systems. One is for development and the other is for production.&lt;/p&gt;

&lt;p&gt;If you can, you should use &lt;a href='http://sqlite.org'&gt;SQLite&lt;/a&gt; for doing development. It requires no configuration and is well supported by Rails. You will never &lt;strong&gt;ever&lt;/strong&gt; go to production on SQLite. The lack of concurrency is a deal breaker.&lt;/p&gt;

&lt;p&gt;For production, you will want a traditionally client/server RDBMS system. The two most popular are &lt;a href='http://mysql.com'&gt;MySQL&lt;/a&gt; and &lt;a href='http://postgresql.org'&gt;PostgreSQL&lt;/a&gt;. &lt;a href='http://oracle.com'&gt;Oracle&lt;/a&gt; is another choice if your company is already invested heavily in Oracle. The open source RDBMS systems are better supported since more developers have access to them.&lt;/p&gt;

&lt;p&gt;This is a religious topic. There are of course numbers that can prove one is better than another. But cost is likely a large consideration. Other issues include support and licensing. I&amp;#8217;ve used MySQL, PostgreSQL, and Oracle in Rails projects (and SQL Server extensively for non-Rails/.NET projects).&lt;/p&gt;

&lt;p&gt;Until recently, MySQL has been my recommendation. However, I&amp;#8217;ve personally been moving away from MySQL and onto PostgreSQL. I&amp;#8217;m writing that up as a separate future post. For now, I&amp;#8217;ll provide instructions to setup the basic infrastructure.&lt;/p&gt;

&lt;h3 id='sqlite'&gt;SQLite&lt;/h3&gt;

&lt;p&gt;SQLite is now the default database a Rails application will use. It is easy since the database is kept in a local file and doesn&amp;#8217;t require any server setup. Note that SQLite is not a good choice if you need to do concurrency development of any kind. SQLite is not a server. Sharing the database on multiple instances of your Rails app isn&amp;#8217;t going to go well.&lt;/p&gt;

&lt;p&gt;SQLite is fully supported in the Ubuntu package system. Install the SQLite binaries and libraries, then install the native SQLite gem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install libsqlite3-dev sqlite3 sqlite3-doc
sudo gem install sqlite3-ruby&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id='mysql'&gt;MySQL&lt;/h3&gt;

&lt;p&gt;Unlike on the Mac, MySQL is very easy to setup on Ubuntu. For 10.04, MySQL 5.1 is the default:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install libmysqlclient-dev mysql-server
sudo gem install mysql&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id='postgresql'&gt;PostgreSQL&lt;/h3&gt;

&lt;p&gt;Using PostgreSQL locally is also relatively easy to get up and running. For 10.04, PostgreSQL 8.4.3 is the default.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install postgresql postgresql-client postgresql-doc pgadmin3
sudo gem install pg&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id='final_thoughts'&gt;Final Thoughts&lt;/h1&gt;

&lt;p&gt;Ubuntu continues to be a great choice for Ruby on Rails development and deployment. It is very nice to have the same configuration on your Ubuntu desktop and server. Beyond the boot strap phase, most of the rest of your interaction will be via gems.&lt;/p&gt;

&lt;p&gt;I did not cover application server choices yet. The most likely choices are &lt;a href='http://code.macournoyer.com/thin/'&gt;Thin&lt;/a&gt;, &lt;a href='http://www.modrails.com/'&gt;Passenger&lt;/a&gt;, or &lt;a href='http://unicorn.bogomips.org/'&gt;Unicorn&lt;/a&gt;. I&amp;#8217;ll be writing those up in the near future.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>iPad</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/04/04/ipad.html" rel="alternate" />
		<updated>2010-04-04T21:22:14-07:00</updated>
		<id>tag:ascarter.net,2010-04-04:/2010/04/04/ipad</id>
		<content type="html">&lt;p&gt;Like many other people, I got an &lt;a href='http://apple.com/ipad'&gt;iPad&lt;/a&gt; this weekend. From the reports, it sounds like it has been a huge success. I thought I would post my thoughts from both a user and developer perspective. No matter what, this device has shaken up the entire computing world. If anything, it has put a spotlight on how computers and mobile devices are used in the 21st century.&lt;/p&gt;

&lt;h1 id='user_perspective'&gt;User Perspective&lt;/h1&gt;

&lt;p&gt;It&amp;#8217;s hard not to use the cliches Apple touts in their ads. The iPad is truly remarkable. The entire package is typical of Apple - elegant, easy to use, sparse. Performance is very good. The transition to large screen apps is well executed. As expected, it shares a lot of DNA with both Mac OS X and the iPhone operating systems. But it quickly establishes its own identity.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s get this out of the way - the iPad does nothing that you can&amp;#8217;t do with other devices today. But it does it in such a sophisticated manner that it makes using other devices seem pointless. The iPad is by far the best reading/browsing device ever conceived. It is simply superior for reading pages and interacting with sites. As a video device, it may be the most direct interface ever created for watching movies. The book reading applications iBooks and Amazon&amp;#8217;s Kindle are comfortable to use. I&amp;#8217;ve been moving more and more books to epub format and this is the device that makes that shift pay off. Consuming media is at its best with the iPad.&lt;/p&gt;

&lt;p&gt;For creating content, it remains to be seen if it can be adequate. It is fine for short amounts of text and graphics. But I don&amp;#8217;t think the interface has evolved enough yet to satisfy the richness supported by the mouse/keyboard. Using an external keyboard makes text entry painless. However, it is a little clumsy using both a keyboard and the touch interface at the same time.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s not a perfect device. There are lots of areas that can get better. For example, application management (both on the device and in iTunes) are the worst they have ever been. I have about 100 applications in my iTunes library. I&amp;#8217;d say 85-90 of them are free apps. I don&amp;#8217;t load all of them onto my iPhone or the iPad but they have accumulated over time. There is very little assistance in helping you manage which apps are on the device. Just a huge scrolling list that you can check on and off. The Apps source view does separate iPhone, iPad, and universal iPhone/iPad apps into separate groups. None of that carries over to the device section where you configure which apps go on the iPad or iPhone.&lt;/p&gt;

&lt;p&gt;The app management on the iPad is as bad as the iPhone. No groups or any other helpful ways of organizing apps. Just page after page of icons. And to make matters worse, they move when you go from portrait to landscape.&lt;/p&gt;

&lt;p&gt;But these gripes aside, this is a device that has a firm place in the landscape. I see this as my primary device at home. It fills most of what I would do there. I&amp;#8217;ll use my laptop for programming and long text entry. And the iPhone is what I will take for my commute and when I&amp;#8217;m out. But iPad very capably covers email, general web browsing, media, and books in a much more comfortable way than my laptop ever has.&lt;/p&gt;

&lt;h1 id='developer_perspective'&gt;Developer Perspective&lt;/h1&gt;

&lt;p&gt;As anyone who knows me can tell you, I&amp;#8217;m a huge proponent of open source and free software (free as in freedom). But I also think I&amp;#8217;m pragmatic. I don&amp;#8217;t hold a grudge to companies that want to sell software. I think they often are misguided but it&amp;#8217;s their choice. As a software developer myself, I favor selling services over software. My interest specifically in programming iPhone/iPad are for extensions of web services. I think that&amp;#8217;s the model of the future.&lt;/p&gt;

&lt;p&gt;I do wish that the iPad and iPhone were open. The reality is that I can pay $99 a year and put any code I want on my device. I just can&amp;#8217;t sell it. I think that is a bit unfair and unnecessary. I think Apple could solve much of this by simply allowing users to load unauthorized apps at their own risk.&lt;/p&gt;

&lt;p&gt;I also don&amp;#8217;t have a problem with Apple taking a cut for providing the AppStore (although they are completely wrong in how they deal with refunds). I don&amp;#8217;t like the approval process. It would make more sense if the approval process was to get into the AppStore but not as a requisite of getting code on people&amp;#8217;s devices.&lt;/p&gt;

&lt;p&gt;It seems that many pundits lamenting the closed nature of iPad/iPhone development likely wouldn&amp;#8217;t know what to do with the freedom if they had it. So I don&amp;#8217;t pay much attention. It&amp;#8217;s not a great system but it&amp;#8217;s not that bad.&lt;/p&gt;

&lt;p&gt;As for actually writing code for this device, from what I&amp;#8217;ve seen, you will be able to leverage your experience with the iPhone very well. Same Xcode pipeline and supporting tools.&lt;/p&gt;

&lt;p&gt;The real challenge for developers is to first understand using touch input and creating new ways of interfacing with software. Like the Wii in the gaming world, the iPad interface is unlike anything before it. There will be an enormous gulf between those that get how to write software like this and those that don&amp;#8217;t.&lt;/p&gt;

&lt;h1 id='future'&gt;Future&lt;/h1&gt;

&lt;p&gt;I have a 5-year old daughter. It has been intriguing to see her interact with computers and devices. Children instantly gravitate to touch interfaces. It is entirely natural and makes perfect sense to them. She finds it much more awkward to use a mouse and keyboard than to use the Wii, Nintendo DS, or an iPad. All of these eliminate layers of abstraction to get right to it.&lt;/p&gt;

&lt;p&gt;My wife on the other hand has a much harder time in general with computers and technology. She uses computers as a tool. She constantly battles with how counter-intuitive it is. I bought a second iPad for my wife and my daughter to use. I&amp;#8217;m curious to see how they respond. I already know my daughter will get it. My wife though is the perfect test case. If people that use computers as a tool find the iPad better than what they use today, I think the era of tablets and touch interfaces is on. If not, it&amp;#8217;s hard to see this as nothing more than a fad.&lt;/p&gt;

&lt;p&gt;Likewise, those of us that are at the heart of technology need to understand what devices like the iPad are. It is completely wrong to try to compare this with a laptop or focus on what it is missing from the tech specs. There should be no expectation that it replaces a traditional PC or laptop. We shouldn&amp;#8217;t be writing code on an iPad. There are lots of devices that are &amp;#8220;black boxes&amp;#8221; - video game consoles, phones, Tivo, media players, and DVD players to name a few. All of these are computers running code. None of them need to allow me to write the code on the device itself.&lt;/p&gt;

&lt;p&gt;As an aside, look at how up in arms people are now about Playstation 3 removing the install Linux option. As a hacker, I loved that I could install Linux on it. But did I ever do it? No - and even if I had, I have no idea what I would have bothered doing with it. My time would be much better spent hacking on Linux on a PC than on a PS3.&lt;/p&gt;

&lt;p&gt;It is hard not to think that Apple has again created the next phase of personal computing. It is remarkable how much influence one company has had. Apple II launched the personal computer. Macintosh ushered in the graphic user interface. The iPhone redefined personal communication devices. And now it feels like the iPad has begun the era of touch interfaces. I think there is no going back. A new way of using computers is upon us. Whether Apple continues to lead that remains to be seen. They were at the front of the graphic user interface revolution but would eventually relinquish ownership to Microsoft. Only time will tell how this era will play out.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>Homebrew for OS X</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/02/22/homebrew-for-os-x.html" rel="alternate" />
		<updated>2010-02-22T22:10:58-07:00</updated>
		<id>tag:ascarter.net,2010-02-22:/2010/02/22/homebrew-for-os-x</id>
		<content type="html">&lt;p&gt;Most Unix-based platforms have at least one package management system. Some are like &lt;a href='http://debian.org'&gt;Debian&lt;/a&gt; where the package system is one with the operating system. Others are bolted onto the system.&lt;/p&gt;

&lt;p&gt;Mac OS X has had two package systems for many years. &lt;a href='http://www.finkproject.org'&gt;Fink&lt;/a&gt; is a port of the Debian apt system. &lt;a href='http://www.macports.org'&gt;Macports&lt;/a&gt; is primarily a port of the &lt;a href='http://www.freebsd.org'&gt;FreeBSD&lt;/a&gt; ports system. Unlike Linux, both of these are sandboxes that you run on top of the Apple supplied system. In many ways, this is not unlike &lt;a href='http://www.cygwin.com'&gt;Cygwin&lt;/a&gt; for Windows.&lt;/p&gt;

&lt;p&gt;In my opinion, both Fink and Macports suffer from the fact that neither makes an effort to integrate with the core operating system. I already have a tested version of Perl or Python on my system. I&amp;#8217;d rather the package system stuck with this as much as possible.&lt;/p&gt;

&lt;p&gt;Now there is a new package manager on the scene called &lt;a href='http://github.com/mxcl/homebrew'&gt;Homebrew&lt;/a&gt;. I think it is very promising. It is similar in approach to Macports in that you build recipes in a high level scripting language. Macports uses &lt;a href='http://www.tcl.tk/'&gt;TCL&lt;/a&gt; and Homebrew uses my favorite language &lt;a href='http://ruby-lang.org'&gt;Ruby&lt;/a&gt;. Both pull down a source package, configure it, and build the code. Both also manage dependencies and attempt to get other supporting libraries.&lt;/p&gt;

&lt;p&gt;There are three major differences. The first is that Homebrew is trying to augment the existing Mac OS X distribution from Apple. It uses what is already installed as much as it can. The other difference is that recipe development is very simple using Ruby. The last major improvement is that Homebrew is developed on &lt;a href='http://github.com'&gt;GitHub&lt;/a&gt; so forking and submitting recipes is trivial.&lt;/p&gt;

&lt;h1 id='changes_to_default_install'&gt;Changes to Default Install&lt;/h1&gt;

&lt;p&gt;I&amp;#8217;ve spent some time getting familiar with Homebrew the past week or so. I like what I&amp;#8217;ve seen but I don&amp;#8217;t completely agree with the recommended installation. I&amp;#8217;m offering my approach as an alternate.&lt;/p&gt;

&lt;p&gt;There are two things I don&amp;#8217;t agree with. The first is installing Homebrew in &lt;code&gt;/usr/local&lt;/code&gt;. Although Mac OS X surprisingly doesn&amp;#8217;t ship with a default &lt;code&gt;/usr/local&lt;/code&gt; directory, this path has such strong meaning to anyone who uses other Unix systems like Linux. I absolutely expect to download the source to &lt;code&gt;/usr/local/src&lt;/code&gt; and build it by hand.&lt;/p&gt;

&lt;p&gt;The second recommendation I don&amp;#8217;t agree with is to make the Homebrew directory user owned instead of root. This is probably more a matter of preference but I&amp;#8217;d rather mimic the typical behavior of root owning software available system wide. The reasons the Homebrew team give are valid but I guess I&amp;#8217;m stuck in my ways.&lt;/p&gt;

&lt;h1 id='setting_up_homebrew'&gt;Setting up Homebrew&lt;/h1&gt;

&lt;p&gt;The author of Homebrew made a very good decision to allow it to be installed anywhere you want. So the first thing to do is pick where you want your Homebrew install to live. The approach is to put the software into a special directory called &lt;code&gt;HOMEBREW_PATH/Cellar&lt;/code&gt;. Any binaries are symlinked in &lt;code&gt;HOMEBREW/bin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I recommend emulating what Macports does and creating a standalone location for Homebrew. I picked &lt;code&gt;/opt/homebrew&lt;/code&gt; for my install but you can chose whatever you want. I also use root as the owner so my commands will be using &lt;code&gt;sudo&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mkdir -p /opt/homebrew&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, bootstrap an initial install of Homebrew. You can either &lt;code&gt;git clone&lt;/code&gt; the repository directory or pull down a tarball of the master branch:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo -s
cd /opt
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Since I&amp;#8217;ve chosen to install Homebrew into its own directory, I need to make the paths available. Mac OS X uses &lt;code&gt;path_helper&lt;/code&gt; as a way of defining the &lt;code&gt;PATH&lt;/code&gt; and &lt;code&gt;MANPATH&lt;/code&gt; settings. The &lt;code&gt;path_helper&lt;/code&gt; will read &lt;code&gt;/etc/paths&lt;/code&gt; and all entries in &lt;code&gt;/etc/paths.d&lt;/code&gt;. The files are nothing more than a path to add separated by newline. There is a similar arrangement of &lt;code&gt;/etc/manpaths&lt;/code&gt; and &lt;code&gt;/etc/manpaths.d&lt;/code&gt;. If you prefer, you can just add these to your &lt;code&gt;PATH&lt;/code&gt; and &lt;code&gt;MANPATH&lt;/code&gt; variable in your profile:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo -s
echo &amp;quot;/opt/homebrew/bin&amp;quot; &amp;gt; /etc/paths.d/homebrew
echo &amp;quot;/opt/homebrew/share/man&amp;quot; &amp;gt; /etc/manpaths.d/homebrew&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Start up a new shell and test out brew:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo brew list&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You should see nothing installed. Now try installing a package:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo brew install wget&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When it is complete, you should have a &lt;code&gt;/opt/homebrew/bin/wget&lt;/code&gt; symlinked to the binary. There are the typical package options (search, install, uninstall, list). Commands are in the form of &lt;code&gt;brew action formula&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The recipes files are simply Ruby scripts in the &lt;code&gt;HOMEBREW/Library/Formula&lt;/code&gt; directory. These files can be updated. To convert your Homebrew to a git clone:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo brew update&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Your Homebrew directory is now a git clone of the project. This means you can do all the normal cool git activities you want. Create a new branch to test out formula changes. Track other user&amp;#8217;s formulas by adding a git remote. Merge as you please. It is extremely flexible and elegant.&lt;/p&gt;

&lt;p&gt;Homebrew is relatively new. The package list is much smaller than Fink or Macports. But there is a lot of activity around the project and I&amp;#8217;ve already had great interactions with other users creating packages.&lt;/p&gt;

&lt;p&gt;I think the advantage of my layout is that Homebrew is isolated cleanly and I can selectively use it to add packages. I can still install and build software to &lt;code&gt;/usr/local&lt;/code&gt; with no conflicts. For example, I prefer the binary MySQL and Git installs over using the packages since I rely on these packages and don&amp;#8217;t want to deal with any issues building them. For other software like ImageMagick or ffmpeg, Homebrew is a great way to easily add it and keep it up to date.&lt;/p&gt;</content>
	</entry>
	<entry>
		<title>Capistrano Boss</title>
		<author>
			<name>Andrew Carter</name>
		</author>
		<link type="text/html" href="http://ascarter.net/2010/01/27/capistrano-boss.html" rel="alternate" />
		<updated>2010-01-27T22:51:00-07:00</updated>
		<id>tag:ascarter.net,2010-01-27:/2010/01/27/capistrano-boss</id>
		<content type="html">&lt;p&gt;&lt;a href='http://capify.org'&gt;Capistrano&lt;/a&gt; is a very useful deployment management tool widely used for Ruby on Rails production managment. I&amp;#8217;ve used it for over 2 years to manage multiple environments including production, staging, and testing. It is easy to get started with and also easy to extend.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s a tool that is so flexible that the initial reaction is to write a task for everything. The running joke on my team has been that for every question &amp;#8220;can I &amp;#8230;?&amp;#8221;, the answer is &amp;#8220;there&amp;#8217;s a task for that.&amp;#8221; Many times, it was true. Recently, we moved our application from Mongrel to Passenger. I took the opportunity to re-evaluate what tasks we needed. I eliminated all the dangerous stuff (like directly touching the database or loading up script/console via cap). I then extracted the most useful tasks.&lt;/p&gt;

&lt;p&gt;Originally, the extensions were implemented in the &lt;code&gt;lib&lt;/code&gt; folder or in a deployment plugin. Since plugins are not the way to go anymore for Rails, I decided to turn all of that into a gem. Using the fantastic new &lt;a href='http://gemcutter.org'&gt;Gemcutter&lt;/a&gt; tool, I created &lt;a href='http://github.com/ascarter/capistrano-boss'&gt;Capistrano-boss&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are recipes split up in four namespaces: deploy, apache, passenger, and rails. Most are simple but there are a couple that I find very useful. First, apache and rails both support downloading logs (&lt;strong&gt;log:fetch&lt;/strong&gt;) and watching logs in real time (&lt;strong&gt;log:watch&lt;/strong&gt;). The realtime log feature is one we use very frequently. I can&amp;#8217;t even remember where I found the tip originally but it does a &lt;code&gt;tail -f&lt;/code&gt; and marks up the stream with the host and timestamp. It makes it very easy to watch activity on all your servers at once. On a busy server, it can get overwhelming. I intend to put in some filter options for this task at some point.&lt;/p&gt;

&lt;p&gt;The other useful recipes are for managing the &lt;code&gt;database.yml&lt;/code&gt; file. The recipe &lt;strong&gt;rails:config:database&lt;/strong&gt; creates a configuration in &lt;code&gt;#{shared_path}/config/database.yml&lt;/code&gt;. It will prompt for the database password and write it out. This allows you to checkin a clean database.yml without a password into source control. You can easily set it just once in the shared configuation location. When &lt;strong&gt;deploy&lt;/strong&gt; is run, the recipe &lt;strong&gt;rails:deploy:config&lt;/strong&gt; will symlink &lt;code&gt;#{shared_path}/config/database.yml&lt;/code&gt; to &lt;code&gt;#{current_path}/config/database.yml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One other addition is an extension to the way the Subversion repository is determined. The readme explains it but the idea is that you can set &lt;code&gt;:branch&lt;/code&gt; or &lt;code&gt;:tag&lt;/code&gt; and have the repository path adjusted. We used it to set which tag to deploy on the cap command line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cap deploy -s tag=&amp;#39;myrelease&amp;#39;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It assumes the standard subversion layout (branches/tags/trunk) and defaults to using trunk. As of this week though, we have moved to a pure git source control system and (thankfully) will no longer need the subversion support.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m hoping people will fork and submit back their favorite deployment related recipes. My goal is for light weight tasks, not full on configuration management. I headed down that path and it wasn&amp;#8217;t good. Puppet or Chef is probably a beter solution for that. But many Rails applications don&amp;#8217;t need much configuration help and that&amp;#8217;s what I want in capistrano-boss. The source is on &lt;a href='http://github.com/ascarter/capistrano-boss'&gt;Github&lt;/a&gt; and the gem is published on &lt;a href='http://gemcutter.org/gems/capistrano-boss'&gt;Gemcutter&lt;/a&gt;.&lt;/p&gt;</content>
	</entry>
</feed>