-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App scaffolding templates #670
base: devel
Are you sure you want to change the base?
Conversation
The appname is passed to several subs, but others rely on the globally scoped $name declared near the top of the program. So, make those others take $name as a parameter.
Allow for a template to be specified on the command line with the -t or --template option. These templates are subdirectories within the $HOME/.dancer_templates directory. The files in the template dir are copied to the application dir with some simple substitutions performed: filenames have APPNAME replaced by the actual application name, within files [[%% appname %%]] and [[%% appdir %%]] are replaced with the appropriate values for the Actual application. (The delimiters there are intentionally "big" so That they don't conflict with whatever template delimiters may be used by the templated files themselves (within views for instance)) Also, the file mode of the template files determines the file mode used for the corresponding file in the application directory.
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) |
* Change the template dir to be ~/.dancer/templates * If the argument to -t starts with a /, it's assumed to be the full path to a template directory
Where is this Dancer::Script refactoring located? |
On Thursday 29 September 2011 19:40:07 Jonathan Scott Duff wrote:
Over on @gnusosa's fork: https://github.com/gnusosa/Dancer |
Released a new dev version. |
@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. :) |
Useful for inline templates so that you don't necessarily need a directory structure or external files. Also, the underlying template implementation supports passing a scalar ref, but without the high-level implementation also supporting this, there's no way to do inline templates with hooks.
I've made it such that
works now. I was trying to test some simple view code and didn't need or want to generate 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. |
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!