How to get Rails.root in gem code

18 views
Skip to first unread message

R. Francky

unread,
Feb 14, 2012, 8:25:51 AM2/14/12
to rubyonra...@googlegroups.com
Hi all,

While coding a gem for Rails 3.x app stress testing, I faced a problem when I'm trying to load the test files.

Those files are located in "#{Rails.root}/test/performance/stress" directory.

My gem provides a command in MY_GEM_PATH/bin/my_gem_name which loads and execute those test files (from the Rails app directory).

How could the gem find the Rails.root path (and generally Rails environment) ?

Can someone help me find a common pattern for doing this ?

PS: I already looked at some gems code on github, among with capistrano, thin. But everyone seems to have his own recipe, and it's not really evident.

Thanks
Reply all
Reply to author
Forward
0 new messages