Garbage Burrito

A Mac-esque Rails Development Environment on Windows

A Mac-esque Rails Development Environment on Windows
Ben Kittrell - 03 26, 2007 @ 04:29PM
Comments: 69

Here's the deal, as I've said before, I like Windows and I love Vista.  Mac's certainly are beautiful; but as of yet "It just works" is not convincing enough for me.  However, any Railer will tell you that the holy grail of Rails editors is TextMate, which of course is Mac only.  I've come to believe that TextMate is not just the favorite Rails editor because a titanium Mac Book looks good with DHH's blazer, but there is also a common philosophy between them.  A simple elegant language should have a simple and elegant editor.  So therein lies my delima. 

Throughout the creation of my website builder, doodlekit, many different editors/environments have come and gone.  I've been eyeing e (three times fast), and it's really shaping up to be a very nice TextMate clone for Windows.  Even before that I fell in love with Console, which makes the Windows command line pleasurable.  And cygwin is of course more than capable of running a Rails environment.   All the pieces have fallen into place, and I have a recipe for a very nice Rails development environment on Windows.

Notes:  I did this on Windows Vista Ultimate 64-bit, but I think it should be the same for all Windows versions.  This guide assumes you have a novice understanding of Linux/cygwin.  And finally, I’ll leave choosing and installing a database to you.

Step 1 - Install e

http://www.e-texteditor.com/download/e_beta_setup.exe

Be sure to pay for it once you've decided to keep using it.

Step 2 - Install cygwin

E relies on cygwin for some of the bundles, which is ok since our Rails environment will also be running in cygwin.  Start e after it's installed.  If a dialog titled "Update Cygwin" doesn't popup right away, click on some of the bundles till it does.

Select the "Manual" radio button and click "Next".

The default options should be good until you get to "Select Packages". Make sure Ruby, Subversion, and any other Packages you might need are selected to install.

Finish the cygwin installation

Step 3 - Install Console

Console is probably my favorite thing ever.  It's a command prompt replacement for Windows with tabs, transparency and other funky jazz.

http://sourceforge.net/projects/console/

Make sure you grab the very latest build.

You'll want to setup cygwin as a Console Tab.  Just go into the settings and click "Add" under "Tabs".  Use the following as the "Shell".

    c:\cygwin\bin\bash --login -i
   
If you want it to automatically open cygwin when you start Console, just move it to the top of the Tabs list.

Step 4 - Install Ruby Gems

http://rubyforge.org/frs/?group_id=126&release_id=9501

Download, un-tar, and run the setup ruby script.  You'll probably get an error that says "No such file to load -- ubygems (LoadError)".  Just run the following command to get around it.

    unset RUBYOPT

Step 5 - Install Gems

Now just install rails and all the other gems you need, as you normally would.  Keep in mind that you are in cygwin, so do NOT choose the win32 versions of the gems

    gem install rails --include-dependencies
   
Step 6 - Setup e Alias

This last step is optional.  If you're familiar with TextMate, you can open it from the command line use the 'mate' command, but more importantly you can open the current directory as a project by using 'mate .'.  e does the same thing, however when you do this in cygwin, it retains control of the shell instead of running it in the background.  I came up with a way to handle this, but Charles Roper in the e forums had a better way.

First make sure e is in your $PATH, either through the Windows or cygwin environment variables.  You can test this by just typing 'e' from cygwin and hiting enter.  To make e run in the background add this to your .bashrc file. 

    alias e='cygstart e'

Step 7 – Test it Out

Open Console, and make sure you’re on a cygwin tab.  Create a rails project as normal.

    rails burrito

Go into the new directory and open e.

    cd burrito
    e .


This will open e with your new project loaded into the project explorer. 

That’s it!  Have fun.

Tags: Rails, editors, vista, e, cygwin
Comments: 69

Comments

51. Walker - 06 04, 2007 @ 06:05PM

Learned of console2 and e from this blog. Thanks. Love the history feature in e. I put my vote in for these for best tools to develop for ruby on rails in windows.

I am having the same problem with console2 (build 131) as Marcus Bristav (comment 18). When I type a line in console2 (same thing happens when I just use cmd.exe) that is long (15+ characters), and then I try to backspace or navigate to the middle of the line, the cursor will appear jump up to the previous line and I can no longer tell where it's actually at in the line. It's as if cmd.exe cannot handle editing lines that are more than 15-20 characters long. Does anyone know of a fix? Thanks!

52. Ken Liu (link) - 07 25, 2007 @ 09:23PM

@Walker
I've encountered the bug you described - it's a problem with cmd.exe. It makes working with irb a pain on Windows. Console is just a wrapper for command-line programs, so if the cmd.exe has the bug, Console will show the same thing. I don't know of a fix or a workaround.

53. Ken Liu (link) - 07 25, 2007 @ 09:27PM

@Ben
I should mention that gvim/vim for Windows is a great addition/alternative to your described setup. It's fast and powerful, and supports both a console and GUI mode.

I've switched from JEdit to gvim for the past few months in order to beef up my vim chops. You never know when you'll find yourself at a unix command line with no other editors in sight.

