Thursday, August 16, 2007

My lightweight Rails environment on Windows

I've seen dozens of articles regarding setting up a Ruby on Rails development environment for Windows, probably so have you. But none of those were lightweight, were they? There hides the difference.
I still remember those web 1.0 folks who swore that Notepad is the killer app for web development. Well, back then, being a beginner who didn't know why is needed, I mainly understood them. You know how to code a 200 line "personal website" (ohmy, where are personal websites these days?), you're good. You did it in Notepad? Oh my god, you're the master of web development. These days, though, things have changed. The web, as it is, is a lot more accessible, almost anyone can start developing intelligent applications, you just need a good idea and, well, Ruby on Rails. Resources are unlimited, so if you have the idea you'll probably have some success too. But you need a workshop to forge that idea.

The Editor

I could have written "Integrated Development Environment" as a title for this section, but I think that those built for Rails aren't really the way they should be. They offer too much features, so you don't know where you really are. They offer exactly the bloat which Rails doesn't have. I don't know what your opinions are, but I rather type in a line into a console to generate a controller instead of proceeding through dozens of menus, input boxes, drop down lists, radio buttons, and so on. Rails is simple, let's keep it simple (, stupid). So, the Aptana-RadRails pair is shot down. No more fairy tales, I'll tell you what I have: Notepad++ with the Explorer plugin.
Notepad++ offers very good syntax highlighting, (and can easily be set up to support .rhtml, .rjs and .rxml files too), and the explorer plugin makes it fairly easy to navigate between the files of your app.

The Browser

You type it, then you check it out. Does it work? Maybe it does, maybe not. This simple question can be answered with a simple browser. No plugins, no extensions. Just your eyes and your browser. However, if you feel responsible for the experience your users go through, you should dive in deeper: Does it work the way I wanted it to work? Well, this isn't a too complex question either, but in order to ensure that your application delivers the same result anything the user might use, you have to give the details increased attention. You should use valid markup, valid styling, JavaScript which doesn't scream (unless you've written a scream_as_loud_as_possible.js script). Also, let's admit that we're human beings too. We need some luxury. Here, I mean that I don't want to create a screenshot of a website to determine what color is used in a particular area. Also I don't want to create five screenshots and then cut them together if I want a picture which shows the whole site. To keep lightweight, I use only what I strictly need. Four simple extensions:

Firebug
I dig this little bug. It tells you if you have errors, you can easily analyze the structure of your site with it, dive into AJAX requests, see DOM properties. It has a gold from me.

Web Developer
After those nightmares with Internet Explorer toolbars at a first glance I didn't want to install this. I though it steals me valorous browsing space. And hell, I was right! But I couldn't even dream about how much it offers in change. I'm using it for almost a month now, and It's like an orgasm (for a month, yea :D). I don't think that a month is enough to explore all its features. It offers easy cookie management, disabling of JavaScript (which is sometimes needed when you're going to create accessible sites) is just one click away, you can visually analyze your site's structure. It's the way to go.
ColorZilla
Just as I said two paragraphs before. It makes everything simpler. You get the color you want in two clicks instead of the long process which consists of creating a screenshot, opening it with an image editor, and finally getting the color.
Screengrab
Oh, I admit. This one doesn't have anything to do with Rails, and this is the one I use the least. But those few times when I need it, it's ace. Really. It kicks ass. It rocks. It grabs you the whole site you want in a single click, from top to bottom, not just the area you see (actually, it can also get that one, too - wonderful, isn't it?)

The Terminal

Still stuck with the Windows' command line? Go, get
Console! If you've done at least the demo app from the beginning of Agile Web Development with Rails (great book, great book), you know the console is one of the few things you'll need during Rails development. Usually, you need one for the server. Another one for the generators. During development, you generate new stuff quite often. It's best practice to keep a window (or a tab, if you get Console) open for that. That's two. But you might need one for script\console and one for the database shell. So, the number can go up to four. And that's just Rails. What if you need another tab for something else? Oh, 'nuff said! Just get Console. Trust me.

The Fairy Tailer
Also missing good old tail -f from UNIX? In the beginning you will surely do lots of errors, and the syntax might look Greek.. Also, the community won't help you if you don't have appropriate traces - tail for win32 is what you need. Open development.log with it, and you'll always see the end of the file. No need to open the file any time you make a new request. It does the thing automatically.

That's it for now. Hope you'll make some use of what I've scrapped down here. Feel free to comment if you disagree, or you'd propose something else.

P.S.: I tried to insert screenshots of the mentioned software, but it just screwed up the text. After trying twice, I gave up. So the screenshots are posted to my Flickr profile. Check them out here: http://www.flickr.com/photos/75522731@N00/sets/72157601475742386/

Ahoy!

Time for another "hello-i-am-back-again" post. :-) I've had my exams (success), I've gone to a physics-biology-chemistry competition (another reason I couldn't post for a while), but I'm back again, with another plan in my mind regarding "more mature" posts. We'll see. If anybody is still reading this little crap, well, thank you. If I were you, I'd have possibly deleted it from my feed reader, bookmarks, etc. If this blog was something larger than what it actually was, probably Arrington would have put it into his now infamous dead pool. Even though, I think I can be proud of what I achieved. And now, putting that pride in the mentioned dead pool, I'm going to start it again.. Aha, I'm doing exactly what I shouldn't. I'm going to reinvent the wheel. I know in most cases proceeding so is considered incorrect, but in mine it isn't. My wheel wasn't rotund. It was an irregular, random shape, using which you just can't travel. My new challenge is not to strengthen that irregular wheel, but leave it maybe weak, but at least make it round.