<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Christoph Olszowka</title>
  <id>http://colszowka.heroku.com</id>
  <updated>2011-03-29</updated>
  <author>
    <name>Christoph Olszowka</name>
  </author>
  <entry>
    <title>Testing inbound mail with the mail gem</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2011/03/29/testing-inbound-mail-with-the-mail-gem"/>
    <id>http://colszowka.heroku.com/2011/03/29/testing-inbound-mail-with-the-mail-gem</id>
    <published>2011-03-29</published>
    <updated>2011-03-29</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/mail.jpg" alt="Testing inbound mail with the mail gem"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/eole/4500783172/" target="_blank"&gt;eole&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The &lt;a href="https://github.com/mikel/mail"&gt;mail gem&lt;/a&gt; has become the underlying library of Action Mailer with Rails 3, replacing TMail, but it's also capable of receiving email from
a POP3 or IMAP account. I couldn't find any documentation for testing the retrieval, so I figured it out from the source - here's how you can test your inbound mail processing.&lt;/p&gt;
</summary>
    <content type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/mail.jpg" alt="Testing inbound mail with the mail gem"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/eole/4500783172/" target="_blank"&gt;eole&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The &lt;a href="https://github.com/mikel/mail"&gt;mail gem&lt;/a&gt; has become the underlying library of Action Mailer with Rails 3, replacing TMail, but it's also capable of receiving email from
a POP3 or IMAP account. I couldn't find any documentation for testing the retrieval, so I figured it out from the source - here's how you can test your inbound mail processing.&lt;/p&gt;

&lt;p&gt;Instead of the POP and IMAP retrievers, you need to use the &lt;a href="https://github.com/mikel/mail/blob/master/lib/mail/network/retriever_methods/test_retriever.rb"&gt;TestRetriever&lt;/a&gt;. To set it up, you'll just have to configure the retriever_method to &lt;code&gt;:test&lt;/code&gt;, like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="co"&gt;Mail&lt;/span&gt;.defaults &lt;span class="r"&gt;do&lt;/span&gt;
  retriever_method &lt;span class="sy"&gt;:test&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The "inbound mail" you'll be fetching is coming from the class method &lt;code&gt;Mail::TestRetriever.emails&lt;/code&gt;, which is a plain array and is supposed to be fed with Mail instances which you'll obviosuly need to create either manually or by reading in a previously dumped email in the &lt;a href="http://en.wikipedia.org/wiki/Email"&gt;eml Format&lt;/a&gt;:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;manual_mail = &lt;span class="co"&gt;Mail&lt;/span&gt;.new &lt;span class="r"&gt;do&lt;/span&gt;
  from &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;someone@example.com&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  to &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;someother@example.com&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  subject &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Fancy Test Mail&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  body &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Oi!&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;

