title: How to correctly include other project files from Ruby rakefile
body: <p>I am having trouble including other files to use within a Rake file. For example, I have a version.rb file that contains the version number that I want to refer to inside the rake file, also, I have a gem spec, specified in a .gemspec file, which I also want to use in the rake file. I cannot determine the correct path to reference both of these files. In fact, this is the ruby issue I'm having the most problem with (require statements/LOAD_PATH) and its quite frustrating; the issue is made worse by the fact that I'm not really sure how to troubleshoot these issues). I am currently avoiding package handles such as bundler, because I need to understand the basics first.</p>
  
  <p>See the attached pic of my code editor which shows project structure (standards gems structure, for a gem called Cart,which is just a dummy app to experiment with).</p>
  
  <p><img src="https://i.stack.imgur.com/rYKRM.png" alt="Cart project structure"></p>
  
  <p>So, my rakefile.rb is in the root folder of the project. When specifying a require, where should the path specified be relative to? Is it relative from the file you are requiring from or relative to lib folder or whatever else? I am running rake -T, to list the tasks and these are error messages I see:</p>
  
  <p>Trying to require version.rb file from within Rakefile.rb:</p>
  
  <pre><code>require 'cart/version'
  
  $ rake -T
  rake aborted!
  cannot load such file -- lib/cart/version
  /Users/Sancho/dev/ruby/student/cart/Rakefile.rb:5:in `&lt;top (required)&gt;'
  </code></pre>
  
  <hr>
  
  <pre><code>require 'lib/cart/version'
  
  $ rake -T
  rake aborted!
  cannot load such file -- lib/cart/version
  /Users/Sancho/dev/ruby/student/cart/Rakefile.rb:5:in `&lt;top (required)&gt;'
  (See full trace by running task with --trace)
  </code></pre>
  
  <p>Trying to require cart.gemspec from within Rakefile.rb:</p>
  
  <pre><code>require 'cart.gemspec'
  
  $ rake -T
  rake aborted!
  cannot load such file -- cart.gemspec
  /Users/Sancho/dev/ruby/student/cart/Rakefile.rb:6:in `&lt;top (required)&gt;'
  (See full trace by running task with --trace)
  </code></pre>
  
  <p>I am using Ruby version 2.0.0, rake version 0.9.6 (default versions that come with OSX Mavericks).</p>
  
  <p>(PS, my intention is to buy a Ruby IDE like RubyGems, but again, I'm holding off from doing that because I want to learn the basics first, I don't want to become reliant on an IDE fixing issues for my if I don't understand how to fix them from first principles).</p>
  
  <p>Thanks.</p>