EditTemplate
- Allow the creation of skeleton projects Bug #480893
- How to easily edit a template ? Question #124670
Using quickly is easy but editing templates is difficult.
Use cases
I wrote an app last year. This year I wanted to write another. Some of the techniques I used last year I want to reuse and are of widespread utility. So I quickly quickly a new template and copied parts of app into new template. I proposed it for merging but during "Needs Fixing" cycles I inadvertently overwrote "camel_case_name" with app name (twice).
I was writing a project but accidently used an existing command name. There is no easy way to fix the application name in quickly.
ubuntu-application template is crying out for simple boilerplate addition, e.g toolbar with buttons to match menu, but community hasn't supplied it, perhaps it is too tedious to do.
Quote "probably better to develop the template in your ~/quickly-templates/ directory rather than as a project and schlepping things in and out like I did" http://bluesock.org/~willg/blog/dev/templates_with_quickly.html
This also happened to me probably because there is no obvious toolchain for editing templates.
Proposed Template Editing Commands
Projects have these very useful editing commands
- quickly create template project
- quickly edit (works from current folder)
- quickly design (works from current folder)
- quickly run (works from current folder)
I think editing commands for templates should be
- quickly quickly old_template template
- quickly edit template
- quickly design template
- quickly run template
quickly quickly allows you to clone an existing template: edit, design and run do not exists yet. However the names could be confusing so could be easily renamed. For instance quickly quickly could have been quickly clone.
These can be implemented as builtins. When in a project root folder the template commands (edit design run) will override the builtins. However the builtin commands will need to hook functions from the template commands. For example design needs to be implemented as glade for ubuntu and something like Kde designer (?) for kubuntu so it cannot be completely builtin.
It looks like design searches from the current folder to find .ui files. As a builtin design will cd to template root then call template design function. Edit is similar but searches for .py files.
Run -t template can be implemented something like (pseudocode)
cd ~/.local/cache/quickly/temp/build make clean quickly create -t template_name foobar make clean
These builtin commands will need to check that the template is writeable, the templates delivered with quickly are owned by root.
Alternative Approach - Rewind existing project as a new template
rewind discovers old_template from .quickly then call quickly quickly old_template new_template
rewind then needs to write parts of each project file into new_template to do this rewind needs some 3 pieces of information
- project file name
- template file name
- diff between template and created project (mostly module and class names)
this information can be written by create into a metadata file.
Rewind will patch some metadata to each file This should work for simple project edits but eventually it is likely that patch will fail to extract a template. If opportunistic programmers come to depend on rewind this failure will seem like falling off a cliff.
Quickly/EditTemplate (last edited 2010-09-18 09:15:27 by 109)