applicationsonline / librarian

Librarian - A Framework for Bundlers. Librarian-Chef is at: https://github.com/applicationsonline/librarian-chef.
http://applicationsonline.com/
MIT License
655 stars 71 forks source link

Manage current directory of process when running a specfile #169

Closed afex closed 9 years ago

afex commented 10 years ago

When you have a nested dependency containing its own specfile, the file is eval'd using the process's current directory instead of the directory of the specfile. This causes file reads which are done relative to the specfile to run in the wrong directory.

Specifically: a librarian-puppet project having a git dependency which also contains a Puppetfile in its root. This Puppetfile uses the modulefile dsl, causing a File.read('Modulefile') in the current directory. This read needs to happen in the appropriate subfolder in .tmp/librarian/cache.

carlossg commented 10 years ago

I just found this error and fixed it in librarian-puppet by exposing the specfile variable https://github.com/rodjek/librarian-puppet/blob/947974f52047086541f9eb4e22d9560203013b1b/lib/librarian/puppet/dsl.rb#L36

I can provide a PR if that solution looks good