This project is archived and is in readonly mode.

#3081 ✓invalid
Steve

Make template path available in TemplateRunner

Reported by Steve | August 20th, 2009 @ 08:37 AM

Currently TemplateRunner only sets an instance variable for @root, giving the path to the rails app being created. It would be nice if the template variable was also exposed as an instance variable. This way in the event that you have some static resources that you want to put into your new app, they're easy to get to.

Right now the only way to get to that information is through $*, and best guess that you have the right index.

Comments and changes to this ticket

  • CancelProfileIsBroken

    CancelProfileIsBroken August 20th, 2009 @ 11:04 AM

    • State changed from “new” to “invalid”

    You can just refer to the template within your template as template (wow, clear as mud)...here's a bit of code where I grab a config file that's sitting in the same folder as the template:

    template_path = File.expand_path(File.dirname(template), File.join(root,'..'))
    config_file = File.join(template_path, "config.yml")
    

    Somewhat convoluted to ensure it works whether the templaet is specified by relative or absolute path when it's invoked.

    If this isn't what you're after, feel free to reopen with more information.

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>

People watching this ticket

Pages