Dancer
Dancer copied to clipboard
App scaffolding templates
Here are some changes to the dancer script to allow for an "application template" directory. It's not well tested yet, but I wanted some feedback.
It adds the --template/-t options such that you can use "application templates" to create new apps. The application templates are subdirectories of ~/.dancer_templates and they should contain everything you'd want in a dancer app.
The use-case is if you're always building dancer apps that use blueprint.css or prototype instead of jquery or come pre-packaged with some other functionality, you build a directory in ~/.dancer_templates that contains all of the necessary files and use "dancer -t my-template -a MyApp" to create new apps.
Anyway, feedback welcome!
Looks like a good feature.
The only slight drawback is that this will need to be ported to gnusosa's Dancer::Script refactoring (which reminds me, I need to find out how close we are to merging that in, it looked good)
Where is this Dancer::Script refactoring located?
On Thursday 29 September 2011 19:40:07 Jonathan Scott Duff wrote:
Where is this Dancer::Script refactoring located?
Over on @gnusosa's fork: https://github.com/gnusosa/Dancer
Released a new dev version. Once I release it as stable, I'm gonna merge @gnusosa's work.
@xsawyerx, can I poke you to merge @gnusosa's work? Please? With sugar on top?
@ambs let's see how easy this is...
@ambs, @bigpresh, @perlpilot - I've put @gnusosa's work on the branch "refactoring/script". If you could resubmit this pull request based on that branch, and adapt it to that code, I would greatly appreciate it. :)
I've made it such that
my $template = '<% foo %>';
template \$template, { foo => 42 };
works now.
I was trying to test some simple view code and didn't need or want to generate .tt
files. I noticed that the underlying template code supported passing a scalar ref, but then your hooks won't run. The above change allows for the "full stack" template processing to happen and for the templates to be specified inline.
This is useful for extremely simple Dancer apps and, what I want it for, testing plugins that add functionality to templates.
@ambs, @bigpresh, @perlpilot, @gnusosa @xsawyerx : where are we with this PR ? it seems to me that it can be merged alongside with gnusosa stuff ?
poking here. Dams++ : can we have a brief on that one?
Thanks.