Cudatext: proposal for new "Backup Settings" plugin

Created on 18 May 2020  路  10Comments  路  Source: Alexey-T/CudaText

(it is for future)
plugin "Backup Settings"
plugin must give at least 2 commands

  • Backup settings...
  • Restore settings...
    later these commands (or new commands) can ask for online login/password at some site and save/restore there.

command "backup" should show dialog to choose what elements to backup:

  • main settings (user config, lexer-specific configs, etc)
  • additional opt for "history files" (often it's not needed to backup histories), unchecked by default
  • settings of preinstalled plugins
  • settings of all other plugins
  • user-installed plugins
  • data files (themes/ lexers/ autocompletes/ snippets/ etc)
  • additional files in root dir, on Windows
  • session files (often it's not needed to backup them, they are not portable), unchecked by default

will be good if command "restore" will show the same dialog, to choose what elements to restore from ZIP. it should disable checkboxes for elements, which are absent in zip.


cmd "backup settings" must ask for a folder path, and save zip file there.
zip filename must be "CudaText_settings_YYYY-MM-DD-HH-MM-SS.zip".
zip contents:

1) dir "settings" - entire dir "settings" from Cud (with nested dirs too, e.g. ConfigToolbar makes nested dirs with png icons)

2) dir "data" - not entire dir "data", all except preinstalled dirs/files.
if "data/nnnnn" dir is preinstalled in Cud but user has additional dirs/files in it (snippets, lexers etc) then save only user's new dirs/files.

3) dir "py" - not all subdirs.
3a) if some cuda_nnn plugin is available in Addon Manager, save to zip only EMPTY dir py/cuda_nnn (empty dir means that plugin will be reinstalled from addons)
check available plugins in Addon Manager in https://github.com/Alexey-T/CudaText-registry
3b) if dir cuda_nnn is not in Addon Manager, backup entire dir with all files/subdirs (except *.pyc python caches)
3c) "py" can have not only "cuda_" dirs but additional user Python libs, save them

4) on Windows, backup custom user scripts/tools/PythonEngines, so check dir of Cud and find there all non-preinstalled files/dirs, and save them to "win_root" dir in zip.
later restore this "win_root" dir only on Windows.


cmd "restore settings" asks for a zip filename and restores it. and restarts Cud.
check that zip filename begins with "CudaText_settings_".

on restoring, what to do with current settings (plugins/lexers not from AddonManager)?
move them all to a temp-dir on local PC, so bad restoring will not loose user data.
so user's ftp passwords will not be lost on bad restoring.
after restoring, show to user that old data were moved to ...


plugin should have the separate Py file (std_files.py) which lists (in dict?) all "preinstalled elements" of Cud. it must know what elements are preinstalled.

plugins

All 10 comments

@iRamSoft @dinkumoil
@jairo-martinez
if you are interested to write it, let me know.

@Alexey-T, plugin backing only settings or data / themes / plugins also?

all settings and data/themes/plugins.

auto on start or manually?

It is my dream - plugin to pack ALL in one place (Win) and unpack in other (Lin).
"All" need to include (with choosing!): core settings, themes, histories, session, installed plugins, ...

@iRamSoft plugin is called manually of course. auto update is bad here.

@kvichans edited the 1st post, okay wish.

Suggestion: To avoid the need for frequent plugin updates because of added/removed standard folders/files of _CudaText_, every version should provide a list of these folders/files. This could be a JSON document providing an array structure containing the folder/file names as array elements. A folder would be an array itself.

plugin should have the separate Py file (std_files.py) which lists (in dict?) all "preinstalled elements" of Cud. it must know what elements are preinstalled.

I meant that _CudaText_ itself should provide a file with a list of its standard files/folders. This file could be generated automatically by a script during deployment process and put into the ZIP file.

If the plugin has to provide this file, the plugin has to be updated whenever files/folders have been added to/removed from a new version of _CudatText_. Thus it would be easy to loose sync.

IMO it is okay to update the plugin, even often, like all plugins.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xcme picture xcme  路  5Comments

JairoMartinezA picture JairoMartinezA  路  7Comments

charliewales picture charliewales  路  4Comments

JairoMartinezA picture JairoMartinezA  路  7Comments

Alexey-T picture Alexey-T  路  5Comments