Forum: Ruby Find File No Matter Where Script Has Been Executed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2f034754f0c731c93e5721deeee757b2?d=identicon&s=25 Severen Redwood (insanity133)
on 2014-08-13 11:09
I have the following code:

template = { gemfile:
ERB.new(File.read('lib/projectionist/templates/ruby/Gemfile.erb')),\
                     rakefile:
ERB.new(File.read('lib/projectionist/templates/ruby/Rakefile.erb')),\
                     gemspec:
ERB.new(File.read('lib/projectionist/templates/ruby/Gemspec.erb')) }

This works great when I execute it from the base project directory,
however when I run my RSpec specs or run it from another directory or as
a RubyGem it cannot find the files. How would I write this code so that
it would always find the file no matter what? (use __FILE__ in
conjuction with something else...?)

Here is an upload of my entire project: http://tempsend.com/9CEC93CDCD
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2014-08-13 20:13
This topic is locked and can not be replied to.