54. Max - 08 09, 2007 @ 03:44PM

Comment 48, didn't work for me. localhost and 127.0.0.1 => /tmp/mysql.sock

Suggestions?

Thank you

55. Dave (link) - 08 16, 2007 @ 05:59PM

If you want the "Unixy goodness" without Cygwin, install <a href="(link); from SourceForge. Just unzip, put the bin folder in your path (I have separate environment variables for my apps, e.g. MYSQL_BIN, RUBY_BIN, UNX_UTILS_BIN, etc then just combine them to make my path) and then you get access to tons of Un*x utilities like ls, agrep/egrep/fgrep/grep, cat, more/less, gzip/gunzip, tar, md5sum, cp, rm, mv, diff/patch, etc ad nauseum. Directly in Windows, no shell required.

But if you like, you also get the Bourne shell for free.

Also has pclip and gclip (put/get windows clipboard from/to the shell) and gplay (play media files).

And since Un*xUtils ln command will only make hard links, download <a href="(link) junction.exe command</a> (formerly of SysInternals) to make "junctions", symlinks under NTFS:

c:\> junction mydocs "c:\documents and settings\me\my documents"
c:\> cd mydocs
c:\mydocs> ls
-- lists everything under "my documents"

Works great for me. :)

56. Mark Percival (link) - 09 27, 2007 @ 09:05AM

I've got a solution that beats both Cygwin and a Mac for a rails development platform. Ubuntu.

Run it inside of VMWare(which is free), on top of windows or osx. I give my Ubuntu VM 128 megs of RAM, run it on a 800mhz laptop with XP, and develop in e. In order to access the VM just setup samba sharing and mount the drives on your windows side. It rarely touches above 2% CPU when idle, and I've never seen a noticeable difference in my laptops performance.

I've tried Cygwin, but with Ubuntu virtualized I can PERFECTLY match my production server while staying completely on Windows. Deployments a cinch, and the command line can't be beat :)

57. Ben - 09 27, 2007 @ 09:51AM

Mark, that's a very interesting solution. I'll have to try that out.

58. Val - 10 30, 2007 @ 02:57PM

Well, just another needless reinvention of the wheel, this time another of the still 10.000 available editors for Windows, which tries to ride on the wave of Mac Textmate users.

I always wonder why people are still going to develop again and again new editors-copies. We already have Emacs/Xemacs, Vim, UltraEdit, PSpad, Jedit, Slickedit, Multiedit, ED, CodeWright ...and so on... where most of these are highly customizable too and would offer all that stuff right out of the box now and yet. Not to mention full blown IDEs like Netbeans, Eclipse etc. which also support mostly all prog languagues.

So why do you guys need these new freshman editors like "e" and "Intype" at all? IMHO these are just produced to get out a few bucks out of Mac Textmate users, who may will from time to time work on a Windows system.

Sorry, but I don't see here any real reason for another 10.001 editor.

59. Carlos Aquino (link) - 11 29, 2007 @ 04:31AM

They showed us the screencasts... that´s why "e" and "Intype"
The editor is available to download... we downloaded it, installed and used...
Just for that.

60. George (link) - 12 22, 2007 @ 05:46AM

Heh, nice tutorial, thanks!

61. jason - 01 02, 2008 @ 11:13PM

hey I am trying to set this up but since I run instant rails I get a command unrecognized when trying to create a project using the rails mytest command with console2. any suggestions for configuring console2 to work when using instant rails?

62. Horia (link) - 02 19, 2008 @ 09:54AM

Max, comment 54: In database.yml I just changed host from localhost to 127.0.0.1, restarted the server and worked.

63. Dr. Alexander (link) - 03 05, 2008 @ 06:42AM

pff... thanks for website builder, but i think thath newbies must teach html code, tags with notepad :)

64. roberto - 03 29, 2008 @ 03:56PM

How did you manage that the project browser in e shows up outside the main window?

65. Curtis - 05 12, 2008 @ 02:02PM

roberto,

You just have to drag the "title" bar of the Project Browser panel outside your main window and it should detach itself. It would be nice if it could "lock" itself so you could drag either window and the other would snap into place. I know, not a fun thing to do with Windows.

All,

I like the write-up. Works very well. Sometimes you just can't use another OS no matter how much you hate Windows. Many of us have to work with multiple languages and have strict company guidelines...

66. Dustin (link) - 05 21, 2008 @ 07:42AM

For good measure, why don't you throw in ObjectDock to call all your apps the mac-like way ;)

67. Marc Spoon (link) - 06 15, 2008 @ 09:05AM

pretty neat tutorial, thanks for the steps and screens. Kif.

68. Ryan - 07 03, 2008 @ 03:28PM

So why don't all you "I'll just got buy a MAC", "Use a MAC", "OMFG MAC RULES" pussy fan boys just install Linux and use it, or are you afraid of see'ing all the opensource software Apple has ripped off.

69. Adam Barger - 11 11, 2008 @ 09:55PM

If you're looking for a seriously good <a href="(link) website</a> builder you should check this one out.

Previous 1 2 Next

Post a Comment




powered by Doodlekit™ Free Website Builder by Doodlebit™ Website Company