Developing Rails apps on Windows (the joyful way)
factore.ca
factore.ca
The setup for dev on Windows is pretty simple as you can see from
http://napcs.com/howto/rails/windows/
As it stands now, with the latest installer for Windows, Rails development is quite possible. Msysgit works fine, SQLIte, Rails, all of it works great, it's just slower.
In fact, I've been using Windows for Rails dev for nearly 5 years - I'm even crazy enough to have deployed production apps on Windows servers. (out of necessity, not out of choice, but it's a neat skillset to have, and I was able to contribute a chapter on Rails + Windows to http://pragprog.com/titles/fr_deploy/deploying-rails-applica... which, oddly enough, is still relevant.)
HOWEVER, I will state that if you're looking to truly leverage Ruby, nix is the way to go. A VM like this works great, but I also recommend two pieces:
Putty to act as your console * SAMBA on the VM so you can have a share.
I used a setup like this for a while for LAMP development before I started doing Rails.
I am finding the learning curve to be rather steep, but I have prepared myself to pull through and come out the other side a Linux guru.
The question is this: Am I doing it wrong? Given that I am already comfortable and productive in Windows.. is it idiotic of me to try to force my square peg into a round hole? Should I at least go the middle-ground and use a VM so that my 'normal computing' is in my familiar environment and I can just drop into Ubuntu for testing/deployment?
One last bit of context: I am bootstrapping a web startup in my evenings so time is rather premium. My day job is still windows centric so context-switch issues might occur.
I just taught a day long Ruby / Rails class in Feb and we had Windows users mostly, with some Mac and Linux folks too, but we all deployed to Heroku.com without issues.
My advice is to use what makes you productive now. Learn many things, but learn them one at a time or you'll frustrate yourself. Switch from Windows to Linux when Windows starts slowing you down if that makes you more comfortable.
Programming should be fun. :)
- Command line will give you the most bang for your buck every single time. Learn one small thing at a time and build upon it, you will be amazed at how much more productive and quick you will become from understanding simple commands.
- Start using Vim/Emacs. Doesn't really matter which one, the gains from using a powerful editor will (in the long run) pay for them selves.
These editors combined with the command line have shown the greatest gains in my productivity.
Now that said learning the editor will be up hill for a good chunk of the time until it clicks, so it may make sense to use something like geddit in the mean time.
There is no magic bullet with any sort of Development. Using unix like systems isn't going to make your website better or you more productive if you don't actually take some time and learn it. If you come over to Ubuntu but only use the GUI you will likely loose productivity.
Besides who cares what you write your site in as long as you -write- it.
I suppose right now a much more difficult thing for me is coming to grips with more fundamental differences in the OSes. For example, if I install a program on windows it goes into /Program Files/ and I know how to interact with it. If I apt-get in ubuntu its often unclear to me where to modify it's configuration, how to launch it, etc. This is best illustrated by the 4 hours I burned getting nginx up and running.
I am certain that this is just me not being used to the conventions but.. Well I don't know what my point is, honestly I think I am just venting now. :)
edit: Question on the VIM/Emacs suggestion. I started dabbling in VIM, but as a long time VS.NET user (I can navigate through a visual studio environment like a fish through water) it just felt.. Small. I assumed I would be better off going to an IDE (I am using python, so there are plenty to choose from). Do you have any comments on this? Is an IDE a 'drug' I could benefit from learning to break off?
If you choose Emacs, I believe VS has Emacs key-binding support built in.
VIM is just an editor with advanced editor tools. If you are looking for more of a IDE emacs really follows that path. Its highly extensible and has many more IDE type features.
Again using an IDE is fine and dandy if you ship things. :)
As for git on Windows, I've found Msysgit to be a lot faster and more stable than git on Cygwin. You can also configure it during installation so that git commands work on the CMD command line, which is marginally less bad than Msysgit Bash.
Obviously, I never noticed Ruby can't do SQLite on Windows. I find that somewhat weird, as Cygwin appears to hide Windows very well and has its own builds for Ruby and SQLite (I use Cygwin's Python instead of win32 Python.
At first, I was considering to congratulate the author for being able to use "developing", "on Windows" and "joyful" in the same sentence.
For everything else - and "everything else" includes large swaths of lucrative, profitable programming activities, including something like two-thirds of the internet - Windows is simply excruciating. I'm not exaggerating; after spending the past year or so developing on Ubuntu, I don't know how I managed to get anything done before.
The Windows command line is minimally usable (I have to right-click on the window frame to pull up a context menu that provides select/copy/paste functionality? Really?) and its language is minimally powerful (I understand powershell improves significantly on this).
Unless you're moving files around a Windows network, in which you can map drives in Explorer, such basic network things as FTP/SFTP require clumsy third-party GUI applications and your choice of FOSS options is severely limited. SSH requires a clunky third-party tool like PuTTY or a Posix emulator like Cygwin.
Native support for open source database servers like MySQL, Postgres, and SQLite is dodgy at best and requires bolted-on interfaces. More exotic, innovative database systems are generally out of the question altogether.
Some programming languages, like Python, are reasonably cross-platform (though in the case of Python you're still stuck with a choice between using the crappy Windows command line or the slightly-less-crappy IDLE IDE built in non-native Tkinter), while others are much harder to get working.
Java is fully cross-platform and has IDEs that work as well on Windows as any platform, but there's no particular reason to develop Java on Windows rather than another OS.
It's true that installing Cygwin makes a lot of the deficiencies of Windows go away - but that's by emulating a Posix environment such as you'd find natively on Linux or OSX, which is kind of the point about Posix being generally a much better platform for programming than Windows.
I worked at Microsoft on the Visual Studio team for four years. I love Visual Studio. Visual Studio is awesome. That doesn't change the fact that I (and lots of other people) firmly believe that writing Rails applications on Windows is a miserable experience.
But shoot me dead if I ever have to do a real, actual, useful, standards-compliant website in Windows with Visual Studio. I'll take me screen, shell, Vim, Python, and SSH over it any day.
I started developing software professionally about a quarter of a century ago, on Apple IIs using the built-in BASIC, 6502 machine language and assorted toolkits for graphics and animation. For a long time, I used Microsoft technologies, from Actor (a Smalltalk-like environment that ran on Windows) to Visual Basic, Visual C++ (mostly for WinCE) and assorted MS web technologies. I also did a lot of web stuff on Unix platforms at the same time. It was not until 2002 that I made my switch to Unixes complete. Unless you develop for Windows, it makes little to no sense to develop on Windows and, as far as you are comfortable with other platforms, it makes little to no sense to deploy to Windows. It's expensive, not particularly predictable and the hood comes soldered. Not a good thing on a server.
In fact, I like to develop on a platform as close as possible to the deployment platform. It makes a lot of sense.
Development stacks are tools. All I implied was some are much more refined than others.
With time you'll learn.