dumped_mail = &lt;span class="co"&gt;Mail&lt;/span&gt;.read(&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;/path/to/message.eml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Then, just add the mail to your inbound email collection:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="co"&gt;Mail&lt;/span&gt;::&lt;span class="co"&gt;TestRetriever&lt;/span&gt;.emails &amp;lt;&amp;lt; manual_mail
&lt;span class="co"&gt;Mail&lt;/span&gt;::&lt;span class="co"&gt;TestRetriever&lt;/span&gt;.emails &amp;lt;&amp;lt; dumped_mail
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Calling &lt;code&gt;Mail.all&lt;/code&gt; should now yield the test mails, so your mail processing code should process them as expected. Of course you could also use ActionMailer to generate your test messages: &lt;code&gt;MyMailer.some_mail&lt;/code&gt; returns a plain Mail message instance.&lt;/p&gt;

&lt;h3&gt;Putting it together&lt;/h3&gt;

&lt;p&gt;You'll probably also want to reset the test email collection in a teardown method, so a basic &lt;code&gt;test/unit&lt;/code&gt; test for inbound mail processing might look somewhat like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;InboundMailTest&lt;/span&gt; &amp;lt; &lt;span class="co"&gt;Test&lt;/span&gt;::&lt;span class="co"&gt;Unit&lt;/span&gt;::&lt;span class="co"&gt;TestCase&lt;/span&gt;
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;setup&lt;/span&gt;
    &lt;span class="co"&gt;Mail&lt;/span&gt;.defaults { retriever_method &lt;span class="sy"&gt;:test&lt;/span&gt; }
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;teardown&lt;/span&gt;
    &lt;span class="co"&gt;Mail&lt;/span&gt;::&lt;span class="co"&gt;TestRetriever&lt;/span&gt;.emails = []
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;test_inbound_mail&lt;/span&gt;
    receive_mail(&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;examplemail&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;)
    &lt;span class="c"&gt;# This class being your inbound mail processor.&lt;/span&gt;
    &lt;span class="c"&gt;# Implementation left as an excercise to the reader ;)&lt;/span&gt;
    assert &lt;span class="co"&gt;MyMailProcessor&lt;/span&gt;.process
    &lt;span class="c"&gt;# more assertions that test the results of your mail processing...&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  private
  
    &lt;span class="c"&gt;# Read in email from a prepared fixture file in eml format and push it to the &lt;/span&gt;
    &lt;span class="c"&gt;# inbound mail q&lt;/span&gt;
    &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;receive_mail&lt;/span&gt;(fixture_name)
      &lt;span class="co"&gt;Mail&lt;/span&gt;::&lt;span class="co"&gt;TestRetriever&lt;/span&gt;.emails &amp;lt;&amp;lt; &lt;span class="co"&gt;Mail&lt;/span&gt;.read(&lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;fixtures/mails/&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;fixture_name&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="k"&gt;.eml&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
    &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

</content>
  </entry>
  <entry>
    <title>Setting up your custom Hoptoad Notifier endpoint for free using Errbit on Heroku</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2011/02/22/setting-up-your-custom-hoptoad-notifier-endpoint-for-free-using-errbit-on-heroku"/>
    <id>http://colszowka.heroku.com/2011/02/22/setting-up-your-custom-hoptoad-notifier-endpoint-for-free-using-errbit-on-heroku</id>
    <published>2011-02-22</published>
    <updated>2011-02-22</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/errbit.png" alt="Using Hoptoad Notifier with your own endpoint with Errbit on Heroku"/&gt;
&lt;/div&gt;


&lt;p&gt;The &lt;a href="https://github.com/jdpace/errbit"&gt;Errbit app&lt;/a&gt; is an open source Rails 3 app that
is API-compatible with Thoughtbot's &lt;a href="https://github.com/thoughtbot/hoptoad_notifier"&gt;Hoptoad Notifier&lt;/a&gt;
and thus allows you to roll your own exception tracking service for free on Heroku. Let's see how to set this up.&lt;/p&gt;
</summary>
    <content type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/errbit.png" alt="Using Hoptoad Notifier with your own endpoint with Errbit on Heroku"/&gt;
&lt;/div&gt;


&lt;p&gt;The &lt;a href="https://github.com/jdpace/errbit"&gt;Errbit app&lt;/a&gt; is an open source Rails 3 app that
is API-compatible with Thoughtbot's &lt;a href="https://github.com/thoughtbot/hoptoad_notifier"&gt;Hoptoad Notifier&lt;/a&gt;
and thus allows you to roll your own exception tracking service for free on Heroku. Let's see how to set this up.&lt;/p&gt;

&lt;p&gt;You may have various reasons to roll your own exception tracker. Be it the need for customization (either visual
or functional), security concerns or simply the price-tag of commercial exception trackers.&lt;/p&gt;

&lt;p&gt;For me, it's mostly the security concerns. &lt;a href="http://hoptoadapp.com/"&gt;Hoptoad&lt;/a&gt; only offers SSL for plans starting at
$15/month, and thus plenty of people send their application errors across the world in plain text - including
environment configuration like S3- and mail credentials.&lt;/p&gt;

&lt;p&gt;Of course, relying on your own error service gives you adminstrative overhead which you might not want. It's up to you
to decide what suits you better - this article is only here to explain how you can set up the great
&lt;a href="https://github.com/jdpace/errbit"&gt;Errbit app&lt;/a&gt; on Heroku with SSL enabled for free in a matter of minutes.&lt;/p&gt;

&lt;p&gt;If you're curious what this might look like, check out the screenshots in the Errbit announcement post
&lt;a href="http://thinkrelevance.com/blog/2010/08/24/introducing-errbit.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Cloning and configuring Errbit&lt;/h2&gt;

&lt;p&gt;Let's start out with cloning the &lt;a href="https://github.com/jdpace/errbit"&gt;Errbit&lt;/a&gt; repo and copying over the two required config files:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;git clone https://github.com/jdpace/errbit.git
cd errbit
cp config/config.example.yml config/config.yml
cp config/mongoid.example.yml config/mongoid.yml
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Now, open up &lt;code&gt;config/config.yml&lt;/code&gt;, set the host for your app to your (supposed) Heroku url and
specify a from-email address:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="ke"&gt;host&lt;/span&gt;: &lt;span class="s"&gt;YOUR_APP_NAME.heroku.com&lt;/span&gt;
&lt;span class="ke"&gt;email_from&lt;/span&gt;: &lt;span class="s"&gt;noreply@example.com&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Accordingly, open up &lt;code&gt;config/mongoid.yml&lt;/code&gt; to set up the database connection in production to use
the &lt;code&gt;MONGOHQ_URL&lt;/code&gt; environment variable set by Heroku after adding the MongoHQ addon:&lt;/p&gt;

&lt;pre&gt;
production:
  uri: &amp;lt;%= ENV['MONGOHQ_URL'] %&amp;gt;
&lt;/pre&gt;


&lt;p&gt;Finally, let's add those files to git and commit the new configuration:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;git add -f config/config.yml config/mongoid.yml
git commit -m &amp;quot;Heroku configs&amp;quot;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Heroku setup&lt;/h2&gt;

&lt;p&gt;Of course, you should have the &lt;code&gt;&lt;a href="http://rubygems.org/gems/heroku"&gt;heroku&lt;/a&gt;&lt;/code&gt; gem installed and set up
for this to work.&lt;/p&gt;

&lt;p&gt;Still inside your local errbit clone, create the app and add the MongoHQ and Sendgrid addons to get the required
MongoDB and mail delivery capabilities, then, deploy Errbit and seed the database:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;heroku create YOUR_APP_NAME
heroku addons:add mongohq:free
heroku addons:add sendgrid:free
git push heroku master 
heroku rake db:seed
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;After seeding the database, you should see a notification holding your initial credentials. You should visit your
fresh Errbit install to verify everything works fine and to change the credentials and your user name right away.&lt;/p&gt;

&lt;h2&gt;Enforcing the use of SSL&lt;/h2&gt;

&lt;p&gt;As I said before, I'm no fan of exception data delivered over the net unencrypted. Luckily, Heroku offers free
SSL on subdomain apps (foo.heroku.com) using their heroku.com wildcard certificate. Enable it by running:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;heroku addons:add ssl:piggyback
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Now, let's enforce the usage of SSL even when users arrive at the app via plain HTTP instead of HTTPS by
installing the middleware &lt;a href="https://github.com/tobmatth/rack-ssl-enforcer"&gt;Rack SSL Enforcer&lt;/a&gt; gem into Errbit.&lt;/p&gt;

&lt;p&gt;Open up the &lt;code&gt;Gemfile&lt;/code&gt; and add:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;gem &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;rack-ssl-enforcer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="sy"&gt;:group&lt;/span&gt; =&amp;gt; &lt;span class="sy"&gt;:production&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Then, open up &lt;code&gt;config/application.rb&lt;/code&gt; and tell Rails to use the middleware:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;config.middleware.use &lt;span class="co"&gt;Rack&lt;/span&gt;::&lt;span class="co"&gt;SslEnforcer&lt;/span&gt;, &lt;span class="sy"&gt;:except&lt;/span&gt; =&amp;gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^&lt;/span&gt;&lt;span class="ch"&gt;\/&lt;/span&gt;&lt;span class="k"&gt;deploys&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The except clause for the deploy API is neccessary since obviously Hoptoad does not report deployments via SSL
even when secure connections are configured in the Notifier. You can remove this if you can do without Deployment
tracking.&lt;/p&gt;

&lt;p&gt;As a final step, update your Bundle, commit and push:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;bundle
git commit -am &amp;quot;Rack SSL Enforcer&amp;quot;
git push heroku
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Configuring the Notifier in your application&lt;/h2&gt;

&lt;p&gt;Finally, it's time to wire up your (supposedly ;) existing Rails app with your custom exception tracker.&lt;/p&gt;

&lt;p&gt;Go back to the Errbit web interface and add an app. It will give you instructions on how to set things up. Basically,
for a Rails 3 application, you need to add &lt;code&gt;gem 'hoptoad_notifier'&lt;/code&gt; to your &lt;code&gt;Gemfile&lt;/code&gt;, then create
&lt;code&gt;config/initializers/errbit.rb&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The configuration suggested by Errbit does not reflect our desired usage of secure SSL connections properly, though,
so you'll have to add the &lt;code&gt;config.secure = true&lt;/code&gt; option to make things work, as shown below. The port config can be omitted,
it will default to 443 when using secure connections.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;config/initializers/errbit.rb:&lt;/code&gt;&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="co"&gt;HoptoadNotifier&lt;/span&gt;.configure &lt;span class="r"&gt;do&lt;/span&gt; |config|
   config.api_key = &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;ABCDEF&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;
   config.host    = &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;YOUR_APP_NAME.heroku.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;
   config.secure  = &lt;span class="pc"&gt;true&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;After a final &lt;code&gt;bundle&lt;/code&gt;, you should be able to track exceptions using &lt;code&gt;hoptoad_notifier&lt;/code&gt; and &lt;code&gt;Errbit&lt;/code&gt;. Test-fire it with:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;rake hoptoad:test
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;You can also track deployments via rake, for example from a git hook - check to the documentation of &lt;a href="https://github.com/thoughtbot/hoptoad_notifier"&gt;Hoptoad Notifier&lt;/a&gt; for further information.&lt;/p&gt;

&lt;p&gt;Test fire a deployment notification with:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;rake hoptoad:deploy TO=production REVISION=1234 REPOSITORY=origin USER=colszowka
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;And that's all I can say.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Throw It!</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2010/10/22/throw-it"/>
    <id>http://colszowka.heroku.com/2010/10/22/throw-it</id>
    <published>2010-10-22</published>
    <updated>2010-10-22</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/throwit.jpg" alt="Throw it!"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/raysto/197510077/" target="_blank"&gt;raysto&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;How I'm using Ruby exceptions and Rails' &lt;code&gt;rescue_from&lt;/code&gt; to keep controllers clean and
error response handling DRY and RESTful.&lt;/p&gt;
</summary>
    <content type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/throwit.jpg" alt="Throw it!"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/raysto/197510077/" target="_blank"&gt;raysto&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;How I'm using Ruby exceptions and Rails' &lt;code&gt;rescue_from&lt;/code&gt; to keep controllers clean and
error response handling DRY and RESTful.&lt;/p&gt;

&lt;p&gt;Quite often in a Rails app we'd do something like this in a controller that needs to fetch a record from database:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;PostsController&lt;/span&gt; &amp;lt; &lt;span class="co"&gt;ApplicationController&lt;/span&gt;
  before_filter &lt;span class="sy"&gt;:find_post&lt;/span&gt;, &lt;span class="sy"&gt;:except&lt;/span&gt; =&amp;gt; [&lt;span class="sy"&gt;:index&lt;/span&gt;, &lt;span class="sy"&gt;:new&lt;/span&gt;, &lt;span class="sy"&gt;:create&lt;/span&gt;]
  before_filter &lt;span class="sy"&gt;:access_permitted?&lt;/span&gt;, &lt;span class="sy"&gt;:except&lt;/span&gt; =&amp;gt; [&lt;span class="sy"&gt;:index&lt;/span&gt;, &lt;span class="sy"&gt;:new&lt;/span&gt;, &lt;span class="sy"&gt;:create&lt;/span&gt;]
  
  &lt;span class="c"&gt;# Actions...&lt;/span&gt;
  
  private
  
  &lt;span class="c"&gt;# Retrieves the post, redirecting back to index on failure with a custom message&lt;/span&gt;
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;find_post&lt;/span&gt;
    &lt;span class="iv"&gt;@post&lt;/span&gt; = &lt;span class="co"&gt;Post&lt;/span&gt;.find(params[&lt;span class="sy"&gt;:id&lt;/span&gt;])
  &lt;span class="r"&gt;rescue&lt;/span&gt; &lt;span class="co"&gt;ActiveRecord&lt;/span&gt;::&lt;span class="co"&gt;NotFound&lt;/span&gt; =&amp;gt; err
    flash[&lt;span class="sy"&gt;:error&lt;/span&gt;] = &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Could not find post with id &lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;params[&lt;span class="sy"&gt;:id&lt;/span&gt;]&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    redirect_to posts_path
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  &lt;span class="c"&gt;# Makes sure the current user is allowed to access this post.&lt;/span&gt;
  &lt;span class="c"&gt;# Redirect back to index when auth fails&lt;/span&gt;
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;access_permitted?&lt;/span&gt;
    &lt;span class="r"&gt;unless&lt;/span&gt; &lt;span class="iv"&gt;@post&lt;/span&gt;.user == current_user
      flash[&lt;span class="sy"&gt;:message&lt;/span&gt;] = &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;You are not allowed to access this post!&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
      redirect_to posts_path
    &lt;span class="r"&gt;end&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;In my opinion, this has two problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The code is not DRY&lt;/li&gt;
&lt;li&gt;The response is not RESTful&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Let me explain:&lt;/p&gt;

&lt;p&gt;All across your app, you will have similar functionality. You might have a &lt;code&gt;UsersController&lt;/code&gt; and a &lt;code&gt;CommentsController&lt;/code&gt;, and all
of those need to find an instance, authorize the user and so on.&lt;/p&gt;

&lt;p&gt;All this functionality needs separate error handling code when going down the path of redirecting the frontend user to another
page with custom error messages, which can result in a &lt;em&gt;lot&lt;/em&gt; of (mostly) duplicate code, where only the error message and
endpoint url vary. When you want to change the error handling for records that could not be found, you have to do it across
all your controllers over and over again.&lt;/p&gt;

&lt;p&gt;Also, this (simple) example does not cover the handling of other formats than HTML. If you had to deal with, say, JSON requests,
you'd also have to introduce &lt;code&gt;respond_to&lt;/code&gt; blocks over and over again. Imagine you need some additional auth in a certain action
(users may edit a wiki page but are not allowed to destroy it) - even more failure response code is required.&lt;/p&gt;

&lt;p&gt;Additionally, this approach is not RESTful: A resource that is missing should not respond with a HTTP redirect,
which actually says that either the resource was &lt;code&gt;Moved Permanently&lt;/code&gt; (301) to a different or was &lt;code&gt;Found&lt;/code&gt; (302) at a
temporarily different url (see &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"&gt;RFC2616&lt;/a&gt;) (the Rails default
for &lt;code&gt;redirect_to&lt;/code&gt; being &lt;code&gt;302&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;After all handling auth or database retrieval problems &lt;em&gt;is&lt;/em&gt; handling of exceptional cases in a Rails app's regular flow,
so why not use exceptions?&lt;/p&gt;

&lt;p&gt;Rails comes with a built in ActionController class method called &lt;code&gt;rescue_from&lt;/code&gt; which, from what I've seen so far, is not
as popular or widely used as it should be. Basically it intercepts exceptions at the top level of the request (before the
infamous 'There seems to be a problem' &lt;code&gt;500.html&lt;/code&gt; page is rendered) and lets you handle them the way you want.&lt;/p&gt;

&lt;p&gt;Let's have a look at how this could be implemented in the ApplicationController for this app.&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;ApplicationController&lt;/span&gt; &amp;lt; &lt;span class="co"&gt;ActionController&lt;/span&gt;::&lt;span class="co"&gt;Base&lt;/span&gt;
  &lt;span class="c"&gt;# Just define an example no permission exception for auth. &lt;/span&gt;
  &lt;span class="c"&gt;# Might be thrown by authorize before filter on fail.&lt;/span&gt;
  &lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;NoPermissionError&lt;/span&gt; &amp;lt; &lt;span class="co"&gt;StandardError&lt;/span&gt;; &lt;span class="r"&gt;end&lt;/span&gt;;

  rescue_from &lt;span class="co"&gt;ApplicationController&lt;/span&gt;::&lt;span class="co"&gt;NoPermissionError&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt; |e|
    response_for_error &lt;span class="i"&gt;403&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  rescue_from &lt;span class="co"&gt;ActiveRecord&lt;/span&gt;::&lt;span class="co"&gt;NotFound&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt; |e|
    response_for_error &lt;span class="i"&gt;404&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  private
  
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;response_for_error&lt;/span&gt;(status)
    respond_to &lt;span class="r"&gt;do&lt;/span&gt; |f|
      &lt;span class="c"&gt;# Show a neat html page inside the app's layout for web users&lt;/span&gt;
      f.html { render &lt;span class="sy"&gt;:template&lt;/span&gt; =&amp;gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;errors/&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;status&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class="sy"&gt;:status&lt;/span&gt; =&amp;gt; status }

      &lt;span class="c"&gt;# Everything else (JSON, XML, YAML, Whatnot) gets a blank page with status&lt;/span&gt;
      &lt;span class="c"&gt;# which can then be understood and processed by the API client, &lt;/span&gt;
      &lt;span class="c"&gt;# JavaScript library (on Ajax) etc.&lt;/span&gt;
      f.all { render &lt;span class="sy"&gt;:nothing&lt;/span&gt; =&amp;gt; &lt;span class="pc"&gt;true&lt;/span&gt;, &lt;span class="sy"&gt;:status&lt;/span&gt; =&amp;gt; status }
    &lt;span class="r"&gt;end&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Of course, the status-specific templates must be added inside the &lt;code&gt;app/views/errors/&lt;/code&gt; directory for
the &lt;code&gt;response_for_error&lt;/code&gt; method to work properly. This is left for the reader as an excercise ;)&lt;/p&gt;

&lt;p&gt;The cleaned up &lt;code&gt;PostsController&lt;/code&gt; would look somewhat like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;PostsController&lt;/span&gt; &amp;lt; &lt;span class="co"&gt;ApplicationController&lt;/span&gt;
  before_filter &lt;span class="sy"&gt;:find_post&lt;/span&gt;, &lt;span class="sy"&gt;:except&lt;/span&gt; =&amp;gt; [&lt;span class="sy"&gt;:index&lt;/span&gt;, &lt;span class="sy"&gt;:new&lt;/span&gt;, &lt;span class="sy"&gt;:create&lt;/span&gt;]
  before_filter &lt;span class="sy"&gt;:access_permitted?&lt;/span&gt;, &lt;span class="sy"&gt;:except&lt;/span&gt; =&amp;gt; [&lt;span class="sy"&gt;:index&lt;/span&gt;, &lt;span class="sy"&gt;:new&lt;/span&gt;, &lt;span class="sy"&gt;:create&lt;/span&gt;]
  
  &lt;span class="c"&gt;# Actions...&lt;/span&gt;
  
  private
  
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;find_post&lt;/span&gt;
    &lt;span class="iv"&gt;@post&lt;/span&gt; = &lt;span class="co"&gt;Post&lt;/span&gt;.find(params[&lt;span class="sy"&gt;:id&lt;/span&gt;])
  &lt;span class="r"&gt;end&lt;/span&gt;
  
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;access_permitted?&lt;/span&gt;
    raise &lt;span class="co"&gt;ApplicationController&lt;/span&gt;::&lt;span class="co"&gt;NoPermissionError&lt;/span&gt; &lt;span class="r"&gt;unless&lt;/span&gt; &lt;span class="iv"&gt;@post&lt;/span&gt;.user == current_user
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It's certainly not a lot less code in the &lt;code&gt;PostsController&lt;/code&gt; when comparing it to the previous version,
but actually we've got quite a bit of extra functionality with this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We are rendering actual error pages with proper HTTP status codes&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The handling of all the different http error condition statuses is handled coherently:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Frontend&lt;/em&gt;  users will see a customized error page inside the app's layout&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Backend"&lt;/em&gt; users (JSON, YAML, XML, Ajax) will get a uniform response with an appropriate status code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All across the app, throwing the approprite exception when an error condition occurs bubbles up to the
rescue method and will be handled the same way.&lt;/p&gt;

&lt;p&gt;For example, your models might have exhaustive permission control. With this kind of error handling,
you could throw a &lt;code&gt;NoPermissionError&lt;/code&gt; inside of your model and it will bubble up through the controller for
the current request and render the appropriate error page - without a need for a single line of exception
handling code inside the specific controller that is handling the request.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Considering you will likely remove the same duplicate code from quite a few controllers which your app surely
has, you also end up with a fair share of removed lines of code while still getting extra functionality.&lt;/p&gt;

&lt;p&gt;Once I've gotten used to bubbling up exceptions and handling them centrally in the &lt;code&gt;ApplicationController&lt;/code&gt;,
I've also found writing actual controller code a lot easier: It's very comforting to know that any exceptional
cases will be handled properly and don't need my further attention apart from throwing the right exception
when something goes wrong.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;p.s.&lt;/em&gt; Of course this approach will fail miserably if you are catching all exceptions in your actions like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;update&lt;/span&gt;
    &lt;span class="iv"&gt;@post&lt;/span&gt;.update_attributes!(params[&lt;span class="sy"&gt;:post&lt;/span&gt;])
  &lt;span class="r"&gt;rescue&lt;/span&gt; =&amp;gt; err
    &lt;span class="c"&gt;# Do something&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;You are &lt;a href="http://blog.rubybestpractices.com/posts/rklemme/003-The_Universe_between_begin_and_end.html"&gt;not doing this&lt;/a&gt;, right?&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;If you cannot handle an exception, you should not catch it because otherwise you will prevent other code that is capable of handling it to work. Actually, as long as you do not raise again, nobody outside will notice that there was an error in the first place.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Thanks for reading, let me know about your approaches!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>RedirectFollower Rubygem</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2010/04/30/redirectfollower-rubygem"/>
    <id>http://colszowka.heroku.com/2010/04/30/redirectfollower-rubygem</id>
    <published>2010-04-30</published>
    <updated>2010-04-30</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/3067616041_88cef14dff_b.jpg" alt="Relay Runner"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/shenghunglin/3067616041/" target="_blank"&gt;Shenghung Lin&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Today I've been thinking about a small Twitter-based project which involves urls posted by people
there. Those urls use some url shortening service like bit.ly in most cases - but I needed the actual
destinations for those links. I ended up stealing code from
&lt;a href="http://railstips.org/blog/archives/2009/03/04/following-redirects-with-nethttp/"&gt;John Nunemaker&lt;/a&gt;,
wrapping it up into a Ruby gem and releasing version 0.1.0 of &lt;a href="http://rubygems.org/gems/redirect_follower"&gt;RedirectFollower&lt;/a&gt;.
You can find the source code on &lt;a href="http://github.com/colszowka/redirect_follower"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</summary>
    <content type="html">&lt;div class="article-teaser"&gt;
  &lt;img src="http://colszowka.heroku.com/assets/3067616041_88cef14dff_b.jpg" alt="Relay Runner"/&gt;
  &lt;div class="image-caption"&gt;Photo by &lt;a href="http://www.flickr.com/photos/shenghunglin/3067616041/" target="_blank"&gt;Shenghung Lin&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Today I've been thinking about a small Twitter-based project which involves urls posted by people
there. Those urls use some url shortening service like bit.ly in most cases - but I needed the actual
destinations for those links. I ended up stealing code from
&lt;a href="http://railstips.org/blog/archives/2009/03/04/following-redirects-with-nethttp/"&gt;John Nunemaker&lt;/a&gt;,
wrapping it up into a Ruby gem and releasing version 0.1.0 of &lt;a href="http://rubygems.org/gems/redirect_follower"&gt;RedirectFollower&lt;/a&gt;.
You can find the source code on &lt;a href="http://github.com/colszowka/redirect_follower"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Actually, I modified the source code a bit so you don't have to hit "resolve" manually after
initializing the RedirectFollower. Also, there's a shorthand form.&lt;/p&gt;

&lt;p&gt;After installing with &lt;code&gt;gem install redirect_follower&lt;/code&gt;, you can either go the short way if you only
want the url of the destination, or initialize a new instance of RedirectFollower to get the Net::HTTP
response with status, body and all that malarkey.&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;redirect_follower&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;  
RedirectFollower(&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;http://bit.ly/cteFsP&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;) 
&lt;span class="c"&gt;# =&amp;gt; Will return 'http://github.com/colszowka/redirect_follower'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Full-on mode:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;redirect_follower&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;  
redirect = &lt;span class="co"&gt;RedirectFollower&lt;/span&gt;.new(&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;http://bit.ly/cteFsP&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class="c"&gt;# Will print 'http://github.com/colszowka/redirect_follower'&lt;/span&gt;
puts redirect.url 

&lt;span class="c"&gt;# Will print a lot of HTML&lt;/span&gt;
puts redirect.body 

&lt;span class="c"&gt;# Returns the Net::HTTPResponse (well actually, a subclass for the respective HTTP &lt;/span&gt;
&lt;span class="c"&gt;# status of the destination)&lt;/span&gt;
redirect.response
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;You can limit the amount of redirects by giving a second parameter:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;redirect_follower&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;  
RedirectFollower(&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;http://bit.ly/cteFsP&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="i"&gt;2&lt;/span&gt;) 
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;This will raise &lt;code&gt;RedirectFollower::TooManyRedirects&lt;/code&gt; when there are more than two redirects. The
default limit is 5.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Offtopic:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I know I was supposed to write an article about my
&lt;a href="http://gemcutter.org/gems/serious"&gt;crazy new ruby blog software serious&lt;/a&gt;, that's going to arrive
anytime soon. I figured this time I'm gonna write the article about a new Rubygem
of mine straight after release so I don't end up not doing it at all. Regarding that &lt;code&gt;serious&lt;/code&gt; article,
I am planning to do an introductory screencast, but did not get past creating &lt;a href="http://github.com/colszowka/linux-typewriter"&gt;a linux tool that
makes typewriter sounds when typing&lt;/a&gt;. Hopefully, I'll
actually make use of it soon!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Moved my blog</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2010/02/25/moved-my-blog"/>
    <id>http://colszowka.heroku.com/2010/02/25/moved-my-blog</id>
    <published>2010-02-25</published>
    <updated>2010-02-25</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;After finally realizing that it really is Wordpress that is stopping me from writing more frequently
because of the additional hassle with formatting, linking and syntax highlighting, I
created my own blog software which features Markdown formatting, CodeRay syntax highlighting,
and moved my blog over to &lt;a href="http://heroku.com"&gt;heroku&lt;/a&gt;.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;After finally realizing that it really is Wordpress that is stopping me from writing more frequently
because of the additional hassle with formatting, linking and syntax highlighting, I
created my own blog software which features Markdown formatting, CodeRay syntax highlighting,
and moved my blog over to &lt;a href="http://heroku.com"&gt;heroku&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The blog software is called &lt;a href="http://gemcutter.org/gems/serious"&gt;serious&lt;/a&gt; and you can find the source
&lt;a href="http://github.com/colszowka/serious"&gt;on github&lt;/a&gt;. I will write more on this and how you can use it
soon, but until now let me just apologize for (potentially) introducing a lot of unread items into
your feed reader because of modified publishing dates!&lt;/p&gt;

&lt;p&gt;Also, the url of my blog has changed to &lt;a href="http://colszowka.heroku.com"&gt;colszowka.heroku.com&lt;/a&gt;, but
I might feel like updating the olszowka.de domain to point there as well at a later point of time.&lt;/p&gt;

&lt;p&gt;I'm totally looking forward to post more frequently here soon, starting with some introductury posts
on &lt;a href="http://gemcutter.org/gems/serious"&gt;serious&lt;/a&gt; and it's formatting companion,
&lt;a href="http://gemcutter.org/gems/stupid_formatter"&gt;stupid_formatter&lt;/a&gt;!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Happy new year!</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2010/01/03/happy-new-year"/>
    <id>http://colszowka.heroku.com/2010/01/03/happy-new-year</id>
    <published>2010-01-03</published>
    <updated>2010-01-03</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;It's a bit belated for sure, but I was stuck at my girlfriend's family in southern Germany and in the holidays, so there was no time (or reason) to get in front of a computer... A happy new year to all of you. Of course, the title of this blog had to be updated accordingly to 2010. I'll try and keep more posts pouring in this year!&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;It's a bit belated for sure, but I was stuck at my girlfriend's family in southern Germany and in the holidays, so there was no time (or reason) to get in front of a computer... A happy new year to all of you. Of course, the title of this blog had to be updated accordingly to 2010. I'll try and keep more posts pouring in this year!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Moving Repos and Redmine from SVN to Git</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/09/11/moving-repos-and-redmine-from-svn-to-git"/>
    <id>http://colszowka.heroku.com/2009/09/11/moving-repos-and-redmine-from-svn-to-git</id>
    <published>2009-09-11</published>
    <updated>2009-09-11</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Sorry for not posting in a long time (again), but I've been pretty busy with summer vacations, work, of course, &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;The Ruby Toolbox&lt;/a&gt; and did not have any time to work on some OSS stuff.&lt;/p&gt;

&lt;p&gt;What I &lt;strong&gt;did&lt;/strong&gt; do, though, was to migrate two of our major app repositories from Subversion to Git together with my fellow colleague at Capita Unternehmensberatung, &lt;a href="http://twitter.com/j3z_hh" target="_blank"&gt;Sebastian&lt;/a&gt;, who despite being very jealous of my fancy new HTC Hero being so much cooler than his grumpy old T-Mobile G1, joined me on this one :)&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Sorry for not posting in a long time (again), but I've been pretty busy with summer vacations, work, of course, &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;The Ruby Toolbox&lt;/a&gt; and did not have any time to work on some OSS stuff.&lt;/p&gt;

&lt;p&gt;What I &lt;strong&gt;did&lt;/strong&gt; do, though, was to migrate two of our major app repositories from Subversion to Git together with my fellow colleague at Capita Unternehmensberatung, &lt;a href="http://twitter.com/j3z_hh" target="_blank"&gt;Sebastian&lt;/a&gt;, who despite being very jealous of my fancy new HTC Hero being so much cooler than his grumpy old T-Mobile G1, joined me on this one :)&lt;/p&gt;

&lt;p&gt;Our main goals were to retain our Release Tags from SVN as Git Tags (not Branches!), which worked out perfectly after working through a couple of online resources on this topic, as well as updating our &lt;a href="http://www.redmine.org/"&gt;Redmine&lt;/a&gt; issue comments and time entries that included references to specific commits to reflect the changes in revision numbering.&lt;/p&gt;

&lt;p&gt;For migrating the repositories, I've put together the required steps based upon &lt;a href="http://blog.woobling.org/2009/06/git-svn-abandon.html"&gt;this&lt;/a&gt;, &lt;a href="http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/"&gt;this&lt;/a&gt;, and &lt;a href="http://www.bytetrap.com/blog/2008/06/07/slimming-down-git-repository/"&gt;this&lt;/a&gt; into a &lt;a href="http://gist.github.com/139478"&gt;gist&lt;/a&gt;, which you can work through manually and should end up with a sweet git repo. Only thing remaining is to set up a bare repository on your scm-server (git init --bare) and push everything over there (at least as long as you sticked to the default SVN repository structure of /tags, /branches and /trunk - everything else you'll probably have to mess around with the listed commands).&lt;/p&gt;

&lt;p&gt;For moving &lt;a href="http://www.redmine.org/"&gt;Redmine&lt;/a&gt;, we created a simple Ruby script which will work through all your git commit messages, create a hash out of the included svn revision id's (from the initial migration), connect to your Redmine database and update everything properly. It's also a &lt;a href="http://gist.github.com/185317"&gt;gist&lt;/a&gt;. Remember you'll have to do this on your Redmine server.&lt;/p&gt;

&lt;p&gt;Further instructions and comments are also included inside the two gists, so check them out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://gist.github.com/139478"&gt;gist: Migrate SVN to Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://gist.github.com/185317"&gt;gist: Convert revision tags SVN to Git in Redmine&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Happy migrating!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Latest updates in The Ruby Toolbox</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/06/25/latest-updates-in-the-ruby-toolbox"/>
    <id>http://colszowka.heroku.com/2009/06/25/latest-updates-in-the-ruby-toolbox</id>
    <published>2009-06-25</published>
    <updated>2009-06-25</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;blockquote&gt;
&lt;b&gt;Note:&lt;/b&gt; This is a &lt;a href="http://www.ruby-toolbox.com/news.html" target="_blank"&gt;cross-posting from the new Ruby Toolbox blog&lt;/a&gt;. I won't do these in the future. For all updates on The Ruby Toolbox, please subscribe to the news feed there!
&lt;/blockquote&gt;




&lt;p&gt;Finally, here is the news post &lt;a href="http://www.ruby-toolbox.com/news/plenty_of_updates_rolled_out.html"&gt;promised&lt;/a&gt; almost two weeks ago. In the last two weeks, a couple of updates have found their way to The Ruby Toolbox. Apart from various updates to the layout and other minor improvements, there are three major feature additions, which I will cover in a little more detail.&lt;/p&gt;




&lt;h2&gt;Projects and Categories listings&lt;/h2&gt;


&lt;p&gt;In the top navigation bar, you will now find links to listings for categories and projects. They also have some rather nice tooltips, so try and hover them :)&lt;/p&gt;


&lt;p&gt;The super-ugly dropdown cateogry selector in the upper right has also been replaced by a fancier navigation which hopefully also addresses the increasing navigation issues that grew out of the old select tag with the boatload of categories that have been added since the Toolbox launched.&lt;/p&gt;


&lt;h2&gt;Project news&lt;/h2&gt;


&lt;p&gt;Thanks to the &lt;a href="http://www.technorati.com"&gt;Technorati &lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt;, each project now has a listing of blog posts featuring information about it.&lt;/p&gt;


&lt;p&gt;The search is done based upon links to the project&amp;#8217;s Github repository, so all you people out there writing about something Ruby that is hosted on Github and featured here, please remember to link up the project repo from within your post!&lt;/p&gt;


&lt;p&gt;Assuming your blog is being indexed by Technorati, your post should appear on the corresponding project&amp;#8217;s category listing. Please let me know if there are issues with that!&lt;/p&gt;




&lt;p&gt;The inclusion of project news from the blogosphere leads us straight to the next big addition:&lt;/p&gt;


&lt;h2&gt;Feeds&lt;/h2&gt;


&lt;p&gt;Plenty of people have been asking for them, and yes, they finally have arrived!&lt;/p&gt;


&lt;p&gt;Apart from the obvious &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxLatestNews"&gt;feed for this latest news blog&lt;/a&gt;, there are also feeds for &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxRecentlyAddedCategories"&gt;recently added categories&lt;/a&gt;, &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxRecentlyAddedProjects"&gt;recently added projects&lt;/a&gt; and, last but not least, a &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxInTheNews"&gt;feed for the aforementioned blogosphere index&lt;/a&gt;, which will give you the latest blogposts about projects covered in The Ruby Toolbox.&lt;/p&gt;




&lt;p&gt;I hope you will enjoy the new features. Please let me know what you would like to see in The Ruby Toolbox and of course you&amp;#8217;re free to report any issues and projects currently missing!&lt;/p&gt;

</summary>
    <content type="html">&lt;blockquote&gt;
&lt;b&gt;Note:&lt;/b&gt; This is a &lt;a href="http://www.ruby-toolbox.com/news.html" target="_blank"&gt;cross-posting from the new Ruby Toolbox blog&lt;/a&gt;. I won't do these in the future. For all updates on The Ruby Toolbox, please subscribe to the news feed there!
&lt;/blockquote&gt;




&lt;p&gt;Finally, here is the news post &lt;a href="http://www.ruby-toolbox.com/news/plenty_of_updates_rolled_out.html"&gt;promised&lt;/a&gt; almost two weeks ago. In the last two weeks, a couple of updates have found their way to The Ruby Toolbox. Apart from various updates to the layout and other minor improvements, there are three major feature additions, which I will cover in a little more detail.&lt;/p&gt;




&lt;h2&gt;Projects and Categories listings&lt;/h2&gt;


&lt;p&gt;In the top navigation bar, you will now find links to listings for categories and projects. They also have some rather nice tooltips, so try and hover them :)&lt;/p&gt;


&lt;p&gt;The super-ugly dropdown cateogry selector in the upper right has also been replaced by a fancier navigation which hopefully also addresses the increasing navigation issues that grew out of the old select tag with the boatload of categories that have been added since the Toolbox launched.&lt;/p&gt;


&lt;h2&gt;Project news&lt;/h2&gt;


&lt;p&gt;Thanks to the &lt;a href="http://www.technorati.com"&gt;Technorati &lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt;, each project now has a listing of blog posts featuring information about it.&lt;/p&gt;


&lt;p&gt;The search is done based upon links to the project&amp;#8217;s Github repository, so all you people out there writing about something Ruby that is hosted on Github and featured here, please remember to link up the project repo from within your post!&lt;/p&gt;


&lt;p&gt;Assuming your blog is being indexed by Technorati, your post should appear on the corresponding project&amp;#8217;s category listing. Please let me know if there are issues with that!&lt;/p&gt;




&lt;p&gt;The inclusion of project news from the blogosphere leads us straight to the next big addition:&lt;/p&gt;


&lt;h2&gt;Feeds&lt;/h2&gt;


&lt;p&gt;Plenty of people have been asking for them, and yes, they finally have arrived!&lt;/p&gt;


&lt;p&gt;Apart from the obvious &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxLatestNews"&gt;feed for this latest news blog&lt;/a&gt;, there are also feeds for &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxRecentlyAddedCategories"&gt;recently added categories&lt;/a&gt;, &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxRecentlyAddedProjects"&gt;recently added projects&lt;/a&gt; and, last but not least, a &lt;a href="http://feeds2.feedburner.com/TheRubyToolboxInTheNews"&gt;feed for the aforementioned blogosphere index&lt;/a&gt;, which will give you the latest blogposts about projects covered in The Ruby Toolbox.&lt;/p&gt;




&lt;p&gt;I hope you will enjoy the new features. Please let me know what you would like to see in The Ruby Toolbox and of course you&amp;#8217;re free to report any issues and projects currently missing!&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>Announcing: The Ruby Toolbox</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/05/01/announcing-the-ruby-toolbox"/>
    <id>http://colszowka.heroku.com/2009/05/01/announcing-the-ruby-toolbox</id>
    <published>2009-05-01</published>
    <updated>2009-05-01</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;So, after my return from Cairo and right before heading to Las Vegas for RailsConf tomorrow morning, I have put together a little website called &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;The Ruby Toolbox&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The page is meant to give you information on what Ruby tool from GitHub you could use to do X, Y or Z. The tools are assorted in categories like "Testing Frameworks", "State Machines", "Markup Processors" and so on. The projects listed in each category have scores calculated from their respective GitHub repositories' watcher and fork counts, so you can get an idea which project is the most popular in the dev community.&lt;/p&gt;

&lt;p&gt;I hope this will be of use to people i.e. wondering which test framework they should choose from the plethora of options or to find out about alternatives to currently used tools and their popularity.&lt;/p&gt;

&lt;p&gt;So, head over to &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;ruby-toolbox.com&lt;/a&gt; and drop me a line whether you like it, tweet me @thedeadserious or tell me right at RailsConf in Vegas!&lt;/p&gt;

&lt;p&gt;If you want a (your?) project or another category added, please also drop me a line because the categories and projects on the page only serve as a starting point. This will hopefully grow in time!&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;So, after my return from Cairo and right before heading to Las Vegas for RailsConf tomorrow morning, I have put together a little website called &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;The Ruby Toolbox&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The page is meant to give you information on what Ruby tool from GitHub you could use to do X, Y or Z. The tools are assorted in categories like "Testing Frameworks", "State Machines", "Markup Processors" and so on. The projects listed in each category have scores calculated from their respective GitHub repositories' watcher and fork counts, so you can get an idea which project is the most popular in the dev community.&lt;/p&gt;

&lt;p&gt;I hope this will be of use to people i.e. wondering which test framework they should choose from the plethora of options or to find out about alternatives to currently used tools and their popularity.&lt;/p&gt;

&lt;p&gt;So, head over to &lt;a href="http://ruby-toolbox.com" target="_blank"&gt;ruby-toolbox.com&lt;/a&gt; and drop me a line whether you like it, tweet me @thedeadserious or tell me right at RailsConf in Vegas!&lt;/p&gt;

&lt;p&gt;If you want a (your?) project or another category added, please also drop me a line because the categories and projects on the page only serve as a starting point. This will hopefully grow in time!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Burn like fire in Cairo</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/04/13/burn-like-fire-in-cairo"/>
    <id>http://colszowka.heroku.com/2009/04/13/burn-like-fire-in-cairo</id>
    <published>2009-04-13</published>
    <updated>2009-04-13</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Sorry for not posting a lot in the last weeks, I've been really busy and today I'm leaving for my well-deserved holidays in Egypt, joining my girl and friends who have been there for a couple of weeks already. When I'm back I'll be in Hamburg for one week and hopefully able to finally write about my XMPP-Bot called &lt;a href="http://github.com/colszowka/messagemate.rb/tree" target="_blank"&gt;MessageMate.rb&lt;/a&gt;. In the meantime, you are of course allowed to check it out on your own, the Readme provided on GitHub should provide you with some directions.  Saturday, May 2nd then, I'm departing for RailsConf 09, which hopefully will be a blast like the last two RailsConfs in Portland, which I thankfully was able to attend. I'm not looking forward to Vegas as a city though, Portland was really impressive and I hope that I can get back there some day :)&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Sorry for not posting a lot in the last weeks, I've been really busy and today I'm leaving for my well-deserved holidays in Egypt, joining my girl and friends who have been there for a couple of weeks already. When I'm back I'll be in Hamburg for one week and hopefully able to finally write about my XMPP-Bot called &lt;a href="http://github.com/colszowka/messagemate.rb/tree" target="_blank"&gt;MessageMate.rb&lt;/a&gt;. In the meantime, you are of course allowed to check it out on your own, the Readme provided on GitHub should provide you with some directions.  Saturday, May 2nd then, I'm departing for RailsConf 09, which hopefully will be a blast like the last two RailsConfs in Portland, which I thankfully was able to attend. I'm not looking forward to Vegas as a city though, Portland was really impressive and I hope that I can get back there some day :)&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Ruby, Rails, RHTML and Shoulda Snippets for gedit</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/04/10/ruby-rails-rhtml-and-shoulda-snippets-for-gedit"/>
    <id>http://colszowka.heroku.com/2009/04/10/ruby-rails-rhtml-and-shoulda-snippets-for-gedit</id>
    <published>2009-04-10</published>
    <updated>2009-04-10</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;
&lt;a href="http://projects.gnome.org/gedit/" target="_blank"&gt;Gedit&lt;/a&gt; is the built-in text editor of &lt;a href="http://www.gnome.org/" target="_blank"&gt;Gnome&lt;/a&gt;. It is really straight-forward and no-bs, so it is my favorite environment for coding, since I prefer things to be really snappy rather than standing in my way.
&lt;/p&gt;




&lt;p&gt;It has a built-in &lt;a href="http://live.gnome.org/Gedit/Plugins/Snippets" target="_blank"&gt;snippets plugin&lt;/a&gt; which allows for easy expanding of your predefined shortcuts into the actual method name by hitting TAB - very much like TextMate or plenty of other editors that have such a feature. The snippets for Ruby supplied by default are pretty sloppy and incomplete though, so I've built &lt;a href="http://github.com/colszowka/gedit-snippets/tree/master" target="_blank"&gt;my own&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;They feature not only the default Ruby def, class, if (...) statements, vastly improved compared to the original ones supplied with gedit, but also ActiveRecord validations, associations, ActionController before filters, ERB, and Shoulda macros. For example, &lt;code&gt;sstft&lt;TAB&gt;&lt;/code&gt; will expand to &lt;code&gt;should_set_the_flash_to :(cursor_position)&lt;/code&gt;. &lt;/p&gt;




&lt;p&gt;Please check the &lt;a href="http://colszowka.github.com/gedit-snippets/" target="_blank"&gt;command cheatsheet&lt;/a&gt; on the corresponding github page and have a look at the documentation in the Readme supplied in the &lt;a href="http://github.com/colszowka/gedit-snippets/tree/master" target="_blank"&gt;Github repository&lt;/a&gt; for instructions on how to install them, which basically are two shell commands&lt;/p&gt;




&lt;p&gt;If you need to set up mime-types and syntax highlighting for Ruby and friends, please also check out these two articles, which are a tad dated but still should lead to a working setup for your coding galore:
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://robzon.aenima.pl/2007/10/ubuntu-710-rails-gedit-and.html" target="_blank"&gt;Insane Terminology: Ubuntu 7.10, rails, gedit and gtksourceview 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://crepuscular-homunculus.blogspot.com/2007/10/gedit-for-ruby-and-everything-else-on.html" target="_blank"&gt;crepuscular homunculus: Gedit for Ruby (and everything else) on Gutsy, or No you don't need that Mac Mini.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

In the Readme on Github, I also supplied a couple of rules that I am trying to stick to when writing new snippets. Feel free to fork the repository, add Snippets and send me a pull request!

And to make things even fancier, here is a sweet little video demonstration of some of the snippets:
&lt;div align="center"&gt;
&lt;object width="400" height="320"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4091091&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=f52020&amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=4091091&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=f52020&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="320"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/div&gt;

</summary>
    <content type="html">&lt;p&gt;
&lt;a href="http://projects.gnome.org/gedit/" target="_blank"&gt;Gedit&lt;/a&gt; is the built-in text editor of &lt;a href="http://www.gnome.org/" target="_blank"&gt;Gnome&lt;/a&gt;. It is really straight-forward and no-bs, so it is my favorite environment for coding, since I prefer things to be really snappy rather than standing in my way.
&lt;/p&gt;




&lt;p&gt;It has a built-in &lt;a href="http://live.gnome.org/Gedit/Plugins/Snippets" target="_blank"&gt;snippets plugin&lt;/a&gt; which allows for easy expanding of your predefined shortcuts into the actual method name by hitting TAB - very much like TextMate or plenty of other editors that have such a feature. The snippets for Ruby supplied by default are pretty sloppy and incomplete though, so I've built &lt;a href="http://github.com/colszowka/gedit-snippets/tree/master" target="_blank"&gt;my own&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;They feature not only the default Ruby def, class, if (...) statements, vastly improved compared to the original ones supplied with gedit, but also ActiveRecord validations, associations, ActionController before filters, ERB, and Shoulda macros. For example, &lt;code&gt;sstft&lt;TAB&gt;&lt;/code&gt; will expand to &lt;code&gt;should_set_the_flash_to :(cursor_position)&lt;/code&gt;. &lt;/p&gt;




&lt;p&gt;Please check the &lt;a href="http://colszowka.github.com/gedit-snippets/" target="_blank"&gt;command cheatsheet&lt;/a&gt; on the corresponding github page and have a look at the documentation in the Readme supplied in the &lt;a href="http://github.com/colszowka/gedit-snippets/tree/master" target="_blank"&gt;Github repository&lt;/a&gt; for instructions on how to install them, which basically are two shell commands&lt;/p&gt;




&lt;p&gt;If you need to set up mime-types and syntax highlighting for Ruby and friends, please also check out these two articles, which are a tad dated but still should lead to a working setup for your coding galore:
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://robzon.aenima.pl/2007/10/ubuntu-710-rails-gedit-and.html" target="_blank"&gt;Insane Terminology: Ubuntu 7.10, rails, gedit and gtksourceview 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://crepuscular-homunculus.blogspot.com/2007/10/gedit-for-ruby-and-everything-else-on.html" target="_blank"&gt;crepuscular homunculus: Gedit for Ruby (and everything else) on Gutsy, or No you don't need that Mac Mini.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

In the Readme on Github, I also supplied a couple of rules that I am trying to stick to when writing new snippets. Feel free to fork the repository, add Snippets and send me a pull request!

And to make things even fancier, here is a sweet little video demonstration of some of the snippets:
&lt;div align="center"&gt;
&lt;object width="400" height="320"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4091091&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=f52020&amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=4091091&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=f52020&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="320"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/div&gt;

</content>
  </entry>
  <entry>
    <title>Another state machine for Ruby</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/03/09/another-state-machine-for-ruby"/>
    <id>http://colszowka.heroku.com/2009/03/09/another-state-machine-for-ruby</id>
    <published>2009-03-09</published>
    <updated>2009-03-09</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Aaron Pfeifer from &lt;a href="http://www.pluginaweek.org/" target="_blank"&gt;PluginAWeek&lt;/a&gt; has released a pretty decent state machine &lt;a href="http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/" target="_blank"&gt;today&lt;/a&gt;. It's got plenty of neat features like before- and after-transition hooks, state machine namespacing and the ability to add multiple state machines to a single class, integration with ActiveRecord, DataMapper and Sequel, the possibility to add validations to your model in certain states and, last but not least, an automated GraphViz visualization generator, which will give you a &lt;a href="http://www.pluginaweek.org/wp-content/uploads/2009/03/purchase_state.png" target="_blank"&gt;nice little drawing&lt;/a&gt; of your state machine.&lt;/p&gt;

&lt;p&gt;I will definetely check this out next time I need a state machine.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Aaron Pfeifer from &lt;a href="http://www.pluginaweek.org/" target="_blank"&gt;PluginAWeek&lt;/a&gt; has released a pretty decent state machine &lt;a href="http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/" target="_blank"&gt;today&lt;/a&gt;. It's got plenty of neat features like before- and after-transition hooks, state machine namespacing and the ability to add multiple state machines to a single class, integration with ActiveRecord, DataMapper and Sequel, the possibility to add validations to your model in certain states and, last but not least, an automated GraphViz visualization generator, which will give you a &lt;a href="http://www.pluginaweek.org/wp-content/uploads/2009/03/purchase_state.png" target="_blank"&gt;nice little drawing&lt;/a&gt; of your state machine.&lt;/p&gt;

&lt;p&gt;I will definetely check this out next time I need a state machine.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Introducing ActiveRecord Skeleton</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/02/21/introducing-activerecord-skeleton"/>
    <id>http://colszowka.heroku.com/2009/02/21/introducing-activerecord-skeleton</id>
    <published>2009-02-21</published>
    <updated>2009-02-21</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;It's common knowledge that ActiveRecord can be used nicely without Rails in Ruby apps. Setting up the basic stuff is pretty easy by just requiring the activerecord gem in your app and defining a couple of models.&lt;/p&gt;

&lt;p&gt;But what about migrations, yaml config and different environments? You have to set all this up manually, and even though this is not really hard, it's still a time-consuming task. No more!&lt;/p&gt;

&lt;h3&gt;Enter: ActiveRecord Skeleton&lt;/h3&gt;


&lt;p&gt;I published a new project on GitHub today, called &lt;a href="http://github.com/colszowka/activerecord-skeleton/"&gt;ActiveRecord Skeleton&lt;/a&gt;, and it really is just that: It will instantly give you YAML db config, database migrations (including Rake tasks for migrating the database as well as generating new migrations), a Rails-style project directory structure, and also the option of using environments by specifying the RACK_ENV environment variable. Why RACK_ENV? Well, you might also see this as a super-minimalist web app template, allowing you to set up a db-backed Sinatra (just an example, anything should work really) app instantly. All you really got to do is get the skeleton and add an application.rb file containing the following:&lt;/p&gt;

&lt;pre&gt;require 'sinatra'
require 'init'

get '/' do
  User.all.map {|u| u.name}.to_sentence
end&lt;/pre&gt;


&lt;p&gt;After running application.rb and pointing your browser to localhost:4567, you will see the list of existing users (assuming you've got the database and model set up properly, of course).&lt;/p&gt;

&lt;p&gt;Want to create a user? Start &lt;code&gt;irb&lt;/code&gt;, do a &lt;code&gt;require 'init'&lt;/code&gt; followed by &lt;code&gt;User.create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This skeleton is really minimalist, as I didn't want it to be over-opinionated. It's meant to give an easy start for about any Ruby code you might want to have database-interaction with and is ready to go with sqlite 3 in the default setup, but you really can use it with any database ActiveRecord supports.&lt;/p&gt;

&lt;p&gt;As a consequence of the minimalist approach, the skeleton does not supply tasks or folders for tests. The reason for this is simply that I did not want to force users of the skeleton into using a certain testing library. Test::Unit, Shoulda, RSpec, (your favorite testing framework mentioned here), just pick your favorite and add it your project. This is by no means a suggestion to ditch testing altogether though. You're just supposed to pick your flavour of TDD or BDD.&lt;/p&gt;

&lt;p&gt;Now head over to &lt;a href="http://github.com/colszowka/activerecord-skeleton/"&gt;GitHub&lt;/a&gt; and give it a spin!&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;It's common knowledge that ActiveRecord can be used nicely without Rails in Ruby apps. Setting up the basic stuff is pretty easy by just requiring the activerecord gem in your app and defining a couple of models.&lt;/p&gt;

&lt;p&gt;But what about migrations, yaml config and different environments? You have to set all this up manually, and even though this is not really hard, it's still a time-consuming task. No more!&lt;/p&gt;

&lt;h3&gt;Enter: ActiveRecord Skeleton&lt;/h3&gt;


&lt;p&gt;I published a new project on GitHub today, called &lt;a href="http://github.com/colszowka/activerecord-skeleton/"&gt;ActiveRecord Skeleton&lt;/a&gt;, and it really is just that: It will instantly give you YAML db config, database migrations (including Rake tasks for migrating the database as well as generating new migrations), a Rails-style project directory structure, and also the option of using environments by specifying the RACK_ENV environment variable. Why RACK_ENV? Well, you might also see this as a super-minimalist web app template, allowing you to set up a db-backed Sinatra (just an example, anything should work really) app instantly. All you really got to do is get the skeleton and add an application.rb file containing the following:&lt;/p&gt;

&lt;pre&gt;require 'sinatra'
require 'init'

get '/' do
  User.all.map {|u| u.name}.to_sentence
end&lt;/pre&gt;


&lt;p&gt;After running application.rb and pointing your browser to localhost:4567, you will see the list of existing users (assuming you've got the database and model set up properly, of course).&lt;/p&gt;

&lt;p&gt;Want to create a user? Start &lt;code&gt;irb&lt;/code&gt;, do a &lt;code&gt;require 'init'&lt;/code&gt; followed by &lt;code&gt;User.create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This skeleton is really minimalist, as I didn't want it to be over-opinionated. It's meant to give an easy start for about any Ruby code you might want to have database-interaction with and is ready to go with sqlite 3 in the default setup, but you really can use it with any database ActiveRecord supports.&lt;/p&gt;

&lt;p&gt;As a consequence of the minimalist approach, the skeleton does not supply tasks or folders for tests. The reason for this is simply that I did not want to force users of the skeleton into using a certain testing library. Test::Unit, Shoulda, RSpec, (your favorite testing framework mentioned here), just pick your favorite and add it your project. This is by no means a suggestion to ditch testing altogether though. You're just supposed to pick your flavour of TDD or BDD.&lt;/p&gt;

&lt;p&gt;Now head over to &lt;a href="http://github.com/colszowka/activerecord-skeleton/"&gt;GitHub&lt;/a&gt; and give it a spin!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Giraffesoft releasing Gems and Plugins this week</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/02/17/giraffesoft-releasing-gems-and-plugins-this-week"/>
    <id>http://colszowka.heroku.com/2009/02/17/giraffesoft-releasing-gems-and-plugins-this-week</id>
    <published>2009-02-17</published>
    <updated>2009-02-17</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;The folks at &lt;a href="http://www.giraffesoft.ca"&gt;Giraffesoft&lt;/a&gt; have decided to release some of the common code they've been using in their projects into plugins and gems on their brand-new company blog. In their own words:&lt;/p&gt;

&lt;blockquote&gt;
At giraffesoft, we're big believers in extracting functionality sooner rather than later. This practice has resulted in a ton of code that we use in all of our projects — nice and DRY.

Only problem is, we never get around to releasing this stuff. Starting a blog seemed like a good excuse to spend some time polishing up some code and, you know, writing READMEs.

So, starting today, we'll be releasing an open source project every day this week. They'll probably be mostly rails plugins. But, you never know. Something else might float in. 
&lt;/blockquote&gt;


&lt;p&gt;Actually, something else &lt;b&gt;did&lt;/b&gt; float in right on the first day: &lt;a href="http://giraffesoft.com/blog/2009/02/16/floss-week-day-1-classy-resources-resource-controller-for-sinatra.html"&gt;Classy Resources for Sinatra&lt;/a&gt;, a gem allowing you to create restful web services that can be consumed by ActiveResource without manually defining all of the controller actions, but rather with a (very Railsish) configuration-style method:&lt;/p&gt;

&lt;blockquote&gt;
define_resource :posts, :member     =&gt; [:get, :put, :delete],
                        :collection =&gt; [:get, :post],
                        :formats    =&gt; [:xml, :json, :yaml]
&lt;/blockquote&gt;


&lt;p&gt;The thing is pretty customizable and even if it's not exactly what you need, it still might be interesting to &lt;a href="http://github.com/giraffesoft/classy_resources"&gt;investigate the source code&lt;/a&gt; to see how to refactor common code into modules in Sinatra.&lt;/p&gt;

&lt;p&gt;If you don't know Sinatra yet, you really should go and check it out at &lt;a href="http://www.github.com/sinatra/sinatra"&gt;Github&lt;/a&gt; and have a look at the &lt;a href="http://sinatra.rubyforge.org/book.html"&gt;Sinatra book&lt;/a&gt;.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;The folks at &lt;a href="http://www.giraffesoft.ca"&gt;Giraffesoft&lt;/a&gt; have decided to release some of the common code they've been using in their projects into plugins and gems on their brand-new company blog. In their own words:&lt;/p&gt;

&lt;blockquote&gt;
At giraffesoft, we're big believers in extracting functionality sooner rather than later. This practice has resulted in a ton of code that we use in all of our projects — nice and DRY.

Only problem is, we never get around to releasing this stuff. Starting a blog seemed like a good excuse to spend some time polishing up some code and, you know, writing READMEs.

So, starting today, we'll be releasing an open source project every day this week. They'll probably be mostly rails plugins. But, you never know. Something else might float in. 
&lt;/blockquote&gt;


&lt;p&gt;Actually, something else &lt;b&gt;did&lt;/b&gt; float in right on the first day: &lt;a href="http://giraffesoft.com/blog/2009/02/16/floss-week-day-1-classy-resources-resource-controller-for-sinatra.html"&gt;Classy Resources for Sinatra&lt;/a&gt;, a gem allowing you to create restful web services that can be consumed by ActiveResource without manually defining all of the controller actions, but rather with a (very Railsish) configuration-style method:&lt;/p&gt;

&lt;blockquote&gt;
define_resource :posts, :member     =&gt; [:get, :put, :delete],
                        :collection =&gt; [:get, :post],
                        :formats    =&gt; [:xml, :json, :yaml]
&lt;/blockquote&gt;


&lt;p&gt;The thing is pretty customizable and even if it's not exactly what you need, it still might be interesting to &lt;a href="http://github.com/giraffesoft/classy_resources"&gt;investigate the source code&lt;/a&gt; to see how to refactor common code into modules in Sinatra.&lt;/p&gt;

&lt;p&gt;If you don't know Sinatra yet, you really should go and check it out at &lt;a href="http://www.github.com/sinatra/sinatra"&gt;Github&lt;/a&gt; and have a look at the &lt;a href="http://sinatra.rubyforge.org/book.html"&gt;Sinatra book&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>RDoc index for your Gems</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/02/13/rdoc-index-for-your-gems"/>
    <id>http://colszowka.heroku.com/2009/02/13/rdoc-index-for-your-gems</id>
    <published>2009-02-13</published>
    <updated>2009-02-13</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;I just posted a tiny script on &lt;a href="http://gist.github.com/63948" target="_blank"&gt;gist.github.com&lt;/a&gt; I wrote recently for usage on my dev machine that will create a HTML index for your locally installed RubyGems because I got really tired of having to browse through extraordinarily long paths to get to that local RDoc for ActiveRecord 2.0.2.&lt;/p&gt;




&lt;p&gt;Just generate the index with the script, bookmark the index.html file in the output directory and get immediate access to your local RDocs. You might also want to put the script into a cron job for automatic updating.&lt;/p&gt;


&lt;p&gt;Here's a screenshot of the index in action on my machine:&lt;/p&gt;

&lt;p&gt;&lt;img src="/local_gem_rdoc_index-300x239.png" alt="local gem rdoc index thumb"/&gt;&lt;/p&gt;

&lt;p&gt;The code is certainly not beautiful or anything, but it works for me and hopefully for you too!&lt;/p&gt;




&lt;p&gt;Get the thing here: &lt;a href="http://gist.github.com/63948" target="_blank"&gt;Local RDoc Index Generator&lt;/a&gt;&lt;/p&gt;

</summary>
    <content type="html">&lt;p&gt;I just posted a tiny script on &lt;a href="http://gist.github.com/63948" target="_blank"&gt;gist.github.com&lt;/a&gt; I wrote recently for usage on my dev machine that will create a HTML index for your locally installed RubyGems because I got really tired of having to browse through extraordinarily long paths to get to that local RDoc for ActiveRecord 2.0.2.&lt;/p&gt;




&lt;p&gt;Just generate the index with the script, bookmark the index.html file in the output directory and get immediate access to your local RDocs. You might also want to put the script into a cron job for automatic updating.&lt;/p&gt;


&lt;p&gt;Here's a screenshot of the index in action on my machine:&lt;/p&gt;

&lt;p&gt;&lt;img src="/local_gem_rdoc_index-300x239.png" alt="local gem rdoc index thumb"/&gt;&lt;/p&gt;

&lt;p&gt;The code is certainly not beautiful or anything, but it works for me and hopefully for you too!&lt;/p&gt;




&lt;p&gt;Get the thing here: &lt;a href="http://gist.github.com/63948" target="_blank"&gt;Local RDoc Index Generator&lt;/a&gt;&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>Added my Google Reader Shared Items</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/02/09/added-my-google-reader-widget"/>
    <id>http://colszowka.heroku.com/2009/02/09/added-my-google-reader-widget</id>
    <published>2009-02-09</published>
    <updated>2009-02-09</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Just a quick update since I am really busy learning for my exams: I added a RSS widget to the sidebar, featuring the postings I marked as "shared" in &lt;a href="http://www.google.com/reader" target="_blank"&gt;Google Reader&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Google Reader is really great for keeping up with the latest news and sharing them with others. The most stuff I mark as shared is Rails-related stuff anyway, so I thought it'd be a good idea to just add the feed here as well :)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Turns out the Wordpress RSS Widget is not compatible with the Google Reader Shared Items Atom feed, mangling the urls and titles while processing. I &lt;a href="http://sowinglight.com/2008/11/showing-google-reader-feeds-on-a-wordpress-sidebar/" target="_blank"&gt;found out how to fix that using Feedburner though&lt;/a&gt;, so now everything should work.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Just a quick update since I am really busy learning for my exams: I added a RSS widget to the sidebar, featuring the postings I marked as "shared" in &lt;a href="http://www.google.com/reader" target="_blank"&gt;Google Reader&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Google Reader is really great for keeping up with the latest news and sharing them with others. The most stuff I mark as shared is Rails-related stuff anyway, so I thought it'd be a good idea to just add the feed here as well :)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Turns out the Wordpress RSS Widget is not compatible with the Google Reader Shared Items Atom feed, mangling the urls and titles while processing. I &lt;a href="http://sowinglight.com/2008/11/showing-google-reader-feeds-on-a-wordpress-sidebar/" target="_blank"&gt;found out how to fix that using Feedburner though&lt;/a&gt;, so now everything should work.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Rails 2.3 release candidate out</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/02/02/111"/>
    <id>http://colszowka.heroku.com/2009/02/02/111</id>
    <published>2009-02-02</published>
    <updated>2009-02-02</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;The first release candidate of Rails 2.3 &lt;a href="http://weblog.rubyonrails.com/2009/2/1/rails-2-3-0-rc1-templates-engines-rack-metal-much-more" target="_blank"&gt;is out&lt;/a&gt;, which will probably be the last one in the 2.X-branch with the preview release of Rails/Merb 3.0 being scheduled for RailsConf in May 2009. Install with&lt;/p&gt;

&lt;pre&gt;
gem install rails --source http://gems.rubyonrails.com
&lt;/pre&gt;


&lt;p&gt;There is plenty of great, new features in Rails 2.3, so be sure to check out the &lt;a href="http://guides.rubyonrails.org/2_3_release_notes.html"&gt;official release notes&lt;/a&gt; as well as Ryan Daigles &lt;a href="http://ryandaigle.com/articles/2009/2/2/rails-2-3-released-summary-of-features"&gt;article&lt;/a&gt; featuring links to all of the summaries he wrote about the new features in the past months.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;The first release candidate of Rails 2.3 &lt;a href="http://weblog.rubyonrails.com/2009/2/1/rails-2-3-0-rc1-templates-engines-rack-metal-much-more" target="_blank"&gt;is out&lt;/a&gt;, which will probably be the last one in the 2.X-branch with the preview release of Rails/Merb 3.0 being scheduled for RailsConf in May 2009. Install with&lt;/p&gt;

&lt;pre&gt;
gem install rails --source http://gems.rubyonrails.com
&lt;/pre&gt;


&lt;p&gt;There is plenty of great, new features in Rails 2.3, so be sure to check out the &lt;a href="http://guides.rubyonrails.org/2_3_release_notes.html"&gt;official release notes&lt;/a&gt; as well as Ryan Daigles &lt;a href="http://ryandaigle.com/articles/2009/2/2/rails-2-3-released-summary-of-features"&gt;article&lt;/a&gt; featuring links to all of the summaries he wrote about the new features in the past months.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Ruby / Rails related links</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/24/ruby-rails-related-links"/>
    <id>http://colszowka.heroku.com/2009/01/24/ruby-rails-related-links</id>
    <published>2009-01-24</published>
    <updated>2009-01-24</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;h2&gt;Sinatra app template&lt;/h2&gt;


&lt;p&gt;&lt;a href="http://blog.zerosum.org/"&gt;Nick Plante&lt;/a&gt; has &lt;a href="http://blog.zerosum.org/2009/1/23/the-way-you-wear-your-hat"&gt;released&lt;/a&gt; a nice application template for Sinatra, with a reasonable initial directory structure and a Rackup script for easy use with Passenger. Haml, DataMapper, RSpec and such are also included, so this is pretty biased, but you&amp;#8217;re free to fork it and adjust to your needs on &lt;a href="http://github.com/zapnap/sinatra-template/tree/master"&gt;github&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;I gave it a spin and had no problem to run it with Passenger by just pointing the Apache vhost configuration to the public folder of the app, so this is also great when you&amp;#8217;d like to have an example on using Rack apps with Passenger.&lt;/p&gt;


&lt;h2&gt;Rails templates&lt;/h2&gt;


&lt;p&gt;Application templates seem to be up and coming currently, with the best thing obviously being the Rails templates feature in Edge Rails a.k.a. the upcoming Rails 2.3. Core member Pratik Naik posted a &lt;a href="http://m.onkey.org/2008/12/4/rails-templates"&gt;nice summary&lt;/a&gt; of the available methods in December, and Peter Cooper from &lt;a href="http://www.railsinside.com"&gt;Rails Inside&lt;/a&gt; posted more on the topic &lt;a href="http://www.railsinside.com/tips/212-rails-templates-pumped-full-of-caffeine.html"&gt;yesterday&lt;/a&gt;, with links to example scripts.&lt;/p&gt;


&lt;p&gt;Basically this allows for scripting of the Rails application generator, giving you a &lt;span class="caps"&gt;DSL&lt;/span&gt; with methods to pull in plugins, executing rake tasks and so on. The template can be pulled in remotely, for example from a &lt;a href="http://gist.github.com/33337"&gt;gist&lt;/a&gt;. Peter &amp;#8220;Super Daring App Template&amp;#8221; can be used with &lt;code&gt;rails [whatever] -m http://gist.github.com/33337.txt&lt;/code&gt;, and you are free to fork it and roll your own.&lt;/p&gt;


&lt;p&gt;Some kind of template database would be nice though, listing all public templates and their features, so you can pick your favorite and use it.&lt;/p&gt;


&lt;h2&gt;Zebra &amp;#8211; One line tests for shoulda, context and matchy&lt;/h2&gt;


&lt;p&gt;I really like &lt;a href="http://thoughtbot.com/projects/shoulda/"&gt;Shoulda&lt;/a&gt;. &lt;a href="http://jamesgolick.com"&gt;James Golick&lt;/a&gt; has &lt;a href="http://jamesgolick.com/2009/1/16/one-line-tests-without-the-smells"&gt;released a gem&lt;/a&gt; that enhances it further, called &lt;a href="http://github.com/giraffesoft/zebra"&gt;Zebra&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The functionality can be summed up with this example from James&amp;#8217; initial post:&lt;/p&gt;


&lt;pre&gt;&lt;code class="multiline_code"&gt;should &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;be editable by its author&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt;
  assert &lt;span class="iv"&gt;@post&lt;/span&gt;.editable_by?(&lt;span class="iv"&gt;@author&lt;/span&gt;)
&lt;span class="r"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;becomes&amp;#8230;&lt;/p&gt;


&lt;pre&gt;&lt;code class="multiline_code"&gt;expect { &lt;span class="iv"&gt;@post&lt;/span&gt;.to be_editable_by(&lt;span class="iv"&gt;@author&lt;/span&gt;) }&lt;/code&gt;&lt;/pre&gt;


&lt;h2&gt;Roll your own Pastebin with NavySnip&lt;/h2&gt;


&lt;p&gt;NavySnip is a &lt;a href="http://pastie.org/-like"&gt;pastie&lt;/a&gt; pastebin Rails application, but intended for localhost use. Check out the &lt;a href="http://files.navyrain.net/navysnip_screenshot.png"&gt;screenshot&lt;/a&gt; or have a look at the &lt;a href="http://github.com/navyrain/navysnip/tree/master"&gt;github repository&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Currently, it does not have syntax highlighting, but with a little help from Coderay or a similar Ruby gem, it should be easy to bring that into the app.&lt;/p&gt;


&lt;h2&gt;Free Lighthouse/Basecamp-inspired web app theme&lt;/h2&gt;


&lt;p&gt;&lt;a href="http://gravityblast.com/"&gt;Andrea Franz&lt;/a&gt; released a &lt;a href="http://gravityblast.com/2009/01/18/web-app-theme/"&gt;nice-looking web app theme&lt;/a&gt; that looks very familiar if you have been to sites like Lighthouse or Basecamp. Go &lt;a href="http://github.com/pilu/web-app-theme/tree/master"&gt;check it out at Github&lt;/a&gt; and make a great app with it!&lt;/p&gt;


&lt;h2&gt;Little Known Ways to Ruby Mastery by Ryan Bates&lt;/h2&gt;


&lt;p&gt;To finish things up, there is a nice interview with &lt;a href="http://www.railscasts.com"&gt;Ryan Bates&lt;/a&gt; over at &lt;a href="http://rubylearning.com/blog/2009/01/20/little-known-ways-to-ruby-mastery-by-ryan-bates/"&gt;Rubylearning&lt;/a&gt;&lt;/p&gt;

</summary>
    <content type="html">&lt;h2&gt;Sinatra app template&lt;/h2&gt;


&lt;p&gt;&lt;a href="http://blog.zerosum.org/"&gt;Nick Plante&lt;/a&gt; has &lt;a href="http://blog.zerosum.org/2009/1/23/the-way-you-wear-your-hat"&gt;released&lt;/a&gt; a nice application template for Sinatra, with a reasonable initial directory structure and a Rackup script for easy use with Passenger. Haml, DataMapper, RSpec and such are also included, so this is pretty biased, but you&amp;#8217;re free to fork it and adjust to your needs on &lt;a href="http://github.com/zapnap/sinatra-template/tree/master"&gt;github&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;I gave it a spin and had no problem to run it with Passenger by just pointing the Apache vhost configuration to the public folder of the app, so this is also great when you&amp;#8217;d like to have an example on using Rack apps with Passenger.&lt;/p&gt;


&lt;h2&gt;Rails templates&lt;/h2&gt;


&lt;p&gt;Application templates seem to be up and coming currently, with the best thing obviously being the Rails templates feature in Edge Rails a.k.a. the upcoming Rails 2.3. Core member Pratik Naik posted a &lt;a href="http://m.onkey.org/2008/12/4/rails-templates"&gt;nice summary&lt;/a&gt; of the available methods in December, and Peter Cooper from &lt;a href="http://www.railsinside.com"&gt;Rails Inside&lt;/a&gt; posted more on the topic &lt;a href="http://www.railsinside.com/tips/212-rails-templates-pumped-full-of-caffeine.html"&gt;yesterday&lt;/a&gt;, with links to example scripts.&lt;/p&gt;


&lt;p&gt;Basically this allows for scripting of the Rails application generator, giving you a &lt;span class="caps"&gt;DSL&lt;/span&gt; with methods to pull in plugins, executing rake tasks and so on. The template can be pulled in remotely, for example from a &lt;a href="http://gist.github.com/33337"&gt;gist&lt;/a&gt;. Peter &amp;#8220;Super Daring App Template&amp;#8221; can be used with &lt;code&gt;rails [whatever] -m http://gist.github.com/33337.txt&lt;/code&gt;, and you are free to fork it and roll your own.&lt;/p&gt;


&lt;p&gt;Some kind of template database would be nice though, listing all public templates and their features, so you can pick your favorite and use it.&lt;/p&gt;


&lt;h2&gt;Zebra &amp;#8211; One line tests for shoulda, context and matchy&lt;/h2&gt;


&lt;p&gt;I really like &lt;a href="http://thoughtbot.com/projects/shoulda/"&gt;Shoulda&lt;/a&gt;. &lt;a href="http://jamesgolick.com"&gt;James Golick&lt;/a&gt; has &lt;a href="http://jamesgolick.com/2009/1/16/one-line-tests-without-the-smells"&gt;released a gem&lt;/a&gt; that enhances it further, called &lt;a href="http://github.com/giraffesoft/zebra"&gt;Zebra&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The functionality can be summed up with this example from James&amp;#8217; initial post:&lt;/p&gt;


&lt;pre&gt;&lt;code class="multiline_code"&gt;should &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;be editable by its author&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt;
  assert &lt;span class="iv"&gt;@post&lt;/span&gt;.editable_by?(&lt;span class="iv"&gt;@author&lt;/span&gt;)
&lt;span class="r"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;becomes&amp;#8230;&lt;/p&gt;


&lt;pre&gt;&lt;code class="multiline_code"&gt;expect { &lt;span class="iv"&gt;@post&lt;/span&gt;.to be_editable_by(&lt;span class="iv"&gt;@author&lt;/span&gt;) }&lt;/code&gt;&lt;/pre&gt;


&lt;h2&gt;Roll your own Pastebin with NavySnip&lt;/h2&gt;


&lt;p&gt;NavySnip is a &lt;a href="http://pastie.org/-like"&gt;pastie&lt;/a&gt; pastebin Rails application, but intended for localhost use. Check out the &lt;a href="http://files.navyrain.net/navysnip_screenshot.png"&gt;screenshot&lt;/a&gt; or have a look at the &lt;a href="http://github.com/navyrain/navysnip/tree/master"&gt;github repository&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Currently, it does not have syntax highlighting, but with a little help from Coderay or a similar Ruby gem, it should be easy to bring that into the app.&lt;/p&gt;


&lt;h2&gt;Free Lighthouse/Basecamp-inspired web app theme&lt;/h2&gt;


&lt;p&gt;&lt;a href="http://gravityblast.com/"&gt;Andrea Franz&lt;/a&gt; released a &lt;a href="http://gravityblast.com/2009/01/18/web-app-theme/"&gt;nice-looking web app theme&lt;/a&gt; that looks very familiar if you have been to sites like Lighthouse or Basecamp. Go &lt;a href="http://github.com/pilu/web-app-theme/tree/master"&gt;check it out at Github&lt;/a&gt; and make a great app with it!&lt;/p&gt;


&lt;h2&gt;Little Known Ways to Ruby Mastery by Ryan Bates&lt;/h2&gt;


&lt;p&gt;To finish things up, there is a nice interview with &lt;a href="http://www.railscasts.com"&gt;Ryan Bates&lt;/a&gt; over at &lt;a href="http://rubylearning.com/blog/2009/01/20/little-known-ways-to-ruby-mastery-by-ryan-bates/"&gt;Rubylearning&lt;/a&gt;&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>RailsConf Europe 2009 cancelled, registration for Vegas open</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/24/railsconf-europe-2009-cancelled-registration-for-vegas-open"/>
    <id>http://colszowka.heroku.com/2009/01/24/railsconf-europe-2009-cancelled-registration-for-vegas-open</id>
    <published>2009-01-24</published>
    <updated>2009-01-24</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;As &lt;a href="http://dablog.rubypal.com/2009/1/23/railsconf-registration-and-a-hiatus-year-for-railsconf-europe"&gt;David A. Black&lt;/a&gt; states on his blog, there won't be a  RailsConf Europe this year:&lt;/p&gt;

&lt;blockquote&gt;
Ruby Central and O’Reilly have decided to take a hiatus from producing RailsConf Europe this year, for the simple reason that it didn’t bring in enough revenue last year to justify doing it again, particularly given the tight economy and the need to err on the side of caution. RailsConf Europe has always been a really great event, and people who go to it really love it, but we need a year of retrenchment while we figure out how to get everyone else to realize how great it is! Plans for 2010 are not certain yet; we’re taking it one year at a time.
&lt;/blockquote&gt;


&lt;p&gt;Quite disappointing, even though I was not in Berlin last year (but oddly enough in Portland, which makes for a travel distance of several thousand kilometers against 300). Maybe they should not have the conference hosted in super-exclusive downtown-hotels (like it was at the Maritim in Berlin), but rather just in some convention center.&lt;/p&gt;

&lt;p&gt;In other news, David Heinemeier Hansson has &lt;a href="http://weblog.rubyonrails.com/2009/1/23/railsconf-2009-viva-las-vegas"&gt;announced&lt;/a&gt; the opening of registration for RailsConf 2009 in Las Vegas. The event is taking place from May 4th through 7th, in the Las Vegas Hilton. I really hope this does not mean RailsConf US won't be happening in 2010 for not "bringing enough revenue", as I can imagine the Las Vegas Hilton being more expensive to rent than the Oregon Convention Center in the last years.&lt;/p&gt;

&lt;p&gt;They have early registration open until March 16th, so &lt;a href="http://www.railsconf.com/"&gt;go and grab a seat&lt;/a&gt; and save 200 bucks!&lt;/p&gt;

&lt;p&gt;You might also want to check out this years &lt;a href="http://en.oreilly.com/rails2009/public/content/cabooseconf"&gt;CabooseConf&lt;/a&gt;, the Ruby/Rails hacker event which will also be taking place at the Las Vegas Hilton during RailsConf, and can be entered for free with an exhibit hall only pass. You might be asked for a link to an open source submission you did, though.&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;As &lt;a href="http://dablog.rubypal.com/2009/1/23/railsconf-registration-and-a-hiatus-year-for-railsconf-europe"&gt;David A. Black&lt;/a&gt; states on his blog, there won't be a  RailsConf Europe this year:&lt;/p&gt;

&lt;blockquote&gt;
Ruby Central and O’Reilly have decided to take a hiatus from producing RailsConf Europe this year, for the simple reason that it didn’t bring in enough revenue last year to justify doing it again, particularly given the tight economy and the need to err on the side of caution. RailsConf Europe has always been a really great event, and people who go to it really love it, but we need a year of retrenchment while we figure out how to get everyone else to realize how great it is! Plans for 2010 are not certain yet; we’re taking it one year at a time.
&lt;/blockquote&gt;


&lt;p&gt;Quite disappointing, even though I was not in Berlin last year (but oddly enough in Portland, which makes for a travel distance of several thousand kilometers against 300). Maybe they should not have the conference hosted in super-exclusive downtown-hotels (like it was at the Maritim in Berlin), but rather just in some convention center.&lt;/p&gt;

&lt;p&gt;In other news, David Heinemeier Hansson has &lt;a href="http://weblog.rubyonrails.com/2009/1/23/railsconf-2009-viva-las-vegas"&gt;announced&lt;/a&gt; the opening of registration for RailsConf 2009 in Las Vegas. The event is taking place from May 4th through 7th, in the Las Vegas Hilton. I really hope this does not mean RailsConf US won't be happening in 2010 for not "bringing enough revenue", as I can imagine the Las Vegas Hilton being more expensive to rent than the Oregon Convention Center in the last years.&lt;/p&gt;

&lt;p&gt;They have early registration open until March 16th, so &lt;a href="http://www.railsconf.com/"&gt;go and grab a seat&lt;/a&gt; and save 200 bucks!&lt;/p&gt;

&lt;p&gt;You might also want to check out this years &lt;a href="http://en.oreilly.com/rails2009/public/content/cabooseconf"&gt;CabooseConf&lt;/a&gt;, the Ruby/Rails hacker event which will also be taking place at the Las Vegas Hilton during RailsConf, and can be entered for free with an exhibit hall only pass. You might be asked for a link to an open source submission you did, though.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Setting up the whole Rails stack from a single Debian meta package in 10 minutes</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/22/setting-up-the-whole-rails-stack-from-a-single-debian-meta-package"/>
    <id>http://colszowka.heroku.com/2009/01/22/setting-up-the-whole-rails-stack-from-a-single-debian-meta-package</id>
    <published>2009-01-22</published>
    <updated>2009-01-22</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;After staying almost the whole last week in the hospital because all of a sudden my appendix decided to hurt and part ways with me, I finally managed to finish my article &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;I announced earlier&lt;/a&gt; on installing a whole Rails stack with Apache2, MySQL, Ruby, Rubygems, Phusion Passenger from a single Debian package file using the &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service and the &lt;a href="http://blog.brightbox.co.uk/posts/brightbox-builds-hardy-passenger-package"&gt;Brightbox Passenger Debian packages&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;This article won&amp;#8217;t cover many basics of using the &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service. If you need an introduction, you might want to check out my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;earlier&lt;/a&gt; &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;postings&lt;/a&gt; on the topic.&lt;/p&gt;


&lt;h2&gt;Preparing the VM&lt;/h2&gt;


&lt;p&gt;Just like in my &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;second post&lt;/a&gt; on DebGem, I used a vanilla &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS 8.04.1 &lt;span class="caps"&gt;LTS&lt;/span&gt;&lt;/a&gt; install in &lt;a href="http://www.virtualbox.org/"&gt;Virtualbox&lt;/a&gt;. Apart from the &lt;code&gt;openssh-server&lt;/code&gt; package for easier access to the machine and an initial &lt;code&gt;sudo apt-get update &amp;&amp; sudo apt-get upgrade&lt;/code&gt;, the machine was untouched.&lt;/p&gt;


&lt;p&gt;To start out, I installed the most basic required cli tools with&lt;/p&gt;


&lt;pre&gt;sudo apt-get install bash-completion nano wget curl&lt;/pre&gt;


&lt;p&gt;since JeOS is so much &amp;#8220;Just enough OS&amp;#8221; it does not even supply these very common packages. After this, the machine is ready to install the stack.&lt;/p&gt;


&lt;h2&gt;Adding the DebGem and Brightbox repositories&lt;/h2&gt;


&lt;p&gt;The additional debian repositories needed to be added to the apt package sources now in order for the Gems and Passenger to be installed properly:&lt;/p&gt;


&lt;pre&gt;
# Switch to root shell
sudo -s 

# Add debgem repository
sh -c 'echo "deb http://www.debgem.com/apt ubuntu-8.04 rubyforge" &gt; /etc/apt/sources.list.d/debgem.list'
sh -c 'wget -q http://www.debgem.com/apt/debgem.gpg -O- | apt-key add -'
sh -c 'echo "APT::Cache-Limit 33554432;" &gt; /etc/apt/apt.conf'

# Add brightbox passenger repository
sh -c 'echo "deb http://apt.brightbox.net hardy main" &gt; /etc/apt/sources.list.d/brightbox.list'
sh -c 'wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -'

# Update repository index
apt-get update
&lt;/pre&gt;


&lt;h2&gt;Installing the stack from the deb file&lt;/h2&gt;


&lt;p&gt;I uploaded the sample .deb file and it&amp;#8217;s sources to &lt;a href="http://github.com/colszowka/railsstack.deb"&gt;github&lt;/a&gt;. The tarball of the project can be retrieved and extracted with:&lt;/p&gt;


&lt;pre&gt;
wget -nv http://github.com/colszowka/railsstack.deb/tarball/master -O- | tar xzv -C

</summary>
    <content type="html">&lt;p&gt;After staying almost the whole last week in the hospital because all of a sudden my appendix decided to hurt and part ways with me, I finally managed to finish my article &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;I announced earlier&lt;/a&gt; on installing a whole Rails stack with Apache2, MySQL, Ruby, Rubygems, Phusion Passenger from a single Debian package file using the &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service and the &lt;a href="http://blog.brightbox.co.uk/posts/brightbox-builds-hardy-passenger-package"&gt;Brightbox Passenger Debian packages&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;This article won&amp;#8217;t cover many basics of using the &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service. If you need an introduction, you might want to check out my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;earlier&lt;/a&gt; &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;postings&lt;/a&gt; on the topic.&lt;/p&gt;


&lt;h2&gt;Preparing the VM&lt;/h2&gt;


&lt;p&gt;Just like in my &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;second post&lt;/a&gt; on DebGem, I used a vanilla &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS 8.04.1 &lt;span class="caps"&gt;LTS&lt;/span&gt;&lt;/a&gt; install in &lt;a href="http://www.virtualbox.org/"&gt;Virtualbox&lt;/a&gt;. Apart from the &lt;code&gt;openssh-server&lt;/code&gt; package for easier access to the machine and an initial &lt;code&gt;sudo apt-get update &amp;&amp; sudo apt-get upgrade&lt;/code&gt;, the machine was untouched.&lt;/p&gt;


&lt;p&gt;To start out, I installed the most basic required cli tools with&lt;/p&gt;


&lt;pre&gt;sudo apt-get install bash-completion nano wget curl&lt;/pre&gt;


&lt;p&gt;since JeOS is so much &amp;#8220;Just enough OS&amp;#8221; it does not even supply these very common packages. After this, the machine is ready to install the stack.&lt;/p&gt;


&lt;h2&gt;Adding the DebGem and Brightbox repositories&lt;/h2&gt;


&lt;p&gt;The additional debian repositories needed to be added to the apt package sources now in order for the Gems and Passenger to be installed properly:&lt;/p&gt;


&lt;pre&gt;
# Switch to root shell
sudo -s 

# Add debgem repository
sh -c 'echo "deb http://www.debgem.com/apt ubuntu-8.04 rubyforge" &gt; /etc/apt/sources.list.d/debgem.list'
sh -c 'wget -q http://www.debgem.com/apt/debgem.gpg -O- | apt-key add -'
sh -c 'echo "APT::Cache-Limit 33554432;" &gt; /etc/apt/apt.conf'

# Add brightbox passenger repository
sh -c 'echo "deb http://apt.brightbox.net hardy main" &gt; /etc/apt/sources.list.d/brightbox.list'
sh -c 'wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -'

# Update repository index
apt-get update
&lt;/pre&gt;


&lt;h2&gt;Installing the stack from the deb file&lt;/h2&gt;


&lt;p&gt;I uploaded the sample .deb file and it&amp;#8217;s sources to &lt;a href="http://github.com/colszowka/railsstack.deb"&gt;github&lt;/a&gt;. The tarball of the project can be retrieved and extracted with:&lt;/p&gt;


&lt;pre&gt;
wget -nv http://github.com/colszowka/railsstack.deb/tarball/master -O- | tar xzv -C /
&lt;/pre&gt;


&lt;p&gt;Now just switch over to the extracted folder&amp;#8217;s subdirectory &amp;#8216;deb&amp;#8217;:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
  cd colszowka-railsstack.deb-8bfcf1812c76766c095eb5a1510f2e84742b703a/deb/&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;


&lt;p&gt;The installation of the whole stack can now be invoked with&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
dpkg -i --force-depends railsstack.deb&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;


&lt;p&gt;Unfortunately, the &lt;code&gt;dpkg&lt;/code&gt; command is unable to resolve remote dependencies, so the output will print a multitude of unresolved ones. But worry not, these will get automatically resolved by apt-get when running the following command:&lt;/p&gt;


&lt;pre&gt;
apt-get -f install
&lt;/pre&gt;


&lt;p&gt;The whole install will kick off now, installing as much as &lt;code&gt;ruby, ri, rdoc, irb, rubygems, apache2, mysql-server-5.0, mysql-client-5.0, rails2.2.2-ruby1.8, libfastthread-ruby1.8, libapache2-mod-passenger and libmysql-ruby&lt;/code&gt; completely automatically. You will get asked for your desired MySQL root user password once, but that&amp;#8217;s about it. After a couple of minutes, everything should be ready for the big test. Do not forget though to exit the root shell when installing Typo!&lt;/p&gt;


&lt;h2&gt;Test run with Typo 5.1.98&lt;/h2&gt;


&lt;p&gt;To check if Apache2/Passenger, MySQL, Ruby, Rails and everything else worked fine, I gave it a spin with the Typo Rails open source blog app:&lt;/p&gt;


&lt;pre&gt;
cd ~
wget http://rubyforge.org/frs/download.php/49562/typo-5.1.98.tgz
tar xfz typo-5.1.98.tgz
cd typo-5.1.98
cp config/database.yml.example config/database.yml
nano config/database.yml # Enter db credentials...
&lt;/pre&gt;


&lt;p&gt;As a next step, the databases needed to be setup and the hideous .htaccess file from Typo&amp;#8217;s public folder must be removed due to the problems it causes in combination with Apache.&lt;/p&gt;


&lt;pre&gt;
rake db:create:all
rake db:migrate RAILS_ENV=production
rm public/.htaccess 
&lt;/pre&gt;


&lt;p&gt;To finish things, I just removed the default Apache2 host and defined my own for the Typo app using Passenger:&lt;/p&gt;


&lt;pre&gt;
sudo rm /etc/apache2/sites-enabled/000-default 
sudo nano /etc/apache2/sites-enabled/passenger
&lt;/pre&gt;


&lt;p&gt;The config looks like this:&lt;/p&gt;


&lt;pre&gt;
&lt;VirtualHost *:80&gt;
    ServerName 127.0.0.1
    DocumentRoot /home/colszowka/typo-5.1.98/public
&lt;/VirtualHost&gt;
&lt;/pre&gt;


&lt;p&gt;Just a restart of Apache missing, &lt;code&gt;sudo /etc/init.d/apache2 restart&lt;/code&gt;, and everything&amp;#8217;s done, done! Let&amp;#8217;s verify everything works:&lt;/p&gt;


&lt;pre&gt;
$ curl localhost
&lt;html&gt;&lt;body&gt;You are being &lt;a href="http://localhost/accounts/signup"&gt;redirected&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt;
&lt;/pre&gt;


&lt;p&gt;Sweet! To have a look at the site with my web browser, I created a port forwarding in VirtualBox (&lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;I wrote on how to accomplish that earlier&lt;/a&gt;) and pointed my browser to localhost:3123, the port I chose for the forwarding. The result in pictures rather than words:&lt;/p&gt;


&lt;div align="center"&gt;
&lt;p&gt;&lt;img src="/railsstack_deb_typo_signup-274x300.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/railsstack_deb_admin-300x222.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/railsstack_deb_typo_page-300x222.png"/&gt;&lt;/p&gt;
&lt;/div&gt;


&lt;h2&gt;The structure of the .deb package&lt;/h2&gt;


&lt;p&gt;The Debian (meta-)package used to setup the whole Apache/Passenger/MySQL/Ruby/Rails stack in merely ten minutes is pretty straight forward. It only consists of a &lt;code&gt;control&lt;/code&gt; file sitting inside a &lt;code&gt;DEBIAN&lt;/code&gt; folder. The file only describes the packages it depends upon, which then will be pulled in by apt-get. Take a look at it over at &lt;a href="http://github.com/colszowka/railsstack.deb"&gt;github&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;The control file looks like following:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
Package: railsstack&lt;br /&gt;
Essential: no&lt;br /&gt;
Priority: extra&lt;br /&gt;
Section: metapackages&lt;br /&gt;
Maintainer: Christoph Olszowka &lt;christoph at olszowka.de&gt;&lt;br /&gt;
Architecture: i386&lt;br /&gt;
Version: 1&lt;br /&gt;
Depends: ruby, ri, rdoc, irb, rubygems, apache2, mysql-server-5.0, mysql-client-5.0, rails2.2.2-ruby1.8, libfastthread-ruby1.8, libapache2-mod-passenger, libmysql-ruby&lt;br /&gt;
Description: Metapackage for installing a Ruby on Rails stack on Apache2 with MySQL using Passenger (built by Brightbox) and DebGem.com&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;


&lt;p&gt;&lt;i&gt;Note: Unfortunately and as &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;mentioned&lt;/a&gt; &lt;a href="http://blog.olszowka.de/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu/"&gt;before&lt;/a&gt;, this will currently still pull in loads of Rails versions and it&amp;#8217;s dependencies since obviously the DebGem gem dependency list is still not working properly (or it is intendend to work like this, which to me makes no sense when I pull in a specific version of Rails, like I did in the control file with depending upon rails2.2.2-ruby1.8)&lt;/i&gt;&lt;/p&gt;


&lt;p&gt;Building the package is simple: &lt;code&gt;dpkg -b package railsstack.deb&lt;/code&gt;. After that, just put the .deb file on your server and execute mentioned commands:&lt;/p&gt;


&lt;pre&gt;
dpkg -i --force-depends railsstack.deb
apt-get -f install
&lt;/pre&gt;


&lt;h2&gt;Conclusion&lt;/h2&gt;


&lt;p&gt;Providing .deb metapackages allows for really simple, quick and straight-forward deployment of any Rails app on a vanilla Ubuntu JeOS Server. Rubygems even get updated automatically by DebGem to the latest version, so I did not have to stick with the old default Ubuntu package of Rubygems.&lt;/p&gt;


&lt;p&gt;I did not try this yet with the actual Ubuntu Server distribution, which is much more widely used on servers, but since the server edition depends upon the same basic packages (apache2, mysql-server-5.0) as JeOS does, things should work the same way, maybe even quicker if you install the basic packages like Apache and MySQL from the CD.&lt;/p&gt;


&lt;p&gt;&lt;b&gt;Update, 2009-01-12:&lt;/b&gt; &lt;i&gt;I actually tried this process on a new install of Ubuntu Server 8.04 with preinstalled LAMP, and everything worked just perfectly with the same steps as described above. The package manager recognized the already installed MySQL and Apache packages and did not try to reinstall them, just pulling in Passenger, Ruby and Rails.&lt;/i&gt;
&lt;/p&gt;


&lt;p&gt;Similar packages for Sinatra, Merb or anything you might want up and running quickly on your server should be no problem at well with a customized &lt;a href="http://github.com/colszowka/railsstack.deb"&gt;Railsstack.deb&lt;/a&gt;, so with a little help from &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; and &lt;a href="http://blog.brightbox.co.uk/posts/brightbox-builds-hardy-passenger-package"&gt;Brightbox&lt;/a&gt;, setting up a working Ruby environment for almost any Ruby server application becomes a no-brainer.&lt;/p&gt;


&lt;p&gt;With the steps mentioned above, I was able to go from a freshly installed Ubuntu JeOS 8.04.1 to accessing the Typo site hosted on the machine in just 10 minutes, and plenty of this time was spent with downloading old Rails versions from DebGem, which hopefully will get sorted while the service is still in beta. When it becomes possible to pull in just the required versions of gems, it might be possible to have Typo running in just 5 minutes.&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>DebGem test-run on a vanilla Ubuntu</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu"/>
    <id>http://colszowka.heroku.com/2009/01/09/debgem-test-run-on-a-vanilla-ubuntu</id>
    <published>2009-01-09</published>
    <updated>2009-01-09</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Like already announced in my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;previous first look&lt;/a&gt; into the new &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service by &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt;. I had a deeper look into the service today, giving it a spin under a freshly installed &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu Server JeOS&lt;/a&gt; virtual machine.&lt;/p&gt;


&lt;p&gt;JeOS is great since it has a kernel tweaked for virtual environments and the disc image has a footprint of only 100 megs, which ensures download and install times are low.&lt;/p&gt;


&lt;h2&gt;Setting up the vm for testing&lt;/h2&gt;


&lt;p&gt;Since &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; currently only offers binary packages for Ubuntu 8.04 &lt;span class="caps"&gt;LTS&lt;/span&gt;, I picked up the JeOS cd image for that, which can be downloaded in the latest version 8.04.1 from &lt;a href="http://cdimage.ubuntu.com/jeos/releases/8.04.1/release/"&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;After setting up a new Ubuntu-based virtual machine &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; and getting through the installation steps for &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS&lt;/a&gt; (I won&amp;#8217;t get into detail about that&amp;#8230;), as a first step I updated the whole system with apt by issuing:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get update &amp;&amp; sudo apt-get upgrade
&lt;/pre&gt;


&lt;p&gt;This was followed by the install of the most basic tools:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install bash-completion nano wget curl man
&lt;/pre&gt;


&lt;p&gt;I also installed openssh-server so I could access the machine from my regular terminal, but that is optional. If you decided to follow along, please remember that you will have to set port forwarding for VirtualBox properly. On the machine you are running VirtualBox on, first find the name of your VM by typing:&lt;/p&gt;


&lt;pre&gt;
VBoxManage list vms
&lt;/pre&gt;


&lt;p&gt;Find your new virtual machine and remember it&amp;#8217;s name. Now you will have to set the port forwarding for ssh with the following commands, putting your vm&amp;#8217;s name in the obvious spot:&lt;/p&gt;


&lt;pre&gt;
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
&lt;/pre&gt;


&lt;p&gt;You can double-check if everything worked out by issuing,&lt;/p&gt;


&lt;pre&gt;
VBoxManage getextradata "YOUR VMS NAME" enumerate
&lt;/pre&gt;


&lt;p&gt;which should give you a list of your machines properties, including the newly set forwarding options. Now you will have to completely shut down and start up your vm so these options get applied. After that, you should be able to ssh to the machine with:&lt;/p&gt;


&lt;pre&gt;
ssh localhost -p 2222
&lt;/pre&gt;


&lt;h2&gt;Setting up Ruby and MySQL&lt;/h2&gt;


&lt;p&gt;Just install everything from the packages by issuing&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install ruby ri rdoc irb rubygems mysql-server-5.0 mysql-client-5.0
&lt;/pre&gt;


&lt;p&gt;MySQL will ask you for a new password for the root user, type it in and you&amp;#8217;re ready.&lt;/p&gt;


&lt;h2&gt;Adding the DebGem apt repository&lt;/h2&gt;


&lt;p&gt;To add the Rubyforge gems to apt, issue the following commands:&lt;/p&gt;


&lt;pre&gt;
sudo sh -c 'echo "deb http://www.debgem.com/apt ubuntu-8.04 rubyforge" &gt; /etc/apt/sources.list.d/debgem.list'
sudo sh -c 'wget -q http://www.debgem.com/apt/debgem.gpg -O- | apt-key add -'
sudo sh -c 'echo "APT::Cache-Limit 33554432;" &gt; /etc/apt/apt.conf'
sudo apt-get update
&lt;/pre&gt;


&lt;p&gt;This will add the debgem repository, add their key so apt-get won&amp;#8217;t complain and also raise the cache-limit, which is required due to the amount of packages served by DebGem. Finally, we update the whole cache so the Gems will appear in apt-get.&lt;/p&gt;


&lt;p&gt;Please remember the following though, taken from the &lt;a href="http://www.debgem.com/usage"&gt;DebGem usage page&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;Note: These URLs will likely change after DebGem has gone out of beta, so please check this web page again if apt-get update doesn&amp;#8217;t work anymore.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;Testing DebGem, part 1: Hpricot&lt;/h2&gt;


&lt;p&gt;I chose Hpricot because its basic functionality can be tested in a single line with irb, while it still is a native extension which normally would have required me to install at least the build-essential Ubuntu package, if not some required libraries as well which I would have to hunt down in the Ubuntu repositories. Installing Hpricot via DebGem on the other hand is pretty straight-forward:&lt;/p&gt;


&lt;pre&gt;
apt-get install libhpricot-ruby1.8 
&lt;/pre&gt;


&lt;p&gt;After that and opposing to my findings &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;in my previous post&lt;/a&gt;, when I was not able to install any gems from DebGem &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;due to my manual install of RubyGems&lt;/a&gt;, the Hpricot gem now appeared in my gem list:&lt;/p&gt;


&lt;pre&gt;
gem list --local
*** LOCAL GEMS ***
hpricot (0.6.164, 0.5, 0.4)  
&lt;/pre&gt;


&lt;p&gt;Now, let&amp;#8217;s see if it works!&lt;/p&gt;


&lt;pre&gt;
$ irb1.8 
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; require 'hpricot'
=&gt; true
irb(main):006:0&gt; Hpricot('&lt;div id="foo"&gt;bar&lt;/div&gt;').at("#foo").inner_html
=&gt; "bar"
&lt;/pre&gt;


&lt;p&gt;Sweet! On a vanilla &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS&lt;/a&gt; system, I was able to set up a working Ruby install including Rubygems in no time and without the need to search for build dependencies. DebGem even auto-updated my Rubygems when I downloaded Hpricot, which normally is the probably most ugly thing about the Ubuntu Rubygems package:&lt;/p&gt;


&lt;pre&gt;
$ gem --version
1.3.1 
&lt;/pre&gt;


&lt;h2&gt;Testing DebGem, part 2: DataMapper&lt;/h2&gt;


&lt;p&gt;DataMapper is a native extension as well, featuring plenty of dependencies and database access. On my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;initial review&lt;/a&gt; of DebGem, apt-get wanted me to pull in plenty of old versions as dependencies even when trying to install a specific version of DataMapper. Since then, the latest version of DataMapper, 0.9.9, has found it&amp;#8217;s way into the repository. Also, Hongli Lai from the &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt; team &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;posted a comment&lt;/a&gt; to mentioned article, saying that the DebGem team had removed most of the unneccessary dependencies.&lt;/p&gt;


&lt;p&gt;When trying to install libdatamapper0.9.9-ruby1.8 today, DebGem still wanted me to pull in plenty of packages, but this time only the most recent versions, the reason for all the bulk print on my screen being the usage of metapackages. There still seems to be an issue with the projected package disc space usage though, which &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;Hongli Lai&lt;/a&gt; also pointed out, since the announced 22.2 mb did not end up on my hard disc. The full install of Datamapper 0.9.9 weighs 10 mb on my hard disc.&lt;/p&gt;


&lt;p&gt;Since I wanted to use MySQL, I also had to install the do-mysql gem:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install libdo-mysql0.9.10.1-ruby1.8
&lt;/pre&gt;


&lt;p&gt;As a next step, I set up a testing database through mysql console:&lt;/p&gt;


&lt;pre&gt;
$ mysql -u root -p 
mysql&gt; create database datamapper_test;
Query OK, 1 row affected (0.00 sec)
&lt;/pre&gt;


&lt;p&gt;I created a simple DataMapper example, which was the following:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;rubygems&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;dm-core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class="co"&gt;DataMapper&lt;/span&gt;.setup(&lt;span class="sy"&gt;:default&lt;/span&gt;, &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;mysql://root:pass@localhost/datamapper_test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;Message&lt;/span&gt;
  include &lt;span class="co"&gt;DataMapper&lt;/span&gt;::&lt;span class="co"&gt;Resource&lt;/span&gt;
  property &lt;span class="sy"&gt;:id&lt;/span&gt;,         &lt;span class="co"&gt;Serial&lt;/span&gt; 
  property &lt;span class="sy"&gt;:body&lt;/span&gt;,       &lt;span class="co"&gt;String&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;

&lt;span class="co"&gt;DataMapper&lt;/span&gt;.auto_migrate!

&lt;span class="co"&gt;Message&lt;/span&gt;.create(&lt;span class="sy"&gt;:body&lt;/span&gt; =&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;I'm a Message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;)

puts &lt;span class="co"&gt;Message&lt;/span&gt;.all.inspect&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Executing the whole thing went perfectly right, with Datamapper obviously connecting to the database, migrating the table, creating the message and retrieving all messages afterwards. The console output was, just as expected:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;[&lt;&lt;span class="co"&gt;Message&lt;/span&gt; id=&lt;span class="i"&gt;1&lt;/span&gt; body=&lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;I'm a Message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;&gt;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Again, that wasn&amp;#8217;t hard at all.&lt;/p&gt;


&lt;h2&gt;Testing DebGem, part 3: Rails&lt;/h2&gt;


&lt;p&gt;As a final test, I wanted to see if I could get a Rails app to run with gems installed from &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt;. Currently, when installing a specific version of Rails, say &lt;code&gt;rails2.2.2-ruby1.8&lt;/code&gt;, all the dependencies like ActiveRecord, ActionPack and so on will be pulled in all versions available via DebGem &amp;#8211; exactly the same way as it was in my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;earlier review&lt;/a&gt; for DataMapper. The result was a vm crammed with:&lt;/p&gt;


&lt;pre&gt;
actionmailer (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.3.6, 1.2.5, 1.1.5, 1.0.1)
actionpack (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.13.6, 1.12.5, 1.11.2, 1.10.2, 1.9.1, 1.8.1, 1.7.0, 1.6.0, 1.5.1, 1.4.0, 1.3.1, 1.2.0, 1.1.0, 1.0.1)
activerecord (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.15.6, 1.14.4, 1.13.2, 1.12.2, 1.11.1, 1.10.1, 1.9.1, 1.8.0, 1.7.0, 1.6.0, 1.5.1, 1.4.0, 1.3.0, 1.2.0, 1.1.0, 1.0.0)
activeresource (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1)
activesupport (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.4.4, 1.3.1, 1.2.5, 1.1.1, 1.0.4, 1.0.1)
&lt;/pre&gt;


&lt;p&gt;This is only the result of issuing &lt;code&gt;sudo apt-get install rails2.2.2-ruby1.8&lt;/code&gt;! Obviously the package dependencies need some fine-tuning, but I think that is absolutely ok for a service that just came out into beta.&lt;/p&gt;


&lt;p&gt;Since I needed an app to test Rails with, I wanted to create a new one with the &lt;i&gt;rails&lt;/i&gt; command. That did not work since the corresponding script could not be found on my operating system. Maybe this can be fixed with a modified path though. I didn&amp;#8217;t bother and pulled a sample app from my main machine. After generating the controller &amp;#8220;debgem&amp;#8221;, which worked flawlessly, I added an index action to the newly created controller:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;&lt;span class="c"&gt;# app/controllers/debgem_controller.rb &lt;/span&gt;
&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;DebgemController&lt;/span&gt; &lt; &lt;span class="co"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;index&lt;/span&gt;
    render &lt;span class="sy"&gt;:text&lt;/span&gt; =&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;Hello from Debgem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A &lt;code&gt;ruby script/server&lt;/code&gt; later, I was able to curl my action:&lt;/p&gt;


&lt;pre&gt;
$ curl localhost:3000/debgem
Hello from Debgem
&lt;/pre&gt;


&lt;p&gt;Great success!&lt;/p&gt;


&lt;h2&gt;Conclusion&lt;/h2&gt;


&lt;p&gt;To summarize all this, I still think that DebGem is a very promising service with some rough ends which will hopefully get sorted out while in beta. The folks at &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt; seem as they really want to make this work like a charm, taking care of the &lt;a href="http://groups.google.com/group/debgem-support-forum?pli=1"&gt;issues mentioned by users&lt;/a&gt;. I&amp;#8217;m sure they will take care of the remaining issues and make this even more kick-ass. If you are having issues with DebGem, be sure to check out &lt;a href="http://groups.google.com/group/debgem-support-forum?pli=1"&gt;the DebGem Google Group&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The service makes it really easy to setup a whole Ruby environment on a Ubuntu / Debian machine quickly and without much fuzz. No need to build anything (on Ubuntu 8.04, for now), no build-dependencies to pull in before issuing &lt;code&gt;gem install foo&lt;/code&gt;. That makes setting up a Rails environment a no-brainer.&lt;/p&gt;


&lt;p&gt;In the upcoming follow-up to this article, I&amp;#8217;ll focus on setting up a complete Rails stack with Apache2/Passenger from a single .deb Metapackage, so if you&amp;#8217;re interested in that check back soon or subscribe to my &lt;a href="http://feeds.feedburner.com/colszowka"&gt;&lt;span class="caps"&gt;RSS&lt;/span&gt; feed&lt;/a&gt;.&lt;/p&gt;

</summary>
    <content type="html">&lt;p&gt;Like already announced in my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;previous first look&lt;/a&gt; into the new &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; service by &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt;. I had a deeper look into the service today, giving it a spin under a freshly installed &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu Server JeOS&lt;/a&gt; virtual machine.&lt;/p&gt;


&lt;p&gt;JeOS is great since it has a kernel tweaked for virtual environments and the disc image has a footprint of only 100 megs, which ensures download and install times are low.&lt;/p&gt;


&lt;h2&gt;Setting up the vm for testing&lt;/h2&gt;


&lt;p&gt;Since &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt; currently only offers binary packages for Ubuntu 8.04 &lt;span class="caps"&gt;LTS&lt;/span&gt;, I picked up the JeOS cd image for that, which can be downloaded in the latest version 8.04.1 from &lt;a href="http://cdimage.ubuntu.com/jeos/releases/8.04.1/release/"&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;After setting up a new Ubuntu-based virtual machine &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; and getting through the installation steps for &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS&lt;/a&gt; (I won&amp;#8217;t get into detail about that&amp;#8230;), as a first step I updated the whole system with apt by issuing:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get update &amp;&amp; sudo apt-get upgrade
&lt;/pre&gt;


&lt;p&gt;This was followed by the install of the most basic tools:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install bash-completion nano wget curl man
&lt;/pre&gt;


&lt;p&gt;I also installed openssh-server so I could access the machine from my regular terminal, but that is optional. If you decided to follow along, please remember that you will have to set port forwarding for VirtualBox properly. On the machine you are running VirtualBox on, first find the name of your VM by typing:&lt;/p&gt;


&lt;pre&gt;
VBoxManage list vms
&lt;/pre&gt;


&lt;p&gt;Find your new virtual machine and remember it&amp;#8217;s name. Now you will have to set the port forwarding for ssh with the following commands, putting your vm&amp;#8217;s name in the obvious spot:&lt;/p&gt;


&lt;pre&gt;
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata "YOUR VMS NAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
&lt;/pre&gt;


&lt;p&gt;You can double-check if everything worked out by issuing,&lt;/p&gt;


&lt;pre&gt;
VBoxManage getextradata "YOUR VMS NAME" enumerate
&lt;/pre&gt;


&lt;p&gt;which should give you a list of your machines properties, including the newly set forwarding options. Now you will have to completely shut down and start up your vm so these options get applied. After that, you should be able to ssh to the machine with:&lt;/p&gt;


&lt;pre&gt;
ssh localhost -p 2222
&lt;/pre&gt;


&lt;h2&gt;Setting up Ruby and MySQL&lt;/h2&gt;


&lt;p&gt;Just install everything from the packages by issuing&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install ruby ri rdoc irb rubygems mysql-server-5.0 mysql-client-5.0
&lt;/pre&gt;


&lt;p&gt;MySQL will ask you for a new password for the root user, type it in and you&amp;#8217;re ready.&lt;/p&gt;


&lt;h2&gt;Adding the DebGem apt repository&lt;/h2&gt;


&lt;p&gt;To add the Rubyforge gems to apt, issue the following commands:&lt;/p&gt;


&lt;pre&gt;
sudo sh -c 'echo "deb http://www.debgem.com/apt ubuntu-8.04 rubyforge" &gt; /etc/apt/sources.list.d/debgem.list'
sudo sh -c 'wget -q http://www.debgem.com/apt/debgem.gpg -O- | apt-key add -'
sudo sh -c 'echo "APT::Cache-Limit 33554432;" &gt; /etc/apt/apt.conf'
sudo apt-get update
&lt;/pre&gt;


&lt;p&gt;This will add the debgem repository, add their key so apt-get won&amp;#8217;t complain and also raise the cache-limit, which is required due to the amount of packages served by DebGem. Finally, we update the whole cache so the Gems will appear in apt-get.&lt;/p&gt;


&lt;p&gt;Please remember the following though, taken from the &lt;a href="http://www.debgem.com/usage"&gt;DebGem usage page&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;Note: These URLs will likely change after DebGem has gone out of beta, so please check this web page again if apt-get update doesn&amp;#8217;t work anymore.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;Testing DebGem, part 1: Hpricot&lt;/h2&gt;


&lt;p&gt;I chose Hpricot because its basic functionality can be tested in a single line with irb, while it still is a native extension which normally would have required me to install at least the build-essential Ubuntu package, if not some required libraries as well which I would have to hunt down in the Ubuntu repositories. Installing Hpricot via DebGem on the other hand is pretty straight-forward:&lt;/p&gt;


&lt;pre&gt;
apt-get install libhpricot-ruby1.8 
&lt;/pre&gt;


&lt;p&gt;After that and opposing to my findings &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;in my previous post&lt;/a&gt;, when I was not able to install any gems from DebGem &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;due to my manual install of RubyGems&lt;/a&gt;, the Hpricot gem now appeared in my gem list:&lt;/p&gt;


&lt;pre&gt;
gem list --local
*** LOCAL GEMS ***
hpricot (0.6.164, 0.5, 0.4)  
&lt;/pre&gt;


&lt;p&gt;Now, let&amp;#8217;s see if it works!&lt;/p&gt;


&lt;pre&gt;
$ irb1.8 
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; require 'hpricot'
=&gt; true
irb(main):006:0&gt; Hpricot('&lt;div id="foo"&gt;bar&lt;/div&gt;').at("#foo").inner_html
=&gt; "bar"
&lt;/pre&gt;


&lt;p&gt;Sweet! On a vanilla &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos"&gt;Ubuntu JeOS&lt;/a&gt; system, I was able to set up a working Ruby install including Rubygems in no time and without the need to search for build dependencies. DebGem even auto-updated my Rubygems when I downloaded Hpricot, which normally is the probably most ugly thing about the Ubuntu Rubygems package:&lt;/p&gt;


&lt;pre&gt;
$ gem --version
1.3.1 
&lt;/pre&gt;


&lt;h2&gt;Testing DebGem, part 2: DataMapper&lt;/h2&gt;


&lt;p&gt;DataMapper is a native extension as well, featuring plenty of dependencies and database access. On my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;initial review&lt;/a&gt; of DebGem, apt-get wanted me to pull in plenty of old versions as dependencies even when trying to install a specific version of DataMapper. Since then, the latest version of DataMapper, 0.9.9, has found it&amp;#8217;s way into the repository. Also, Hongli Lai from the &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt; team &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;posted a comment&lt;/a&gt; to mentioned article, saying that the DebGem team had removed most of the unneccessary dependencies.&lt;/p&gt;


&lt;p&gt;When trying to install libdatamapper0.9.9-ruby1.8 today, DebGem still wanted me to pull in plenty of packages, but this time only the most recent versions, the reason for all the bulk print on my screen being the usage of metapackages. There still seems to be an issue with the projected package disc space usage though, which &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/#comment-3"&gt;Hongli Lai&lt;/a&gt; also pointed out, since the announced 22.2 mb did not end up on my hard disc. The full install of Datamapper 0.9.9 weighs 10 mb on my hard disc.&lt;/p&gt;


&lt;p&gt;Since I wanted to use MySQL, I also had to install the do-mysql gem:&lt;/p&gt;


&lt;pre&gt;
sudo apt-get install libdo-mysql0.9.10.1-ruby1.8
&lt;/pre&gt;


&lt;p&gt;As a next step, I set up a testing database through mysql console:&lt;/p&gt;


&lt;pre&gt;
$ mysql -u root -p 
mysql&gt; create database datamapper_test;
Query OK, 1 row affected (0.00 sec)
&lt;/pre&gt;


&lt;p&gt;I created a simple DataMapper example, which was the following:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;rubygems&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;dm-core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class="co"&gt;DataMapper&lt;/span&gt;.setup(&lt;span class="sy"&gt;:default&lt;/span&gt;, &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;mysql://root:pass@localhost/datamapper_test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;Message&lt;/span&gt;
  include &lt;span class="co"&gt;DataMapper&lt;/span&gt;::&lt;span class="co"&gt;Resource&lt;/span&gt;
  property &lt;span class="sy"&gt;:id&lt;/span&gt;,         &lt;span class="co"&gt;Serial&lt;/span&gt; 
  property &lt;span class="sy"&gt;:body&lt;/span&gt;,       &lt;span class="co"&gt;String&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;

&lt;span class="co"&gt;DataMapper&lt;/span&gt;.auto_migrate!

&lt;span class="co"&gt;Message&lt;/span&gt;.create(&lt;span class="sy"&gt;:body&lt;/span&gt; =&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;I'm a Message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;)

puts &lt;span class="co"&gt;Message&lt;/span&gt;.all.inspect&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Executing the whole thing went perfectly right, with Datamapper obviously connecting to the database, migrating the table, creating the message and retrieving all messages afterwards. The console output was, just as expected:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;[&lt;&lt;span class="co"&gt;Message&lt;/span&gt; id=&lt;span class="i"&gt;1&lt;/span&gt; body=&lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;I'm a Message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;&gt;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Again, that wasn&amp;#8217;t hard at all.&lt;/p&gt;


&lt;h2&gt;Testing DebGem, part 3: Rails&lt;/h2&gt;


&lt;p&gt;As a final test, I wanted to see if I could get a Rails app to run with gems installed from &lt;a href="http://www.debgem.com"&gt;DebGem&lt;/a&gt;. Currently, when installing a specific version of Rails, say &lt;code&gt;rails2.2.2-ruby1.8&lt;/code&gt;, all the dependencies like ActiveRecord, ActionPack and so on will be pulled in all versions available via DebGem &amp;#8211; exactly the same way as it was in my &lt;a href="http://blog.olszowka.de/2009/01/06/phusion-releases-debgemcom-into-beta/"&gt;earlier review&lt;/a&gt; for DataMapper. The result was a vm crammed with:&lt;/p&gt;


&lt;pre&gt;
actionmailer (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.3.6, 1.2.5, 1.1.5, 1.0.1)
actionpack (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.13.6, 1.12.5, 1.11.2, 1.10.2, 1.9.1, 1.8.1, 1.7.0, 1.6.0, 1.5.1, 1.4.0, 1.3.1, 1.2.0, 1.1.0, 1.0.1)
activerecord (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.15.6, 1.14.4, 1.13.2, 1.12.2, 1.11.1, 1.10.1, 1.9.1, 1.8.0, 1.7.0, 1.6.0, 1.5.1, 1.4.0, 1.3.0, 1.2.0, 1.1.0, 1.0.0)
activeresource (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1)
activesupport (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.4.4, 1.3.1, 1.2.5, 1.1.1, 1.0.4, 1.0.1)
&lt;/pre&gt;


&lt;p&gt;This is only the result of issuing &lt;code&gt;sudo apt-get install rails2.2.2-ruby1.8&lt;/code&gt;! Obviously the package dependencies need some fine-tuning, but I think that is absolutely ok for a service that just came out into beta.&lt;/p&gt;


&lt;p&gt;Since I needed an app to test Rails with, I wanted to create a new one with the &lt;i&gt;rails&lt;/i&gt; command. That did not work since the corresponding script could not be found on my operating system. Maybe this can be fixed with a modified path though. I didn&amp;#8217;t bother and pulled a sample app from my main machine. After generating the controller &amp;#8220;debgem&amp;#8221;, which worked flawlessly, I added an index action to the newly created controller:&lt;/p&gt;


&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code class="multiline_code"&gt;&lt;span class="c"&gt;# app/controllers/debgem_controller.rb &lt;/span&gt;
&lt;span class="r"&gt;class&lt;/span&gt; &lt;span class="cl"&gt;DebgemController&lt;/span&gt; &lt; &lt;span class="co"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;index&lt;/span&gt;
    render &lt;span class="sy"&gt;:text&lt;/span&gt; =&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="k"&gt;Hello from Debgem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;/span&gt;
  &lt;span class="r"&gt;end&lt;/span&gt;
&lt;span class="r"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A &lt;code&gt;ruby script/server&lt;/code&gt; later, I was able to curl my action:&lt;/p&gt;


&lt;pre&gt;
$ curl localhost:3000/debgem
Hello from Debgem
&lt;/pre&gt;


&lt;p&gt;Great success!&lt;/p&gt;


&lt;h2&gt;Conclusion&lt;/h2&gt;


&lt;p&gt;To summarize all this, I still think that DebGem is a very promising service with some rough ends which will hopefully get sorted out while in beta. The folks at &lt;a href="http://www.phusion.nl"&gt;Phusion&lt;/a&gt; seem as they really want to make this work like a charm, taking care of the &lt;a href="http://groups.google.com/group/debgem-support-forum?pli=1"&gt;issues mentioned by users&lt;/a&gt;. I&amp;#8217;m sure they will take care of the remaining issues and make this even more kick-ass. If you are having issues with DebGem, be sure to check out &lt;a href="http://groups.google.com/group/debgem-support-forum?pli=1"&gt;the DebGem Google Group&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The service makes it really easy to setup a whole Ruby environment on a Ubuntu / Debian machine quickly and without much fuzz. No need to build anything (on Ubuntu 8.04, for now), no build-dependencies to pull in before issuing &lt;code&gt;gem install foo&lt;/code&gt;. That makes setting up a Rails environment a no-brainer.&lt;/p&gt;


&lt;p&gt;In the upcoming follow-up to this article, I&amp;#8217;ll focus on setting up a complete Rails stack with Apache2/Passenger from a single .deb Metapackage, so if you&amp;#8217;re interested in that check back soon or subscribe to my &lt;a href="http://feeds.feedburner.com/colszowka"&gt;&lt;span class="caps"&gt;RSS&lt;/span&gt; feed&lt;/a&gt;.&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>So finally, after years of laziness, I managed to set up a blog!</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/06/so-finally-after-years-of-laziness-i-managed-to-set-up-a-blog"/>
    <id>http://colszowka.heroku.com/2009/01/06/so-finally-after-years-of-laziness-i-managed-to-set-up-a-blog</id>
    <published>2009-01-06</published>
    <updated>2009-01-06</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;The plan is to track stuff I stumbled upon on the net, especially interesting blog posts on everything Ruby, Rails and Linux (with a major focus on Ubuntu since this is the distro I am using). Additionally, I might also post some code-snippets I found useful, reviews of books I read and, last but not least, this shall be the final instance to force me into publishing the plethora of tools and apps I developed for my own needs into open source (on &lt;a href="http://github.com/colszowka" target="_blank"&gt;github&lt;/a&gt;, of course).&lt;/p&gt;

&lt;p&gt;Oh and btw, though this is a blog focusing on Ruby and Rails, I am using Wordpress since it gets the job done just perfectly, and while getting the job done more easily has been the reason for most Ruby enthusiasts to switch over from PHP/Java/whatever, in my opinion the choice of the right tools should also imply PHP-productions...&lt;/p&gt;

&lt;p&gt;Anyway, I am sending a warm welcome to all you folks out there, I hope that you will enjoy the stuff that will appear here soon!&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;The plan is to track stuff I stumbled upon on the net, especially interesting blog posts on everything Ruby, Rails and Linux (with a major focus on Ubuntu since this is the distro I am using). Additionally, I might also post some code-snippets I found useful, reviews of books I read and, last but not least, this shall be the final instance to force me into publishing the plethora of tools and apps I developed for my own needs into open source (on &lt;a href="http://github.com/colszowka" target="_blank"&gt;github&lt;/a&gt;, of course).&lt;/p&gt;

&lt;p&gt;Oh and btw, though this is a blog focusing on Ruby and Rails, I am using Wordpress since it gets the job done just perfectly, and while getting the job done more easily has been the reason for most Ruby enthusiasts to switch over from PHP/Java/whatever, in my opinion the choice of the right tools should also imply PHP-productions...&lt;/p&gt;

&lt;p&gt;Anyway, I am sending a warm welcome to all you folks out there, I hope that you will enjoy the stuff that will appear here soon!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Phusion releases DebGem.com into beta</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/06/phusion-releases-debgemcom-into-beta"/>
    <id>http://colszowka.heroku.com/2009/01/06/phusion-releases-debgemcom-into-beta</id>
    <published>2009-01-06</published>
    <updated>2009-01-06</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Right after starting this blog, I already have the first topic to post about that implies both things I'm focusing on - Ruby and Ubuntu: As Peter Cooper &lt;a href="http://www.rubyinside.com/debgem-ruby-libraries-packaged-for-debian-and-ubuntu-1436.html" target="_blank"&gt;announced&lt;/a&gt; on Ruby Inside, Phusion (of Passenger fame) have released a new service called &lt;a href="http://www.debgem.com" target="_blank"&gt;DebGem&lt;/a&gt;. What this thing basically does is let you install all RubyForge and Github gems on Debian / Ubuntu machines via apt-get, which many people (me included) prefer over the duplicate handling which the original gem command requires, while still having access to latest as well as older versions (as opposed to the official repositories, which only hold outdated libs), plus it will install required lib dependencies for native builds, say imagemagick for rmagick. They also have a &lt;a href="http://www.debgem.com/packages/search?gem_name=datamapper" target="_blank"&gt;search&lt;/a&gt; set up so you can easily find the exact package name you have to type in when installing.&lt;/p&gt;

&lt;p&gt;As &lt;a href="http://www.rubyinside.com/debgem-ruby-libraries-packaged-for-debian-and-ubuntu-1436.html" target="_blank"&gt;Peter states though&lt;/a&gt;, there are two "catches":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Native gems requiring a build are currently only available for Ubuntu 8.04 LTS (you might also want to check out the info on supported distros over at their &lt;a href="http://www.debgem.com/" target="_blank"&gt;starting page&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;The service is &lt;a href="http://www.debgem.com/pricing_signup" target="_blank"&gt;only free during beta&lt;/a&gt;. Phusions clear explanation to that can be found &lt;a href="http://www.debgem.com/usage" target="_blank"&gt;in the FAQ&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Thankfully, I'm still on Ubuntu 8.04 on my laptop, so I was able to try it out. After getting &lt;a href="http://www.debgem.com/usage" target="_blank"&gt;through the config steps&lt;/a&gt; (basically just another repository in /etc/apt/sources.list with the catch that you have to raise apt's cache limit due to the huge amount of packages in the repo - Rubyforge without github already gives about 25000 packages) and doing an apt-get update, I was able to get nice datamapper &lt;tab&gt; auto-complete results:&lt;/p&gt;

&lt;pre lang="bash"&gt;
colszowka@colszowka-laptop:

</summary>
    <content type="html">&lt;p&gt;Right after starting this blog, I already have the first topic to post about that implies both things I'm focusing on - Ruby and Ubuntu: As Peter Cooper &lt;a href="http://www.rubyinside.com/debgem-ruby-libraries-packaged-for-debian-and-ubuntu-1436.html" target="_blank"&gt;announced&lt;/a&gt; on Ruby Inside, Phusion (of Passenger fame) have released a new service called &lt;a href="http://www.debgem.com" target="_blank"&gt;DebGem&lt;/a&gt;. What this thing basically does is let you install all RubyForge and Github gems on Debian / Ubuntu machines via apt-get, which many people (me included) prefer over the duplicate handling which the original gem command requires, while still having access to latest as well as older versions (as opposed to the official repositories, which only hold outdated libs), plus it will install required lib dependencies for native builds, say imagemagick for rmagick. They also have a &lt;a href="http://www.debgem.com/packages/search?gem_name=datamapper" target="_blank"&gt;search&lt;/a&gt; set up so you can easily find the exact package name you have to type in when installing.&lt;/p&gt;

&lt;p&gt;As &lt;a href="http://www.rubyinside.com/debgem-ruby-libraries-packaged-for-debian-and-ubuntu-1436.html" target="_blank"&gt;Peter states though&lt;/a&gt;, there are two "catches":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Native gems requiring a build are currently only available for Ubuntu 8.04 LTS (you might also want to check out the info on supported distros over at their &lt;a href="http://www.debgem.com/" target="_blank"&gt;starting page&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;The service is &lt;a href="http://www.debgem.com/pricing_signup" target="_blank"&gt;only free during beta&lt;/a&gt;. Phusions clear explanation to that can be found &lt;a href="http://www.debgem.com/usage" target="_blank"&gt;in the FAQ&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Thankfully, I'm still on Ubuntu 8.04 on my laptop, so I was able to try it out. After getting &lt;a href="http://www.debgem.com/usage" target="_blank"&gt;through the config steps&lt;/a&gt; (basically just another repository in /etc/apt/sources.list with the catch that you have to raise apt's cache limit due to the huge amount of packages in the repo - Rubyforge without github already gives about 25000 packages) and doing an apt-get update, I was able to get nice datamapper &lt;tab&gt; auto-complete results:&lt;/p&gt;

&lt;pre lang="bash"&gt;
colszowka@colszowka-laptop:$ sudo apt-get install libdatamapper
libdatamapper0.1.1-ruby1.8  libdatamapper0.3.2-ruby1.8  libdatamapper-all-ruby1.8   libdatamapper-ruby1.8       
libdatamapper0.2.5-ruby1.8  libdatamapper0.9.8-ruby1.8  libdatamapper-ruby   
&lt;/pre&gt;


&lt;p&gt;The naming and version availablity scheme is explained in the &lt;a href="http://www.debgem.com/usage" target="_blank"&gt;FAQ&lt;/a&gt; as well. I won't copy and paste all of it, but basically when you install libdatamapper-ruby1.8, it will install all versions listed above.&lt;/p&gt;

&lt;blockquote&gt;
 This is because RubyGems supports parallel version installs. For example, RubyGems allows having both Rails 2.1.2 and 2.2.2 installed at the same time. Applications and libraries can depend on a specific version of a gem.

Dpkg does not have a direct equivalent of this feature. So as a compromise, and in order to ensure that everything works out-of-the-box, we install latest versions of the minor version.
&lt;/blockquote&gt;


&lt;p&gt;Unfortunately, even when I specified a certain version, say libdatamapper0.9.8-ruby1.8, to be installed, the gem dependencies would not get resolved properly, with DebGem requiring me to install a plethora of versions of the gems datamapper depends upon:&lt;/p&gt;

&lt;pre&gt;
  dm-cli-all-ruby1.8 dm-cli-ruby1.8 dm-cli0.9.8-ruby1.8 hoe-all-ruby1.8 hoe-ruby1.8 hoe1.0.5-ruby1.8 hoe1.1.7-ruby1.8 hoe1.2.2-ruby1.8 hoe1.3.0-ruby1.8 hoe1.4.0-ruby1.8
  hoe1.5.3-ruby1.8 hoe1.6.0-ruby1.8 hoe1.7.0-ruby1.8 hoe1.8.2-ruby1.8 launchy-all-ruby1.8 launchy-ruby1.8 launchy0.1.2-ruby1.8 launchy0.2.1-ruby1.8 launchy0.3.2-ruby1.8
  libaddressable-all-ruby1.8 libaddressable-ruby1.8 libaddressable0.1.2-ruby1.8 libaddressable1.0.4-ruby1.8 libaddressable2.0.1-ruby1.8 libdata-objects-all-ruby1.8
  libdata-objects-ruby1.8 libdata-objects0.2.0-ruby1.8 libdata-objects0.9.9-ruby1.8 libdatamapper0.9.8-ruby1.8 libdm-aggregates-all-ruby1.8 libdm-aggregates-ruby1.8
  libdm-aggregates0.9.8-ruby1.8 libdm-core-all-ruby1.8 libdm-core-ruby1.8 libdm-core0.9.8-ruby1.8 libdm-is-tree-all-ruby1.8 libdm-is-tree-ruby1.8 libdm-is-tree0.9.8-ruby1.8
  libdm-migrations-all-ruby1.8 libdm-migrations-ruby1.8 libdm-migrations0.9.8-ruby1.8 libdm-observer-all-ruby1.8 libdm-observer-ruby1.8 libdm-observer0.9.8-ruby1.8
  libdm-serializer-all-ruby1.8 libdm-serializer-ruby1.8 libdm-serializer0.9.8-ruby1.8 libdm-timestamps-all-ruby1.8 libdm-timestamps-ruby1.8 libdm-timestamps0.9.8-ruby1.8
  libdm-types-all-ruby1.8 libdm-types-ruby1.8 libdm-types0.9.8-ruby1.8 libdm-validations-all-ruby1.8 libdm-validations-ruby1.8 libdm-validations0.9.8-ruby1.8
  libextlib-all-ruby1.8 libextlib-ruby1.8 libextlib0.9.9-ruby1.8 rake-all-ruby1.8 rake-ruby1.8 rake0.8.3-ruby1.8 rspec-all-ruby1.8 rspec-ruby1.8 rspec0.9.4-ruby1.8
  rspec1.0.8-ruby1.8 rspec1.1.11-ruby1.8 rubyforge-all-ruby1.8 rubyforge-ruby1.8 rubyforge0.4.5-ruby1.8 rubyforge1.0.1-ruby1.8
&lt;/pre&gt;


&lt;p&gt;The estimated additional disk usage for libdatamapper0.9.8-ruby1.8 from DebGem was noted as 28.1 MB. Quite a bit, but I can only recommend not to try this out with apt-get install rails (which oddly enough does not fall into the libXYZ-ruby1.8 scheme) - 484 MB!&lt;/p&gt;

&lt;p&gt;Though installation went well, unfortunately I was unable to access the newly installed gem, even though it &lt;a href="http://www.debgem.com/" target="_blank"&gt;should have registered&lt;/a&gt; with my current rubygems installation:&lt;/p&gt;

&lt;blockquote&gt;
All DebGem packages register themselves as Ruby gems, thereby providing full compatibility with Ruby software that expect gems. 
&lt;/blockquote&gt;




&lt;pre code="bash"&gt;
colszowka@colszowka-laptop:~$ gem list --local | grep 'datamapper'
colszowka@colszowka-laptop:~$ irb
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; require 'dm-core'
LoadError: no such file to load -- dm-core
&lt;/pre&gt;


&lt;p&gt;Obviously the reason for this is that I do have a manual Rubygems install, rather than the one from the (way outdated) Ubuntu repositories. Since I did not want to mess up my whole gems install, I decided to not go further and rather check this out in a virtual machine on a fresh install as soon as possible, so until then I can only tell that the installed libraries ended up in /var/lib/gems/1.8/gems/ on my machine, which is the default gem install path for the Ubuntu Rubygems package. Obviously the DebGem repositories supply updates for Rubygems, so it might become unneccessary to have manual installs of Rubygems in order to get latest versions. I will try this the next days and keep you updated.&lt;/p&gt;

&lt;p&gt;Until then, I can only say that this project is very promising, but obviously still far from maturity. On the other hand, just think of setting up the whole Rails stack on a vanilla Ubuntu/Debian machine through a custom .deb package containing your projects dependencies (ruby1.8, rubygems1.8, rails, passenger, apache2 and so on). The &lt;a href="http://blog.brightbox.co.uk/posts/brightbox-builds-hardy-passenger-package" target="_blank"&gt;Brightbox passenger debs&lt;/a&gt; and &lt;a href="http://www.debgem.com" target="_blank"&gt;DebGem&lt;/a&gt; might get us there in no time!&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update, January 7th:&lt;/b&gt; The Phusion guys have updated the datamapper (which after a version update also is libdatamapper0.9.9-ruby1.8) debgem, so now it won't install all these gems I listed above anymore. I am currently testing the whole thing in a vanilla Ubuntu VM, so stay tuned for a future post on that!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>{:merb =&amp;gt; &amp;quot;1.0&amp;quot;}.merge(:rails =&amp;gt; &amp;quot;2.3&amp;quot;) =&amp;gt; {:rails =&amp;gt; &amp;quot;3.0&amp;quot;}</title>
    <link rel="alternate" href="http://colszowka.heroku.com/2009/01/06/merb-10mergerails-23-rails-30"/>
    <id>http://colszowka.heroku.com/2009/01/06/merb-10mergerails-23-rails-30</id>
    <published>2009-01-06</published>
    <updated>2009-01-06</updated>
    <author>
      <name>Christoph Olszowka</name>
    </author>
    <summary type="html">&lt;p&gt;Two weeks after the &lt;a href="http://weblog.rubyonrails.com/2008/12/23/merb-gets-merged-into-rails-3" target="_blank"&gt;official announcement&lt;/a&gt; has been made by David, I finally managed to catch up on my Google Reader, and get to know these exciting news probably as the completely last person on earth: Merb is going to be merged into Rails to become the single greatest piece of software ever created!&lt;/p&gt;

&lt;p&gt;If anyone apart of me also missed out on this (I really hope I am actually not the only one who enjoyed holidays away from the screen), be sure to also check out the announcements and opinions posted by new Rails core member &lt;a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/" target="_blank"&gt;Yehuda Katz&lt;/a&gt; (who gets into detail on how the merger can be accomplished), Merb founder &lt;a href="http://brainspl.at/articles/2008/12/23/merb-is-rails" target="_blank"&gt;Ezra Zygmuntowicz&lt;/a&gt; as well as Merb developer and Engine Yard employee &lt;a href="http://splendificent.com/2008/12/the-merb-rails-merger-announcement-an-inside-opinion/" target="_blank"&gt;Carl Lerche&lt;/a&gt;, which I actually found the most interesting read because it shows the uniqueness of the whole event of two distinct projects, each fighting for their own goals and having fundamental disagreements on the requirements of a kick-ass framework, putting their differences aside and rather joining forces to build something amazing that benefits from the advantages of both.&lt;/p&gt;

&lt;p&gt;I've been following the development and achievements of Merb for quite a while, even though I never managed to really get into it and create a project based upon it. Actually what distracted me the most was that I had to relearn &lt;em&gt;some&lt;/em&gt; things, which were done differently in Rails, while plenty of stuff could be accomplished the same way. I always liked Merb's aim to achieve a better structure though, for instance the highest-possible level of decoupling of the individual parts of the framework (I am thinking of the possibility to use something different than ActiveRecord in particular) as well as their work on speedup and early embrace of Rack.&lt;/p&gt;

&lt;p&gt;The announced enhancements of Rails performance based upon Merb code have already started to take place, as Mike Gunderloy wrote in his most recent "&lt;a href="http://weblog.rubyonrails.com/2009/1/2/this-week-in-edge-rails" target="_blank"&gt;This Week in Edge Rails&lt;/a&gt;":&lt;/p&gt;

&lt;blockquote&gt;In some of the first fruits of the Rails-Merb team merger, Yehuda Katz took a look at the respond_to method, which is of course heavily used in many Rails applications to allow your controller to format results differently based on the MIME type of the incoming request. After eliminating a call to method_missing and some profiling and tweaking, he reports an 8% improvement in the number of requests per second served with a simple respond_to that switches between three formats. The best part? No change at all required to the code of your application to take advantage of this speedup&lt;/blockquote&gt;


&lt;p&gt;This whole thing is gonna be huge for Rails as well as the whole Ruby community! With the cute parts of Merb integrated into Rails and other great stuff like &lt;a href="http://weblog.rubyonrails.com/2008/12/17/introducing-rails-metal" target="_blank"&gt;Rails Metal&lt;/a&gt; coming up, I am already looking forward to David's keynote at this years RailsConf, in which hopefully he will introduce the greatness of Rails 3 to us, though I don't believe they will have a beta wrapped-up by then (which he is hoping for in the mentioned post).&lt;/p&gt;

&lt;p&gt;In more recent news, the "new evangelism team" mentioned by David in the post linked above has been introduced on the official Rails blog &lt;a href="http://weblog.rubyonrails.com/2009/1/5/announcing-the-rails-activists" target="_blank"&gt;today&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;Bringing Rails and Merb together is about more than just merging the respective code. We’re also picking up the best ideas from both communities beyond the code. Following on Merb’s success in offering a strong evangelism effort, we’re pleased to announce the creation of the Rails activists:
&lt;blockquote&gt;The mission of the Rails activists is to empower and support the worldwide network of Ruby on Rails users. We do this by publicizing Rails, making adoption easier, and enhancing developer support.&lt;/blockquote&gt;
&lt;/blockquote&gt;


&lt;p&gt;I can only repeat myself: Great stuff coming up!&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Two weeks after the &lt;a href="http://weblog.rubyonrails.com/2008/12/23/merb-gets-merged-into-rails-3" target="_blank"&gt;official announcement&lt;/a&gt; has been made by David, I finally managed to catch up on my Google Reader, and get to know these exciting news probably as the completely last person on earth: Merb is going to be merged into Rails to become the single greatest piece of software ever created!&lt;/p&gt;

&lt;p&gt;If anyone apart of me also missed out on this (I really hope I am actually not the only one who enjoyed holidays away from the screen), be sure to also check out the announcements and opinions posted by new Rails core member &lt;a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/" target="_blank"&gt;Yehuda Katz&lt;/a&gt; (who gets into detail on how the merger can be accomplished), Merb founder &lt;a href="http://brainspl.at/articles/2008/12/23/merb-is-rails" target="_blank"&gt;Ezra Zygmuntowicz&lt;/a&gt; as well as Merb developer and Engine Yard employee &lt;a href="http://splendificent.com/2008/12/the-merb-rails-merger-announcement-an-inside-opinion/" target="_blank"&gt;Carl Lerche&lt;/a&gt;, which I actually found the most interesting read because it shows the uniqueness of the whole event of two distinct projects, each fighting for their own goals and having fundamental disagreements on the requirements of a kick-ass framework, putting their differences aside and rather joining forces to build something amazing that benefits from the advantages of both.&lt;/p&gt;

&lt;p&gt;I've been following the development and achievements of Merb for quite a while, even though I never managed to really get into it and create a project based upon it. Actually what distracted me the most was that I had to relearn &lt;em&gt;some&lt;/em&gt; things, which were done differently in Rails, while plenty of stuff could be accomplished the same way. I always liked Merb's aim to achieve a better structure though, for instance the highest-possible level of decoupling of the individual parts of the framework (I am thinking of the possibility to use something different than ActiveRecord in particular) as well as their work on speedup and early embrace of Rack.&lt;/p&gt;

&lt;p&gt;The announced enhancements of Rails performance based upon Merb code have already started to take place, as Mike Gunderloy wrote in his most recent "&lt;a href="http://weblog.rubyonrails.com/2009/1/2/this-week-in-edge-rails" target="_blank"&gt;This Week in Edge Rails&lt;/a&gt;":&lt;/p&gt;

&lt;blockquote&gt;In some of the first fruits of the Rails-Merb team merger, Yehuda Katz took a look at the respond_to method, which is of course heavily used in many Rails applications to allow your controller to format results differently based on the MIME type of the incoming request. After eliminating a call to method_missing and some profiling and tweaking, he reports an 8% improvement in the number of requests per second served with a simple respond_to that switches between three formats. The best part? No change at all required to the code of your application to take advantage of this speedup&lt;/blockquote&gt;


&lt;p&gt;This whole thing is gonna be huge for Rails as well as the whole Ruby community! With the cute parts of Merb integrated into Rails and other great stuff like &lt;a href="http://weblog.rubyonrails.com/2008/12/17/introducing-rails-metal" target="_blank"&gt;Rails Metal&lt;/a&gt; coming up, I am already looking forward to David's keynote at this years RailsConf, in which hopefully he will introduce the greatness of Rails 3 to us, though I don't believe they will have a beta wrapped-up by then (which he is hoping for in the mentioned post).&lt;/p&gt;

&lt;p&gt;In more recent news, the "new evangelism team" mentioned by David in the post linked above has been introduced on the official Rails blog &lt;a href="http://weblog.rubyonrails.com/2009/1/5/announcing-the-rails-activists" target="_blank"&gt;today&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;Bringing Rails and Merb together is about more than just merging the respective code. We’re also picking up the best ideas from both communities beyond the code. Following on Merb’s success in offering a strong evangelism effort, we’re pleased to announce the creation of the Rails activists:
&lt;blockquote&gt;The mission of the Rails activists is to empower and support the worldwide network of Ruby on Rails users. We do this by publicizing Rails, making adoption easier, and enhancing developer support.&lt;/blockquote&gt;
&lt;/blockquote&gt;


&lt;p&gt;I can only repeat myself: Great stuff coming up!&lt;/p&gt;
</content>
  </entry>
</feed>
