From: Chris Carter Date: 2007-07-13T02:31:21+09:00 Subject: Re: Yet another site_ruby question... On 7/12/07, Daniel Jewett wrote: > In article > <86987bdf0707121014q884fa0dld5f91258a5d345e1@mail.gmail.com>, Chris > Carter wrote: > > > On 7/12/07, Daniel Jewett wrote: > > > In article > > > <86987bdf0707120938r7121cb59o3404386a44758cf8@mail.gmail.com>, Chris > > > Carter wrote: > > > > > > > On 7/12/07, Daniel Jewett wrote: > > > > > Hello all, > > > > > > > > > > Here's the LOAD_PATH for my desktop: > > > > > /usr/local/lib/ruby/site_ruby/1.8 > > > > > /usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.10.0 > > > > > /usr/local/lib/ruby/site_ruby > > > > > /usr/local/lib/ruby/1.8 > > > > > /usr/local/lib/ruby/1.8/powerpc-darwin8.10.0 > > > > > . > > > > > > > > > > Here's the LOAD_PATH for my laptop: > > > > > /usr/local/lib/ruby/site_ruby/1.8 > > > > > /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1 > > > > > /usr/local/lib/ruby/site_ruby > > > > > /usr/local/lib/ruby/1.8 > > > > > /usr/local/lib/ruby/1.8/i686-darwin8.9.1 > > > > > . > > > > > > > > > > Installed gem 'flacinfo-rb' and the path looks like this on both > > > > > machines: > > > > > /usr/local/lib/ruby/gems/1.8/gems/flacinfo-rb-0.3/flacinfo.rb > > > > > (although I would have expected to find it here: > > > > > /usr/local/lib/ruby/site_ruby/1.8/flacinfo.rb) > > > > > > > > > > On my laptop success with: > > > > > irb(main):001:0> require 'flacinfo' > > > > > => true > > > > > > > > > > On my desktop this: > > > > > irb(main):001:0> require 'flacinfo' > > > > > LoadError: no such file to load -- flacinfo > > > > > from (irb):1:in `require' > > > > > from (irb):1 > > > > > > > > > > If I move the gem to site_ruby on my desktop, the load succeeds. My > > > > > question is why the inconsistency? > > > > > If the install location is incorrect why does require work on one > > > > > machine and not the other? > > > > > > > > > > Here's the result of the install command on both machines: > > > > > Successfully installed flacinfo-rb-0.3 > > > > > Installing ri documentation for flacinfo-rb-0.3... > > > > > File not found: lib > > > > > > > > > > Is that last bit significant? > > > > > > > > > > Thanks for any info, > > > > > Dan J. > > > > > > > > > > > > > > > > > > > > > > You need to require 'rubygems' first. This probably isn't required > > > > because you have RUBYOPT set on your desktop, but not your laptop > > > > > > Thanks Chris, > > > I did try that... > > > > > > irb(main):001:0> require 'rubygems' > > > => true > > > irb(main):002:0> require 'flacinfo' > > > LoadError: no such file to load -- flacinfo > > > from > > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > > `gem_original_require' > > > from > > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > > `require' > > > from (irb):2 > > > > > > This isn't necessarily a show stopper, because of course I can just > > > move the library, but I'm trying to understand the process. > > > > > > Dan > > > > > > > > > > How about: > > require 'rubygems' > > require 'flacinfo-rb' > > > > ? > > Yeah, I tried that too. The load succeeds but then the methods fail: > Should work like this: > > irb(main):001:0> require 'flacinfo' > => true > irb(main):002:0> song = FlacInfo.new("dread.flac") > => # offset=46) (VORBIS_COMMENT size=235 offset=536) (PADDING size=4065 > offset=775)> > irb(main):003:0> song.print_tags > ARTIST: 10cc > TRACKNUMBER: 01 > DATE: 1978 > vendor_tag: reference libFLAC 1.1.2 20050205 > ALBUM: Bloody Tourists > TOTALTRACKS: 13 > TITLE: Dreadlock Holiday > YEAR: 1978 > GENRE: Rock > offset: 536 > block_size: 235 > COMMENT: High Quality, EAC secure, Lossless flac > => nil > > But instead I get: > > irb(main):001:0> require 'rubygems' > => true > irb(main):002:0> gem 'flacinfo-rb' > => true > irb(main):003:0> song = FlacInfo.new("dread.flac") > NameError: uninitialized constant FlacInfo > from (irb):3 > > require 'flacinfo' (or 'flacinfo-rb') after the gem line. 'gem' just activates the gem, you still need to require it. -- Chris Carter concentrationstudios.com brynmawrcs.com