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

Add delete support #167

Closed
jayvdb opened this issue Jan 16, 2019 · 2 comments
Closed

Add delete support #167

jayvdb opened this issue Jan 16, 2019 · 2 comments
Milestone

Comments

@jayvdb
Copy link
Member

jayvdb commented Jan 16, 2019

As a repository manager, renaming files is a fairly common requirement.

Currently the name of a target file can be changed, but the old filename isnt scheduled for deletion at the same time.

It may seem obvious that the old file needs to be deleted, especially when the template writer and template users (repo managers) are the same people, but newbies dont learn 'obvious' without clues, and a central configuration management should be able to automatically manage updated to a large number of managed projects which have different teams/repo managers.

The new-file template rule and the old-file delete rule should be together in the same section of the mobanfile. i.e. under targets:

Having learnt from copy: which I think should be a plugin per #165 , I believe delete should also be a plugin. It should be a core plugin, as it satisfies a core requirement of moban. It really should be a plugin, because people should be able to customise moban with plugins which can perform deletions in a way that the moban engine understands.

The easiest syntax would be:

targets:
  - foo:  # implicit empty/null/etc

However that allows unintended deletes to occur very easily.

Much better would be to require an explicit datatype, such as false

targets:
  - foo: false  # explicit delete

If yaml datatype extensions in #165 are implemented, the following would also be possible

targets:
  - !delete foo  # explicit delete
@jayvdb
Copy link
Member Author

jayvdb commented Jan 16, 2019

Another approach is to handle renames more natively, such as:

targets:
  - output: foo
    template: bar/foo.jj2
    removed_output_names: baz  # will be deleted if present

A real delete could then be still achieved as

targets:
  - output:  # doesnt matter that this is empty/false/etc, as this key is only to ensure datatype is mapping
    removed_output_names: baz

Then other types of deletes can be designed when requirements are clearly defined and the long multi-line syntax is too cumbersome.

@jayvdb jayvdb added this to the 0.5.0 milestone Jan 24, 2019
@jayvdb
Copy link
Member Author

jayvdb commented Jan 24, 2019

Moved to milestone 0.5 , so we have the 'copy' changes released before starting on delete.

chfw added a commit that referenced this issue May 21, 2020
@chfw chfw closed this as completed in dec192f May 21, 2020
@chfw chfw mentioned this issue May 21, 2020
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

No branches or pull requests

1 participant