This project is archived and is in readonly mode.
rails:template Rake task does not expand file paths
Reported by Stephen Celis | April 20th, 2009 @ 05:23 PM | in 2.x
Inconsistency:
rails -m ~/template.rb newapp
works. rake
rails:template LOCATION=~/template.rb
does not.
AppGenerator uses OptionParser, which automatically expands file paths, before sending them on to TemplateRunner.
The "rails:template" Rake task, however, instantiates a TemplateRunner directly, passing it an ENV variable.
While the tilde will expand with rails -m
, it will
not expand for the Rake task, and instead will error out.
I've attached a patch that will expand file paths in the Rake task (not unlike what OptionParser does), scoping out URIs with the same regex open-uri uses.
Comments and changes to this ticket
-
Pratik April 21st, 2009 @ 12:35 PM
- Title changed from [PATCH] rails:template Rake task does not expand file paths to rails:template Rake task does not expand file paths
-
Pratik April 21st, 2009 @ 05:26 PM
I tried rake rails:template LOCATION=~/template.rb and it works for me. Are you still facing this problem ?
-
Stephen Celis April 21st, 2009 @ 05:37 PM
Yep. I can reproduce it on rails/master on 1.8.6 and 1.8.7, OS X, RedHat, and Ubuntu. It all goes back to File.open:
>> File.open("~/real_file.rb") Errno::ENOENT: No such file or directory - ~/real_file.rb >> File.open(File.expand_path("~/real_file.rb")) => #<File:/Users/stephen/real_file.rb>
OptionParser runs expand_path, but the Rake task does not.
-
Pratik April 21st, 2009 @ 06:10 PM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>