Ruby beginner problem

Hello guys

I’m new to learning programming and actually just started with Ruby. So
far i can say it is very easy and understandable but i do have a small
problem and i hope you can help me out here. I will try and explain it
in the best possible way.

…btw, im using windows 7
I downloaded Start command prompt to do some basics in whilst learning.
Later i was told to download Sublime Text 3 for my laptop and then use
them to work with each other and run commands.

In the command prompt i entered mkdir learn_ruby
then, cd learn_ruby to open the directory, which it did.
Then i wanted to create a new file by entering
D:\Users\Jacus\learn_ruby>touch ruby_program.rb but it won’t except it.
It tells me ‘touch’ is not recognized as an internal or external
command,operable program or batch file.

My question is , what did i do wrong above to create a new file?

The other thing is, when i’m in Sublime and i press open file, i can go
and search for the directory of this folder (learn_ruby) but there is no
file there, probably because i can’t create it.

Now, i need the command prompt for ruby to work together with Sublime so
i can try and write something and see the outcome.

For example in Sublime i would write perhaps puts “hello” and then try
execute the file in command prompt, but nothing happens.

Please give me some advice on this so i can move on with my learning
here. Please remember i’m new to programming, so be gentle with me :wink:

Im also open to suggestions with using different software programs if
you think differently.
Thanks for the help and support. Appreciate it!

I don’t know how Sublime operates. What I did was to use the
RubyInstaller for Windows, and then create and edit the ruby files using
Notepad++

You didn’t specify how you installed Ruby. If you have Ruby installed
and added to your path, then you should be able to execute this line in
the command prompt:
ruby -v

If that doesn’t work, you haven’t installed Ruby.

Your mistake was to use Windows. It doesn’t have a touch command.

When I am forced to work with Windows, I usually install Cygwin, which
gives a decent environment with all kinds of shells. You also have a
“touch” command.

There is also a Cygwin version of Ruby which can be installed. Whether
or not you are using the Cygwin Ruby, or the Windows distributable for
Ruby, depends on what you want to do. The most important difference is
when it comes to install so-called Gems (this is the Ruby term for those
library modules, which are not included in the normal Ruby distribution,
but need to be downloaded/installed separately). If the gem contains
only Ruby code, it doesn’t matter whether you use the Cygwin- or the
Windows-version. If it contains native (compiled) code, it might be
difficult to get it running on Cygwin Ruby, and I would recommend
installing the Windows version. Also, if you want to manage several Ruby
versions in parallel on your machine (this is done using rvm, the Ruby
Version Manager), you won’t be happy with Cygwin Ruby.

OTOH, the integration of Cygwin Ruby with Cygwin is smoother than with
Windows Ruby. You get it installed and ready to use with the development
process of all the other Cygwin tools.

Having said this, of course nobody forbids you creating a file on
Windows without Cygwin. Just don’t use “touch”…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs