-
Notifications
You must be signed in to change notification settings - Fork 342
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
[Invoke task] New module boilerplate #67
Conversation
958ea16
to
68625e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-word module names are not supported, right?
tasks/app/boilerplates.py
Outdated
'%s/%s.py' % (module_path, template_file) | ||
) | ||
|
||
log.info("Module `%s` has been created." % name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use comma instead of percent (%) in logging.
tasks/app/boilerplates.py
Outdated
'resources', | ||
'schemas', | ||
): | ||
template = env.get_template('%s.txt' % template_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s use .py.template extension instead of .txt
68625e8
to
da4e4fc
Compare
@frol Right, only if you separate words with dash or low-dash. |
Using dashes or underscores in the name will break class names... |
@frol, I've missed that case. How you prefer to handle it? |
First of all, I would use more specific template variables instead of inline modification inside the templates, i.e. |
OK, I'll update my PR. |
da4e4fc
to
5b1402c
Compare
@frol, I've updated my PR, please review. |
5b1402c
to
1f7cf42
Compare
1f7cf42
to
f58590d
Compare
f58590d
to
0d277c4
Compare
Add `boilerplates` task namespace with `crud_module` task to create simple CRUD module.
0d277c4
to
0e47488
Compare
boilerplates
task namespace withcrud_module
task to create simple CRUD module.Usage is
invoke app.boilerplates --name=articles --singular=article
Templates for a new module are in
tasks/app/boilerplates_templates/crud_module
in txt format. They are rendering withJinja2
, it allows us to avoid additional dependencies.After CRUD module is created a little reminder appears with info about adding the module to
ENABLED_MODULES
and where to find the sources.