Ruby on Windows using Ruby irb, and how to set up RoR

Go To


I started playing around with Ruby on Windows. I downloaded Ruby and started it with the command line with Ruby.

I typed in irb to the command prompt and it changed to the irb command prompt.

Then I started trying out commands like 1 => 1; and other things, but I got no output. I just go the next prompt. What ta heck am I doing with that? :)

What should I do to make sure I have RoR set up and start creating applications?

Thanks and sorry for the generally confused question.

2012-04-04 01:16
by GeekedOut
are you certain that what you're typing into irb isn't expecting a closing quote? What you've described sounds like you've typed an unterminated string - miked 2012-04-04 01:49


In irb you can tell if your current line is unterminated doesn't start with >.

irb(main):001:0> "I'm gonna wait
irb(main):002:0" to finish this string"    # The string isn't terminated
=> "I'm gonna wait\nto finish this string"

But more interestingly in irb it would seem that a semi-colon(;) it won't terminate the line. Since semi-colons(;) inRuby aren't necessary and are just meant to be statement separators. irb won't actually run your statements until you end one without a semi-colon. Also 1 => 1 isn't a valid Ruby statement.

irb(main):001:0> string = ""
  => ""
irb(main):002:0> string << "I'm gonna run this line\n";
irb(main):003:0* string << "Plus this line\n"
  => "I'm gonna run this line\nPlus this line\n"
irb(main):004:0> string << "Semi-colons are not cool in Ruby"
  => "I'm gonna run this line\nPlus this line\nSemi-colons are not cool in Ruby"

So your problem should be solved by NEVER using semi-colons in Ruby

Also all these examples were run on Windows 7 using Powershell

PS C:\Users\Justin> ruby -v
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

As Aaron mentioned the best way to get started is probably RailsInstaller. I haven't used it personally, but it looks like it does pretty much everything for you.

I use RubyInstaller and set up my Rails environment myself. RailsInstaller does all that for you.

2012-04-06 00:23
by Azolo


Although I prefer using Ruby on Rails on a Mac, I have a soft place in my heart for Windows, so I set RoR up on my Windows machine a while back. But be forewarned, you may be setting yourself up for some heartache and pain. In addition to errors and badness, Ruby runs much slower on Windows. I would highly recommend setting up a dual boot or virtual machine with Linux and then putting Rails on your Linux OS instead of trying to set it up on Windows. You can use Windows Virtual PC or something similar if you want to go the virtual machine route.

But, if you still want to stick with Windows, I think one of the easiest ways to get everything installed is to use Wayne Seguin's RailsInstaller. Along these lines, I used Agile Web Development With Rails to help me learn the process of getting Rails set up and to build my first app. Great book.

Hope this helps.

2012-04-04 03:24
by Aaron Gray