Upgrade to Pro — share decks privately, control downloads, hide ads and more …

3 ways to Rails development on Windows

jsmith
August 20, 2015

3 ways to Rails development on Windows

jsmith

August 20, 2015
Tweet

Other Decks in How-to & DIY

Transcript

  1. Method 1: Use a pre-packaged bundle. Usually the quickest path

    to a working Rails environment. Forces you to use one of a small number of Rails and Ruby versions. May not include the latest bug fixes. No guarantee the packages are unaltered, could be anything in there.
  2. Pre-packaged Bundles http://railsinstaller.org/en Ruby 2.1.5 Rails 4.1.8 Bundler Git Sqlite3

    TinyTDS w/FreeTDS SQL Server Support Ruby DevKit Fairly minimal, good for creating a single Rails instance. Edits the PATH variable on install, doesn't take into account any already installed Rubies.
  3. Pre-packaged Bundles https://bitnami.com/stack/ruby/installer Ruby 2.2.2 RubyGems 1.8.12 Rails 4.2.2 ImageMagick

    6.7.5 Subversion 1.8.13 SQLite 3.7.15.1 MySQL 5.5.42 Apache 2.4.12 PHP 5.5.26 phpMyAdmin 4.4.7 Git 1.9.5 Nginx 1.8.0 Sphinx 2.0.4 DevKit (Windows only) AWS SDK for Ruby 2.1.1 Pros: Multiple potential security holes from databases and Apache after install. Leaves a log file with passwords in plaintext, which the installer warns you about. Doesn't alter the PATH variable. Offers more flexibility in the install process than RailsInstaller. Shows a nice welcome screen after install with links to documentation. Graphical interface for controlling Apache and databases. Cons:
  4. Method 2: Manually install Ruby, then Rails. Slowest path to

    a working Rails environment. You can pick specific versions of Ruby and Rails. Allows you to use a Ruby switcher. MRI Ruby compiles, installs and works great on Windows! Rails, not so much. This method forces you to address any broken Rails dependencies.
  5. Manual Installation: Compiling Ruby from source. Get the source: https://www.ruby-lang.org/en/downloads/

    Two options to compile: Using Visual Studio 2013: Open Visual Studio Tools / VS2013 x64 Native Tools Command Prompt In %SRC% execute win32\configure –prefix “C:\Ruby” In %SRC% execute nmake. nmake test nmake install (I got these steps from here: http://bunkernetz.com/2014/05/23/building-ruby-2-1-x64-on-windows-8/) Using MinGW (Minimal GNU for Windows): http://www.mingw.org Or this one: http://mingw-w64.org/doku.php I wasn’t able to get past some compile errors using this method, but I’m told it’s possible  Needs some configuration if you don’t want output files in /usr/. Have to set environment variables manually.
  6. Manual Installation: Ruby pre-compiled with an installer. http://rubyinstaller.org/ Run the

    installer, then install the DevKit - http://rubyinstaller.org/downloads/ If the gemspec file doesn’t correctly point to Sqlite3, follow the accepted answer here: http://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-on-ruby-on-rails
  7. Manual Installation: Installing Rails Then start fixing issues: There is

    a current issue with nokogiri as documented here: https://github.com/sparklemotion/nokogiri/issues/1256 (May be solved by manually building these security binaries with the DevKit compiler: “Nokogiri is built with the packaged libraries: libxml2-2.9.2, libxslt-1.1.28, zlib-1.2.8, libiconv-1.14.”) Possible solutions: http://stackoverflow.com/questions/28985328/rubyinstaller-2-2-1-and-rails-rake-cannot-load-nokogiri/29196632#29196632 There are possibly other issues blocked by the above. Maybe start over with Ruby 2.1? gem install rails rails new foo cd foo rake db:create This is where you learn if there are any issues with Rails dependencies 
  8. Method 3: Run a *nix environment. For a rails development

    environment on Windows to match as closely as possible the production environment where your projects will live, you’ll probably want to run a Unix or Linux VM. This is also the easiest way to get around poor gem compatibility with Windows, which is the biggest hurdle to Rails development.
  9. Method 3: Run a local Linux VM. + Use your

    native Windows text editor and graphic design tools. Locally test your projects on the widest range of browsers and browser versions. Import assets immediately into a Linux VM. Maintain multiple virtual machine images with unique configurations. Install GitHub repos and deploy to production directly from the VM. Takes 2-3 hours to set up a development environment the first time. Nice, slightly dated setup instructions here: http://tutorials.jumpstartlab.com/topics/vagrant_setup.html
  10. Method 3: IDE in the cloud Some options: https://c9.io/ https://koding.com/

    https://www.nitrous.io/ IDE in a browser, it really works. Extremely fast setup, start coding in a few minutes. Some limits to which packages can be installed in your environment. These are pay services, but they all offer a free level. Internet connection required, which may raise some security questions. Free service is not private, which may raise some security questions. Easy to install github repos and deploy to heroku or other services. Least amount of control over your development environment. Slightly better arrangement for browser testing than loading pages locally.