Help with RubyGems

I am new to Ruby and programming, so please bear with me.

I installed RubyGems 1.4 and when I tried some commands in IRB, it did
not work.

When I input “gem query”, it returns:

“NameError: undefined local variable or method ‘query’ for main:Object”

What am I doing wrong?

On Fri, Jan 7, 2011 at 5:09 PM, Institute For human continuity
[email protected] wrote:

I am new to Ruby and programming, so please bear with me.

I installed RubyGems 1.4 and when I tried some commands in IRB, it did
not work.

When I input “gem query”, it returns:

“NameError: undefined local variable or method ‘query’ for main:Object”

What am I doing wrong?

Did you install RubyGems with Ruby 1.9 (ruby -v)?

If so, it’s probably best to just reinstall (from scratch) at this
point, especially if it is a fresh install.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

On 7 January 2011 17:09, Institute For human continuity <
[email protected]> wrote:

you have to type your gem-commands in the command line not in irb.

-Thomas

On Jan 7, 2011, at 8:09 AM, Institute For human continuity
[email protected] wrote:

When I input “gem query”, it returns:

“NameError: undefined local variable or method ‘query’ for main:Object”

gem “query”

Gem takes a string.

Thomas P. wrote in post #973179:

On 7 January 2011 17:09, Institute For human continuity <
[email protected]> wrote:

you have to type your gem-commands in the command line not in irb.

-Thomas

No response from cmd when I try it.

On Sat, Jan 15, 2011 at 6:11 PM, Institute For human continuity <
[email protected]> wrote:


Posted via http://www.ruby-forum.com/.

There seems to be context confusion, it is expected that you are in a
certain place (the terminal) when you type “gem query”, but presumably
you
are somewhere else (such as irb), or gem isn’t in your path, but from
“no
response from cmd” it sounds like you might be on Windows, because the
Windows terminal is named “cmd.exe” (IIRC), but I’m not sure if that is
really what you are saying, maybe you mean the query command isn’t
working.

Can you take a screen-shot of what you are trying to do, so that we can
see
the context of your problem? If you are on Windows, the printscrn key
should
do it, then open MSPaint and paste the image into there and save it as a
jpeg; if on Mac, Command+Shift+4, and click in the upper left of what
you
want to capture, then drag to lower right; IDK for Linux. You can then
host
the image on imageshack.us and post a link.

On Sat, Jan 15, 2011 at 6:35 PM, Institute For human continuity <
[email protected]> wrote:

I am using cmd.exe on Windows.


Posted via http://www.ruby-forum.com/.

Then it sounds like your gem application is not added to your path. When
you
run a command like “gem”, your terminal figures out what that means by
looking through a set of folders until it finds a program with the same
name. Then it lets that program handle whatever you typed in on the
command
line. The way it determines which folders to look through is by
examining a
variable called your path (in *nix, you can type ‘echo $PATH’ to see
it).

I don’t know enough about Windows to know how to fix this, but this
tutorial
looks very good, and should have everything you need, to get the gem
command
working
http://www.voidspace.org.uk/python/articles/command_line.shtml#pathIt
shows how to fix Python, if it has this issue, but I’d expect it to be
exactly the same for rubygems.

I am using cmd.exe on Windows.

Thanks