From: Mallikarjuna Yaddala Date: 2012-12-05T21:28:31+09:00 Subject: Re: how to require specific version of gem in my project Ryan Davis wrote in post #1087894: > On Dec 5, 2012, at 01:27 , Mallikarjuna Yaddala > 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 ? -- Posted via http://www.ruby-forum.com/.