-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Move copy to a plugin #165
Comments
Note I believe this should be a core plugin included in moban, as it is a really important feature for moban as a repository/project management tool. The reasons to keep it separate from the main engine are that
|
what about template_type -> action? action := 'template' | 'copy' | 'delete' | 'custom' 'custom' means if you supply your own action as a template, 'custom' will be enabled. and for existing mobanfiles, default action is: 'template'. |
Sounds good? |
The naming of I expected the internal One of the key reasons for moving copy to be an internal plugin, is that someone else should be able to create their own |
We might also deprecate the I would switch all my moban usages to put the copy rules in |
I am categorizing them in this way: action -> template And under we may expand the scope a bit further when there will be practical needs, for example:
|
I particularly like |
a post-action can be written to cope with #38 , hence no long this ticket will require any action from moban but a custom action on the moban user. moban just need to enable the mechanism. |
With .patch file, would there be a custom action to apply the patch to destination file? |
There is value in having only one list of I often want to do a copy of a template, and then use the template to generate another file. That is only possible if the If |
One linear process is less problematic, even if it is slower. Efficiencies can be found by using |
"!copy" is yaml schema datatypes, part of the normal yaml spec. More info second half of #127 (comment) |
I will take these conclusions:
|
one thing about the sequence: Under current implementation, there are no guarantee that: *.jj2 are processed earlier than *.handlebars. All jj2 files are processed sequentially as they appear in targets. When copy targets are mixed with templating targets, i.e.
it is 'cheaper' to implement if either of one is true:
|
I am sensing that this story will cause a period of in-stability of moban. The current architecture needs changing. |
Hence, I am considering releasing what we have done as 0.3.10. |
…newly installed packages are loaded, pypi-moban-pkg should be reloaded in the test, #165
@jayvdb , it seems that yaml tag syntax does not seem intuitive to non-developers. Here is the actual file:
Here is the code to read it:
And ruamel.yaml does not honor yaml 1.2
Do you have any more insights? |
another alternative is that moban parse '!copy source: destination' itself. but then this is not yaml syntax |
if moban does parse '!copy source:destination' itself, yaml module will intercept '!copy' before moban has it hand on it. So, this alternative route is a dead end.
here is the proof
|
@jayvdb, what about the alternative syntax:
|
waiting for further discussion. |
if we go ahead with the following syntax:
Here are the pros and cons: Positive: it simplifies moban code, because yaml parser gives me CopyTarget instances right a way. BUT this is only for yaml file. when moban reads .moban.json(or .moban.xls) in the future, this positive point is gone Negative:
|
After some serious thought, I would go for the following complete
The advantage are:
@jayvdb , any comments before proceeding? |
I disagree with "action: template" because it means copy isnt being implemented as a templaye type, but is given special status. The goal is to remove all architectual support that makes copy separate from other template types. Copy must be a template type, and its engine has no substitutions. |
Yep, you were right I was giving 'copy' a special status, in parallel to 'template'. and template types are under 'template'. However, I think I will accept your understand of 'copy', a special template engine, which does no substitutions and does simply content forwarding. Under this route, I would then agree with you on 'template_type' over my term 'action'. Hence, here is the targets syntax of my understanding:
|
@jayvdb, what do you think about the new targets syntax? |
Yup that looks great. |
…#62 with current restriction on template type as key. What will happen if template type as group key is unknown, atm it will be treated as jinja2 template type
* ✨ initial prototype * ✨ first working prototype that having relocated copy: into targets:. #165 * 📰 add missing unit test file * ♿ deprecate copy: key word. #165 * 📰 add the missing file * 🔨 code refactoring with TemplateTarget. replace all template tuples with TemplateTarget * 💚 install pypi-mobans-pkg for testing * 🔥 remove added test package: pypi-mobans-pkg * 🐛 when new plugins are installed, call the lml scanner again so that newly installed packages are loaded, pypi-moban-pkg should be reloaded in the test, #165 * 🔨 refactor constants.py * 🔥 remove previous fix for pypi-mobans-pkg not found. #165 * 📚 update copy action documentation and update integration tests 🔬 * 💄 minor update * 🚜 relocating files * 🚜 code refactoring on plugins.py * 🚜 flatten concentrated files * 🚜 fusing engines to template.py * 🚜 relocate copier to plugins * ✨ first working prototype: copy as template engine. #165 * 💚 fix unit test failure because of dependency * 🔨 code refactoring, support template a directory as it used to, template-folder/a.jj2 become dest/a without jj2 suffix. it also means: copy-folder/me.copy becomes dest-folder/me but no effect if copy-folder/you, as it dest-folder/you * 💚 try to fix broken unit tests in travis-ci * 🐛 fix the bug where repo is not found if it is newly installed. #165 * 🔨 respect default template type * 🔥 remove useless function as code evolves * 🔨 code refactor magic copy label * 🔬 test content forward engine, nickname copy engine. #165 * 🔥 remove useless report functions * 🔥 remove unreachable test codes and remove unused code * ✨ support group targets with template type, #165. And it is related to #62 with current restriction on template type as key. What will happen if template type as group key is unknown, atm it will be treated as jinja2 template type * ✨ force template type regardless of individual template types. #165 * 💚 fix broken tests * 🔬 more test coverage * 🚜 rename docs directory * 🔨 code refactoring * 🔨 code refactoring on targets * 🚜 re-organising file structures * 🚜 re-organize repo related functionality * 🚜 re-organize template target parsing functionality for moban file * 📚 update documentation * 📚 document 'copy' engine * 🔨 black all source code * 📚 update change log * 💄 update gitignore * 🔬 squeeze more test coverage from test code * :micrscope: more test coverage * 🔬 more tests on mobanfile targets * 🔨 relocate test files * 🔬 more tests on mobanfile targets * 🚜 relocate test file * 🔬 more tests * 📚 update documentation index * 📚 update change log
A new syntax was invented in #382 : Originally, '!delete' was proposed but was found no feasible. However, 'delete!' is deemed by yaml as pure string. |
copy
was a special key added to support non-templated files.I believe it should be moved to be a plugin, and a copy entry could be included in the normal
targets
key like:We can also make use of yaml datatypes to add more info to single row entries (also mentioned in the second half of #127 (comment)) like:
The text was updated successfully, but these errors were encountered: