May 30, 2007

Posted by John

Tagged workflow

Older: assert_difference has morphed

Newer: Edge Rails Bites Back

Even Edgier Than Edge Rails

So ya, ya, ya, we aren’t suppose to code on edge rails. Sorry David, it’s too fun. So you just did a rake rails:freeze:edge and now you are truly on edge rails, right? Wrong. Here’s why. Follow along in a terminal near you if you aren’t sure.

rails myapp
cd myapp
rake rails:freeze:<b style="color:black;background-color:#99ff99">edge</b> 
# and if you are so lucky as to have textmate
mate myapp

How do I know you aren’t really running fully on edge? Well, check out the files in your config directory. Do you have an initializers folder? Cause real edge rails does. Does your environment file have the config.action_controller.session option already there and waiting for you to use? That’s what I thought. So how do you really get up and running on edge rails?

Edgier Than Edge Rails

You need to use the rails generator that is in edge rails to generate your new edge rails project. Whoa, use edge rails to generate edge rails. That’s border line recursion. Anyway, if you followed the above commands, here are a few more for you. Head back to the terminal.

cd ..
ruby myapp/vendor/rails/railties/bin/rails myapp_edgier
# and if you are so lucky as to have textmate
mate myapp_edgier

Now go to that config folder. Aww, snap. You can now see your environment file and the rest of your app is truly edgy. Isn’t that initializer directory pretty? You may even notice that the pesky components folder no longer gets generated. Sweetness. Those guys in core know what they are doing.

That was too many steps you say. I agree. I mean it sucks to repeat yourself and you just generated your new web 2.0 app twice. That is seconds longer that it will take you to sell your app to google. So what’s a middle aged white guy to do? Obviously, you need to pimp your local setup.

Pimped Edgier Than Edge Rails

Once your local setup is pimped, you can generate a new edgier than edge rails app super easy like so:

ruby ~/rails/trunk/railties/bin/rails my_second_edgier_app
cd my_second_edgier_app/
ln -s ~/rails/trunk/ vendor/rails
# and if you are so lucky as to have textmate
mate .

If you are confused by the ln -s then go read the pimped local setup article I just linked to above. Just like that you have a golden edge setup and you have edge rails linked up in your vendor directory.

A Bit of Bash

I took this one step further and whipped up a little bash function to do all of the previous work for me. If you are on a mac, you have textmate and you have pimped your setup as I aforementioned, you can do the following:

mate ~/.bash_profile

Add the following function in your bash profile:

function edgie() { 
  ruby ~/rails/trunk/railties/bin/rails $1 &#38;&#38; cd $1 &#38;&#38; ln -s ~/rails/trunk vendor/rails &#38;&#38; mate . 
}

Typically, I close the terminal and open a new one real quick (cmd+w and then cmd+n). There are other ways to source your bash profile so that the function exists but they involve typing which isn’t as fast as two rapid keystrokes. Once you have your terminal up again, you can do the following to take advantage of the function and get the pimped edgier than edge rails setup in one command.

edgie pimped_edgie_app

The edgie function generates the shell of your app using the edge rails generator, symlinks your local rails trunk in the new app’s vendor folder and opens up textmate for you. Oh, and it brushes your teeth in the morning. Enjoy.

0 Comments

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a programmer who has fallen deeply in love with Ruby. Learn More.

Projects

Flipper
Release your software more often with fewer problems.
Flip your features.