Skip to content
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

Merged
merged 1 commit into from
Aug 31, 2017

Conversation

khorolets
Copy link
Collaborator

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 with Jinja2, 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.

@khorolets khorolets requested a review from frol August 29, 2017 17:18
@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from 958ea16 to 68625e8 Compare August 29, 2017 17:28
@coveralls
Copy link

coveralls commented Aug 29, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 958ea16 on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

Repository owner deleted a comment Aug 29, 2017
@coveralls
Copy link

coveralls commented Aug 29, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 68625e8 on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

Copy link
Owner

@frol frol left a 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?

'%s/%s.py' % (module_path, template_file)
)

log.info("Module `%s` has been created." % name)
Copy link
Owner

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.

'resources',
'schemas',
):
template = env.get_template('%s.txt' % template_file)
Copy link
Owner

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

@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from 68625e8 to da4e4fc Compare August 30, 2017 06:14
@khorolets
Copy link
Collaborator Author

@frol Right, only if you separate words with dash or low-dash.

@frol
Copy link
Owner

frol commented Aug 30, 2017

Using dashes or underscores in the name will break class names...

@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling da4e4fc on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

@khorolets
Copy link
Collaborator Author

@frol, I've missed that case. How you prefer to handle it?

@frol
Copy link
Owner

frol commented Aug 30, 2017

First of all, I would use more specific template variables instead of inline modification inside the templates, i.e. module_title, model_name. Module title is a capitalized module name with underscores replaced with spaces. Model name is a capitalized singular form of module name without spaces (I would replace _ with spaces -> capitalize -> drop spaces).

@khorolets
Copy link
Collaborator Author

OK, I'll update my PR.

@khorolets khorolets changed the title [Invoke task] New module boilerplate WIP: [Invoke task] New module boilerplate Aug 30, 2017
@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from da4e4fc to 5b1402c Compare August 30, 2017 16:48
@khorolets khorolets changed the title WIP: [Invoke task] New module boilerplate [Invoke task] New module boilerplate Aug 30, 2017
@khorolets
Copy link
Collaborator Author

@frol, I've updated my PR, please review.

@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 5b1402c on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from 5b1402c to 1f7cf42 Compare August 30, 2017 17:06
@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 1f7cf42 on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from 1f7cf42 to f58590d Compare August 30, 2017 17:23
@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling f58590d on khorolets:issue-63_new_module_boilerplate into 1067b18 on frol:master.

@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from f58590d to 0d277c4 Compare August 31, 2017 06:30
@coveralls
Copy link

coveralls commented Aug 31, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 0d277c4 on khorolets:issue-63_new_module_boilerplate into 9bb78ac on frol:master.

Add `boilerplates` task namespace with `crud_module` task to create simple CRUD module.
@khorolets khorolets force-pushed the issue-63_new_module_boilerplate branch from 0d277c4 to 0e47488 Compare August 31, 2017 11:48
@frol frol merged commit aeba534 into frol:master Aug 31, 2017
@coveralls
Copy link

coveralls commented Aug 31, 2017

Coverage Status

Coverage remained the same at 94.175% when pulling 0e47488 on khorolets:issue-63_new_module_boilerplate into 9bb78ac on frol:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants