How to run ruby programs on Windows 7?

2019-04-18 08:44发布

Does anyone know how to run/compile Ruby programs on Windows 7? For example you can compile Java in Eclipse, but I can't seem to find one for Ruby.

5条回答
不美不萌又怎样
2楼-- · 2019-04-18 09:15

Also, in case you want to run just Ruby interactively, find the location where it is installed and browse to the bin subdirectory. For me this was \RailsInstaller\Ruby1.9.3\bin. In this directory there should be a file irb.bat. Double-click on it and you'll get a Ruby console session.

查看更多
3楼-- · 2019-04-18 09:17

You can create window executables with ocra. That way you can create the app and push the app to another pc that does not have Ruby installed on it.

查看更多
ら.Afraid
4楼-- · 2019-04-18 09:22

Ruby isn't compiled, but rather interpreted. You need to install Ruby using the above link given by @ilollar.

Then, if you have the source code of a program in the file some_ruby.rb, you will execute this in cmd:

ruby some_options.rb

This is the general form of a ruby command:

ruby [ruby options] [program name] [program options]
查看更多
祖国的老花朵
5楼-- · 2019-04-18 09:23

http://rubyinstaller.org/ - "The easy way to install Ruby on Windows".

Will give you the language and execution environment - everything you should need to get started.

查看更多
叼着烟拽天下
6楼-- · 2019-04-18 09:27

Here is a free online book that will answer most of the question you have about Ruby if you are just starting out: http://ruby.learncodethehardway.org/book/

It's called "Learn Ruby the Hard Way", but don't let the name throw you off - the book is actually pretty easy to follow and doesn't assume you know anything about programming.

It will get you started writing Ruby and running programs for the first time.

Like ilollar said, the Ruby Installer is the best way to put Ruby on your Windows computer.

I'm currently running Ruby on Windows 7 writing Rails applications. You can do a lot on Windows with Ruby, however, you can't do everything. There are bundles of files that you can download that will help you write your Ruby programs - they are called Gems. Some gems will not run on Windows - The Ruby Racer and some versions of EventMachine are two that immediately come to mind.

This can be frustrating, but if it ever happens you can install a version of Linux in a virtual machine on your Windows computer so that you can use these gems without having to get a new machine.

You can also install Linux to run alongside Windows without having to reformat or mess with the partitions on your hard drive. There is a program called 'Wubi' that will install Ubuntu (a version of Linux) to run inside your Windows machine. It will actually let you pick Windows or Linux when you start your machine.

But all this is stuff to think about later on. You can certainly develop Ruby on Windows for now.

查看更多
登录 后发表回答