Forum: Italian Ruby user group [newbie] .rb vs irb (installazione gems)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dd5f317c3f613a209f09d13b049675e6?d=identicon&s=25 Matteo Moci (mox601)
on 2008-12-12 19:08
Ciao a tutti, premetto che in ruby sono un newbie totale ma spero di
imparare presto (anche su questo forum)

Il mio problema é che vorrei provare questa libreria:
http://scrobbler.rubyforge.org/ per vedere i dati di last.fm di un certo
utente, e dalle istruzioni sul sito la gem si installa cosí:
sudo gem install scrobbler
dopo averla installata, provo questo semplice codice:

require 'rubygems'
require 'scrobbler'
# get recent tracks for a user
user = Scrobbler::User.new('jnunemaker')
user.recent_tracks.each { |t| puts t.name }

ma purtroppo ho questi errori:
RubyMate r6354 running Ruby r1.8.6
(/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby)
>>> provaScrobbler.rb
[...]
at top level  in active_support.rb at line 29
method gem_original_require  in custom_require.rb at line 31
method require  in custom_require.rb at line 31
at top level  in scrobbler.rb at line 1
method each  in scrobbler.rb at line 1
at top level  in scrobbler.rb at line 1
method gem_original_require  in custom_require.rb at line 36
method require  in custom_require.rb at line 36
at top level  in provaScrobbler.rb at line 2

che scaturiscono dal require 'scrobbler'.
dove sbaglio? come dovrei includere questa gem?

poi provando lo stesso codice in irb:
>> require 'rubygems'
=> false
>> require 'scrobbler'
=> true
e poi il programma funziona.



uso mac osx 10.5 (+ textmate), e questo é l'output di alcuni comandi:
$ which ruby
/usr/bin/ruby

$ env
MANPATH=/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/usr/X11/man:/usr/local/git/man/
TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
TMPDIR=/var/folders/2D/2Ddp8FdXEgWrI0ZOIjx-LE+++TI/-Tmp-/
Apple_PubSub_Socket_Render=/tmp/launch-M8Iwsj/Render
TERM_PROGRAM_VERSION=240
USER=XXX
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-8dQbIC/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:4
PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr/texbin:/usr/local/git/bin/
PWD=/Users/XXX
LANG=it_IT.UTF-8
SHLVL=1
HOME=/Users/XXX
LOGNAME=XXX
DISPLAY=/tmp/launch-67LlQf/:0
SECURITYSESSIONID=693310
_=/usr/bin/env
Dd5f317c3f613a209f09d13b049675e6?d=identicon&s=25 Matteo Moci (mox601)
on 2008-12-13 11:51
mi rispondo da solo:
ho aggiornato il bundle di textmate relativo al linguaggio Ruby, ora
fila tutto liscio.
This topic is locked and can not be replied to.