Install Ruby on Rails on Windows guide

Install Ruby on Rails on Windows guide

I played around with Ruby on Rails and wanted to set up a developer environment with Rails server and Ruby, but didn’t find any straight forward and easy guides, so I wrote one instead. Following this guide you’ll get going developing and running Ruby in 10 minutes.

Download RubyInstaller and Dev kit from http://rubyinstaller.org/downloads/
If you run 64 bit, remember to get the 64 bit version of both Ruby and dev kit.

Install Rubyinstaller to C:\Ruby
Check “Install Tcl/Tk support”, “Add Ruby executables to your PATH” and “Assosiacte .rb and .rbw files with this Ruby installation”.

Install Ruby on Rails on Windows guide 01

Extract Dev kit to C:\Ruby\DevKit
Open Command Prompt and CD to C:\Ruby\DevKit

Run:

[shell]ruby dk.rb init[/shell]

Install Ruby on Rails on Windows guide 02

Open C:\Ruby\DevKit\config.yml and ensure your Ruby location is included. It’s important that you have a “-” before the path like in the example. Save the file and go back to your Command Prompt.

Install Ruby on Rails on Windows guide 03

Run:

[shell]ruby dk.rb install[/shell]

Install Ruby on Rails on Windows guide 04

Run:

[shell]gem install rails –no-rdoc –no-ri[/shell]

Install Ruby on Rails on Windows guide 05

Create the directory C:\RubyApps

Install Ruby on Rails on Windows guide 06

CD to C:\RubyApps

Run:

[shell]rails new my_app[/shell]

Install Ruby on Rails on Windows guide 07

If you installed the 64 bit version of Ruby, open C:\RubyApps\my_app\Gemfile and replace the tzinfo-data line with:

[xml]gem ‘tzinfo-data’, platforms: [:x64_mingw, :mingw, :mswin][/xml]

. Save the file and return to Command Prompt

Install Ruby on Rails on Windows guide 08

CD to C:\RubyApps\my_app

Run:

[shell]bundle update[/shell]

Install Ruby on Rails on Windows guide 09

You are now done and can run your Rails server
Run:

[shell]rails server[/shell]

Install Ruby on Rails on Windows guide 10

Open up a browser and go to:

[shell]http://localhost:3000[/shell]

Install Ruby on Rails on Windows guide 11

That’s it. Your rails server is running in the Command Prompt window which is handy for development. There are many ways to make Rails run as a Windows Service, in Apache, IIS, etc. Google it if needed. :)

To get started developing your first Ruby application, I highly recommend this guide by Andrea Pavoni.

I found RubyMine by JetBrains to be a very nice IDE for developing Ruby on Rails applications – check it out.

RubyMine

Fastest way to delete large folders in Windows

Deleting a folder with thousands or even millions of subfolders and files can be a rather slow process in Windows. Deleting the files normally from the GUI, requires you to empty the recycle bin afterwards, which takes quite some time too. Shift-deleting is faster than deleting and emptying the recycle bin, but also takes a lot of time, as Windows will first index all the files that need to be deleted.

The fastest way to delete folders and files is to make a bat-file with the following 2 lines, specifying what folder you want to delete.

Using this method rather than deleting from the GUI or using “rmdir /s/q foldername” can save you hours of waiting time, depending on your folder/file structure.

[code]
del /f/s/q foldername > nul
rmdir /s/q foldername
[/code]

Mount ISO in Windows 8

Windows 8 have build in virtual drive, which enables you to mount iso files.
Normally you can just right click an iso and chose “Mount“, but if this option isn’t present, double click the iso / right click, open with, and chose “Windows Explorer”, which will mount the iso as a drive. You might have to do this 2 times, as first time can happen to throw an error.

Mount ISO in Windows 8

Windows 8 shortcuts

Knowing the most basic shortcuts in Windows 8 makes navigation a lot faster and work more easy.
I have made a collection of shortcuts I use the most – a more detailed and full list can be found on the image below.

Hitting Windows button, switches between Metro style screen and the classic Windows desktop. This can be obtained by moving the mouse cursor to bottom left corner and clicking as well.

If you hit Windows button and start typing, you will open the Search charm, and can then search between installed applications, files and settings .

Win + C Open charms (you can also move the mouse cursor to bottom right corner)
Win + D Show desktop
Win + E Open Windows Explorer
Win + F Search files charm
Win + I Settings charm
Win + Q Search charm
Win + R Run
Win + X Open power user menu

To turn of your computer, you have several options:

1. When standing in classic desktop mode, you can simply hit ALT + F4
2. Hit Win + I, which opens the Settings charm. Click Power and Shut Down.
3. Hit Win + C or slide the mouse  cursor to the bottom right corner, click Settings and then Power and Shut Down.

Full list of Windows 8 shortcuts:

Windows 8 shortcuts

Download Windows 8 & Windows Server 8

After I have been running Windows 8 Developer Preview since the launch, and Windows 8 Consumer Preview got released last week, I decided to download and test it as well. I have been very positive with Windows 8 Developer Preview as working station OS for normal web development and every day use. As a developer OS, Windows 8 ain’t ready yet, as it conflicts with eg. Windows Phone SDK and Silverlight SDK, to mention the ones I have tried.

Either way, I thought it would share some download links.

Windows 8 Consumer Preview ISO 32/64bit
Product key: DNJXJ-7XBW8-2378T-X22TX-BKG7J

Windows Server 8 Beta 64bit

Windows 8 official logo