JakobGM / astrality

Astrality - A modular and dynamic configuration file manager
https://astrality.readthedocs.io
MIT License
98 stars 3 forks source link

Add template filter functionality #20

Closed JakobGM closed 6 years ago

JakobGM commented 6 years ago

It is now possible to:

) Filter which files are considered templates, and therefore should be compiled ) Rename template target names based on regex capture group *) Specify either 'symlink', 'copy', or 'ignore' when handling files that are not considered to be templates

I went with the templates and non_templates config syntax.

Fixes #10.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 359


Changes Missing Coverage Covered Lines Changed/Added Lines %
astrality/module.py 60 61 98.36%
astrality/actions.py 137 145 94.48%
<!-- Total: 616 625 98.56% -->
Totals Coverage Status
Change from base Build 337: 0.2%
Covered Lines: 3677
Relevant Lines: 3761

💛 - Coveralls
JakobGM commented 6 years ago

This PR also contains a fix for paths that were considered relative although expanding environment variables made it absolute. Such as $XDG_CONFIG_HOME/something. This has been fixed by expanding env vars before checking if the path is absolute or not.

JakobGM commented 6 years ago

I have now implemented all the features we have discussed above, and think we should merge it into master.

The new actions have been implemented in seperate Action classes, and I am relatively satisfied with that part of the code. But the dispatch of these actions in the form of ModuleManager->Module->(Copy/Symlink/Stow)Action resulted in a lot of duplicate application and test code.

It should probably be refactored at some point, perhaps by using getattr a lot more, instead of defining seperate symlink/copy/stow/... methods on both Module and ModuleManager. That way we could delete a lot of duplicate code.

But for now it should suffice, I am tired of this issue :persevere: