ddollar/foreman — pull request #129 by fnichol (2012-01-16 02:31:21+00:00)
Title: Expand template path under user's home directory (foreman export).

Hi David, love this library but I ran into a use case that wasn't quite behaving correctly. Unfortunately, the FakeFS gem is helping to cloak this problem so the specs continue to pass in 1.9.3/1.9.2/1.8.7 with or without the spec code updates. Here's the crib notes:

* File.join won't expand `~` into `ENV['HOME']`
(http://ruby-doc.org/core-1.9.3/File.html#method-c-expand_path)
* The FakeFS File.exists? implementation calls [FileSystem#find](https://github.com/defunkt/fakefs/blob/master/lib/fakefs/file_system.rb#L22-33)
containing a call to [FileSystem#normalize_path](https://github.com/defunkt/fakefs/blob/master/lib/fakefs/file_system.rb#L91-98) which expands the
path variable passed in
* The file system mocking library sets up a false expectation that `~`
will be expanded in the #export_template method and consequently the
production code can't use the template directory
* To guard against future regressions such as fixes/updates to FakeFS or
using an alternate file system mocking library, the specs were updated
to explicitly set `ENV['HOME']`

Thanks again, and kudos on your quick and frequent releases!