InfiniteGlass icon indicating copy to clipboard operation
InfiniteGlass copied to clipboard

Upgrading InfiniteGlass and user configuration

Open IanTrudel opened this issue 5 years ago • 8 comments

Each time there are changes that affect ~/.config/glass files, I'm ending up having to reedit all the previous customization. Would there be a way to easily migrate configuration files when changes are made?

IanTrudel avatar Mar 06 '20 16:03 IanTrudel

Hm, this is a tough one, as it requires some kind of merge script... As a hack you could make ~/.config/glass a git repo, commit all the original files, then commit your changes. To upgrade, you'd check out the previous original version as a new branch, remove the files so that new ones appear, commit, change back to master and merge your new branch... a bit clumsy, but should work fine...

redhog avatar Mar 06 '20 17:03 redhog

Does Python have anything to do json schema migration? By the way, this is not a priority. Just filling issues as they come.

IanTrudel avatar Mar 06 '20 17:03 IanTrudel

No idea. Also, I haven't written a json schema for any of the files... and... technically they're yaml. I only use the json subset of yaml, except for comments (json doesn't have comments, and I wanted the config files to have doc comments)...

redhog avatar Mar 06 '20 17:03 redhog

The next big idea would be to use SQLite (already used in InfiniteGlass, right?) to handle all configuration files.

  • All configurable properties and their default values in a database.
  • Every change will be handled by migrations.
  • Converting in and out to YAML files.

This will allow to retain user customization between updates. The migration will know what to do with the existing data. We could also integrate default templates (Scandinavian, Canadian and Russian for example) where it will be possible to define themes, button ordering, default settings, etc.

IanTrudel avatar Apr 11 '20 01:04 IanTrudel

Perhaps some template system + a migration directory with Python scripts. Each YAML would have a version and the scripts would start from there and update one after another version up to the last version.

https://stackoverflow.com/questions/28557626/how-to-update-yaml-file-using-python

IanTrudel avatar Apr 11 '20 10:04 IanTrudel

JSON Patch https://pypi.org/project/jsonpatch/ https://tools.ietf.org/html/draft-ietf-appsawg-json-patch-02

JSON Diff https://github.com/fzumstein/jsondiff https://pypi.org/project/deepdiff/ https://pypi.org/project/json-diff/

IanTrudel avatar Apr 11 '20 15:04 IanTrudel

So none of the patching libs above does diff, and none of the diff libs above does patching, and none of the first group understands a format generated by the second group :(

redhog avatar Apr 11 '20 21:04 redhog

Most unfortunately. I copy relevant information from our conversations for references. We at least made some progress as far as the appropriate approach.

IanTrudel avatar Apr 12 '20 03:04 IanTrudel