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.
66833e1199afa68de454791314e7a220?d=identicon&s=25 Severen R. (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
5989a003d261c0abe6d08570ff6cc3d0?d=identicon&s=25 7stud -. (7stud)
on 2014-08-13 20:13
This topic is locked and can not be replied to.