Port a Rails App from Windows to Mac or Linux - ruby-on-rails

Hello I've been a Rails developer on Windows for quite some time now, but I recently completed my biggest project yet (it's quite extensive, took me over a year to build) but I am having trouble deploying it. The combination of it's size, complexity and a windows environment is making it needlessly complex to deploy. I am thinking about getting an old mac mini and using it just for rails development.
Either that or install unix on another box.
Is there any way I can port my app to this mac or linux machine, without having to start over? I can't find any resources on the internets about this.

Rails is designed to be fairly platform flexible. What gems are you using in your application that won't run on linux / OS X? Usually compatibility issues run the other way (as very few Rails professional developers run Windows). It is hard to debug when you don't include any of the errors you get, etc.

Unless you have very specific system calls in your app there shouldn't be any need to "port" anything as it should work as is on Linux or OS X. Out of curiosity, what kind of problems are you running into with deployment?

Related

How to set up Rails dev environment on MacBook Pro running Windows 7?

Work has issued me a MacBook Pro, but I am primarily an ASP.NET (C#) developer, so I spend most of my time in Windows 7 running on VMWare Fusion.
I have been asked to begin working on Ruby on Rails projects (which I am looking forward to). I find that I prefer the Windows 7 OS as I tend to be more productive in it over OSX, so I would like to setup my Rails dev environment on Windows 7.
Based on other user's experiences, I would like to know your recommendations how how to setup my Windows 7 environment to develop Ruby on Rails with Postgres as the database.
While doing some initial research I did find this post on using Vagrant with VirtualBox which sounded interesting, but I am wondering if I could just do something similar with my existing OSX install.
Also, I am not completely opposed to running my Rails dev environment in OSX, so I am willing to hear arguments in favor of this approach. Do Windows and Rails/Postgres work well together as a dev environment?
Thanks for any helpful feedback you can provide.
I'll try to persuade you to use OS X.
Windows ruby development brings a vast amount of problems with gems. Especially with native extensions.
The second argument for OS X, is that it is UNIX based system, which is much closer to production environment. Nobody deploys to windows.
Most of ruby tutorials and manuals require unix based system.
Just give OS X a chance, and you will be much productive, spending time on you applications business logic, and not asking other questions, related with windows&ruby problems.
Don't use vagrant inside windows at vmware fusion. It seems really strange :)
The most common ruby development style - is simple text editor and terminal. Thats all, you don't need windows for that.

I need a real UNIX RoR development environment

From the beginning, I am a Windows master. I started with MS-DOS. I put up Windows 2.1 and every Windows since. I have 10 different Windows boxes running in my house right now, from Windows 7 Ultimate to varied flavors of Windows Servers. I haven't done Windows 8 and don't want to go there.
I have UNIX experience with both servers and varied software, but it hasn't been my preferred environment. However, I guess I am converting. I've tried to pretend to run UNIX under Windows using Cygwin and MSYS. My purpose is to build a development environment. Both have failed me. I have spent more time trying to fix a series of technical issues than I have developing. That is unacceptable.
My Ruby on Rails development environment is by far my highest current priority. I have websites to build, right now.
At this point, I have two options. One is to find a UNIX development environment in a cloud. The other is to convert one of my many machines to a true UNIX system. So, I need advice. I don't really want to build and babysit a system. The idea of a cloud-based development environment is very interesting, with the caveat that I don't chase it down another rat hole like I have with Cygwin and MSYS.
Here are the questions. Is there a solid cloud-based Ruby on Rails friendly development environment out there? Failing that, should I put up an Ubuntu-based system. If I go there, do I convert a workstation or a server?
Thanks...
I highly recommend Vagrant. I use this to do development on my Windows systems.
As you found out, Windows is terrible for RoR development. Your best option would be to use a VM like VirtualBox to run a Linux/Unix instance. There are other VM options, but VirtualBox is free.
Failing that, just convert once of your boxes to Linux/Unix. For development it does not matter one bit if it is a workstation or a server.
Mac OSX
The unofficial standard for RoR production is Linux, but for development it is Mac OSX. There has been a big migration of developers to the Apple platform that has been going on for many years now.
It gives you the best of both worlds: it is Unix underneath but it's also a commercial platform, a polished UI, and an available software ecosystem.
Yes, it's expensive, but people should ask themselves, why are people willing to pay so much? If you can afford 10 boxes for Windows, how about finding $ for one Mac? Then, you will have not just a workable RoR environment, but the best.
Or go VM
But if you don't take that advice, you may want to install a Hypervisor like Xen or XenServer for free, and then you can run both Windows and Linux on the same machine. This is slightly different than running a VM under Windows.
Externally, I have received a recommendation for EngineYard.com as an outstanding RoR environment and will ultimately consider it as my primary development/migration/production environment.
I have a working Debian system now and am building it out as a local RoR environment. It just seems to be right for a serious RoR development environment. I will go there as soon as it is fully built out because RoR is just meant for UNIX.
However, at least temporarily, I have found that RubyStack is a seriously usable Windows RoR development environment. It is 100% usable as a standalone system that doesn't require UNIX-style environments shoehorned onto Windows. Trying to run UNIX on Windows was a constant source of frustration, so this meets my immediate needs.

Rails development Mac OS or Windows

I am currently starting Ruby on Rails development and currently use Windows (XP or 7), but I find lots of cases where gems don't seem to do what they should or its a pain to install and use them under Windows, like twitter-bootstrap seems fine for Mac OS but I had to work out that sass-bootstrap was better for Windows. It just goes on and on, like today I cannot seem to get launchy to do its thing when RSpec testing, although I know that my lack of experience doesn't help.
So should I just get a Mac ? Would getting a Mac give me an easier life ? Most RoR developers seem to use them and most example tutorials seem to assume I do to.
Thanks for any advice
The simplest answer is you can do RoR development on any of the platforms easily.
Personally, I started doing development in Windows, then switched to VirtualBox on windows running Ubuntu. I now have a MacBook Pro and must say it's the happiest environment so far!
Windows - Reasonably straightforward to install rails, but seemed much slower that other enviroments. Lack of simple console with color highlighting was annoying
Ubuntu - Faster than under windows (even when virtualized!). If you don't know linux, it's a lot less fun, steep learning curve for command line stuff and lots of dependencies to resolve
Mac - Best of both worlds, pretty UI for day to day stuff, awesome command line support, Ruby and RoR run super fast on MacBook Pro.
I don't use a mac, I use linux, but I switched from Windows early in my experience with Rails. Using a mac is way better than using windows. The cheap option is to just dual-boot your windows machine with Ubuntu.
Just get off of windows.
See this for more details:
Getting Ruby on Rails environment working and installing sqlite3
Edit: VirtualBox is also an option for those whose processor supports it.
i would suggest to try out with any linux versions like Ubuntu, centos, fedora...
I think you can use linux version - ubuntu 12.04 because there are some ruby gems that are not working on windows like rubyracer, less-rails.
Install VirtualBox and run an Ubuntu or Redhat virtual linux machine.
I develop in Rails under Windows at work and at home most of the time. There are a few instances where gems won't work or will require a little more work to get running properly. There are also instances where developing on Windows and deploying to Linux/*NIX environment can cause problems, usually involving Windows-specific gems in your Gemfile.lock which aren't compatible on Linux/*NIX.
All-in-all, it's not too much trouble as long as you watch out for the gotchas.
I also use Mac OS X for Rails development and I like the development experience much more than I do on Windows. That being said, I certainly don't need a Mac to be able to develop in Rails effectively.
I also started with Rails development and recently bought myself a MacBook Pro. A Mac has solutions for running Windows, in case you also still need to do development on the Microsoft technology stack. You can install Windows via Bootcamp, which is a built in solution. Or run Windows in a virtual instance with virtualization software like Parallels.
hope this helps,
Anthony

Most stable (headache free) development environment for Ruby on Rails?

Would some of the more advanced rails developers please share what they have found to be the most productive combination of OS, IDE, etc. (i.e. the set-up that gives the least of amount of compatibility issues, headaches)? Also, what is the most commonly used setup?
I presume the common setup is common because it is thought to be the best compromise between all the options.
And that common setup is:
Mac OS X
TextMate
rvm
There's a lot of nuance to your question, for example you'd probably want to take into account what you already have, what your appetite is for spending money, etc. This is before even coming to the minefield of personal preference. :)
Here's a starter list:
Operating System
In my experience on both, Mac > PC for Rails programming because it creates fewer unforeseen/annoying problems.
IDE
Depends on how 'rich' you like your environment to be. Some people who like light environments simply use Notepad++; others use richer options like TextMate (Mac only) or RubyMine.
General Set up
Rails 3.1, MySQL
Local Server
Webrick and Mongrel are fairly popular.
Hosting
Heroku is extremely popular for Rails apps. It's free for low traffic and they're beautifully designed for Rails. If you want to avoid the server reloading problem (webpages take a while to load if no one has requested them in a while), you can set up NewRelic or Pingdom to ping the app and keep it active.
Performance Monitoring
NewRelic
I moved from Windows for Rails 3 to a Ubuntu 11 virtual machine running on Windows via VMWare player.
I'm using Gedit along with GMate (source here) to make Gedit more similar to TextMate for Rails Development.
I've found the setup to be way faster running on the virtual machine than it was on Windows directly. It took some time to get set up but once done, I just transfer the vm image from machine to machine. The setup was all free too (besides my laptop and the copy of Windows 7 on it).
The most common development environment I suspect you'll find among the Rails illuminati is probably:
Mac OS X (though some use Linux)
various Ruby versions/gemsets in RVM
TextMate or MacVim as the IDE (gvim or vim for the Linux folk, usually, though some prefer Emacs)
SQLite or MySQL for development database
Webrick, Mongrel, Thin, or flavour-of-the-day lightweight local webserver

Ruby on Rails development on windows

I've been planning on developing a rails project on windows.
I've heard that the framework wasn't tested on windows (at least not the testing framework)
does anyone have any real experience with rails on windows?
are there any known bugs when running on windows?
does the testing framework work on windows?
I've been developing a Rails website on Windows & Mac (depending on where I am at the time) for a few months now and, in general, I haven't run into to many problems. Here's what I know:
The new Ruby 1.9.3 installer for Windows is nice because it comes with RubyGems (which a vague memory tells me was difficult before). That's what I'm using. I haven't been able to get the ruby-debug19 gem to install correctly on windows. So, I just comment that out in my Gemfile on my Windows computer. Other than that, I haven't had any issues.
With that said, however, I love developing on my Mac so much more than I do on Windows. I haven't found an editor that I love for Rails development on Windows (currently using Sublime 2 or Notepad++ with Explorer plugin), using Git is not as nice on Windows, and I just really don't like the Windows Command Prompt (I know there are other options, but still).
I have recently been working with another developer that has been developing on his Windows laptop. He's been using the same tools and Rails 3 codebase as myself (I'm on Mac OS X).
He has had a number of blocking issues that have wasted many hours of his time - for example he hasn't been able to run any of our RSpec tests, and some Rake tasks.
Getting the environment setup is a pain, and even when you do, it's stressful because you never know when you are going to hit the next bizarro Windows-only bug. The reality is that Windows is a rare OS among Rubyists, and even if that wasn't so, the Rails framework developers themselves are UNIX-oriented, so there is an order of magnitude less scrutiny given to testing and development on the platform.
What's more, many of the sweet tools in the Ruby world are command-line and they work better in a real POSIX shell.
My co-worker has now bought a MacBook, and is enjoying a smoother development experience again.
But you don't need to buy a Mac; You would do just as well with dual-booting into Ubuntu (Or similar) on your existing laptop.
I prefer developing Rails with the help of Vagrant and some Chef cookbooks to create a virtual machine where I run my Rails code on. This solves the problem with some gems not working on Windows and seems to be faster. Here's a post a wrote how I got this working
I've tried 5 different ways to setup Rails development environment on Windows.
These includes virtualized Linux environments, Windows subsystem for Linux and alternative Ruby interpreter like JRuby. Rails on Ruby MRI works relatively well, but certainly there are gems that build native extensions that cannot be compiled on Windows. Depending on which gems your project requires, you might have a easier time.
I've got a short comparative write up here http://cs.mcgill.ca/~mxia3/2018/02/18/Five-different-Rails-development-environment-on-Windows-10-and-their-pros-and-cons/
I have been developing on Windows using Ruby (currently 1.9.2), Rails (both 2.3.x and 3), Rspec (1.3 and 2), Cucumber, Capybara, selenium-webdriver, sqlite3 for a few years now, and it all works most of the time. The company I work for deploys a Rails app on Linux and Windows along with our other piece of enterprise software.
That being said, I do run into weird issues a lot. I'm now trying to blog about them so that they're googlable and, eventually, I'm trying to learn how to fix them. Ruby Windows support has improvements to be made, for sure, but no one will bother fixing them if no one is using Ruby on Windows!
Definitely use the RubyInstaller. Luis Lavena, one of the main contributors, is really nice and responsive on the RubyInstaller mailing list and twitter.
I would not use Ruby on Rails on Windows for a production website, but it is commonly used for development, in particular by designers that need to work with RoR teams. We developed and use internally with our designer guy Rubystack, which is a free, all-in-one installer that setups a Rails development environment in just a few minutes.

Resources