Hi All, I have installed two different versions of a gem (1.0.0 and 1.0.4) My code : =============================== require 'test' , '>= 1.3.6' =============================== it gives me an error rake aborted! uninitialized constant Test but i already installed this version of gem Can any one help me ......
on 2012-12-05 10:27
on 2012-12-05 11:59
On Dec 5, 2012, at 01:27 , Mallikarjuna Yaddala <lists@ruby-forum.com> wrote: > Hi All, > > I have installed two different versions of a gem (1.0.0 and 1.0.4) > > > My code : > > =============================== > > require 'test' , '>= 1.3.6' require doesn't take 2 args (as it doesn't makes sense to be able to require across 2+ versions of the same gem). From the rdoc: % ri require ... === Implementation from Kernel ------------------------------------------------------------------------------ require(string) => true or false ... You want to specify that at the gem level using #gem: % ri gem ... (from gem rubygems-1.8.24) === Implementation from Kernel ------------------------------------------------------------------------------ gem(gem_name, *requirements) ... So you want: gem "test", ">= 1.3.6" # assuming the gem name is actually "test" require "test" # assuming there is a file "test.rb" in the gem BUT... also note that your version specifier above will NOT match either version you have installed.
on 2012-12-05 13:28
Ryan Davis wrote in post #1087894: > On Dec 5, 2012, at 01:27 , Mallikarjuna Yaddala <lists@ruby-forum.com> > wrote: > >> Hi All, >> >> I have installed two different versions of a gem (1.0.0 and 1.0.4) >> >> >> My code : >> >> =============================== >> >> require 'test' , '>= 1.3.6' > > require doesn't take 2 args (as it doesn't makes sense to be able to > require across 2+ versions of the same gem). From the rdoc: > > % ri require > ... > === Implementation from Kernel > ------------------------------------------------------------------------------ > require(string) => true or false > ... > > You want to specify that at the gem level using #gem: > > % ri gem > ... > (from gem rubygems-1.8.24) > === Implementation from Kernel > ------------------------------------------------------------------------------ > gem(gem_name, *requirements) > ... > > So you want: > > gem "test", ">= 1.3.6" # assuming the gem name is actually "test" > require "test" # assuming there is a file "test.rb" in the gem > > BUT... also note that your version specifier above will NOT match either > version you have installed. where i need to add these lines gem "test", ">= 1.3.6" require "test" in rakefile or Gemfile ?
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.