[rspec-users] cucumber rake file question
aslak.hellesoy at gmail.com
Thu Jan 15 12:23:03 EST 2009
On Thu, Jan 15, 2009 at 4:16 PM, Pat Maddox <pergesu at gmail.com> wrote:
> On Thu, Jan 15, 2009 at 4:07 AM, Tom Cloyd <tomcloyd at comcast.net> wrote:
> > Real beginner question here. I don't really know rake, so I'm stumbling.
> > As I set a dir to hold my feature files, etc., I'm simply copying the
> > structure I see in
> > /usr/lib/ruby/gems/1.8/gems/cucumber-0.1.13/examples/i18n/en/
> > I know we need a Rake file ME little dir tree, but I don't think I can
> > copy the one in the examples tree - or rather, I think I have to alter
> > first line:
> > $:.unshift(File.dirname(__FILE__) + '/../../../lib')
This is a very, very common idiom in Ruby.
$: is a global variable. It's an alias for $LOAD_PATH. This is an Array of
directories where Ruby scans for libraries when you do a require. Similar to
File.dirname(__FILE__) returns the directory of the current script
unshift puts an element at position 0 in an Array.
> > I don't know if this is bash or some ruby thing I haven't figured out,
> > mostly I don't know what to do with the '/../../../lib') part. It looks
> > its trying to locate the source dir, but if so, why not just specify +
> > 'lib'...? After staring at it a bit, I have to admit I don't grasp what's
> > going on.
> > Can someone clue me in?
> It has to find the source dir relative to that file. '/../../../lib'
> means to go back up the dir structure three levels and then look for
> lib there.
When you have cucumber as a gem you can delete that line.
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users