-
Notifications
You must be signed in to change notification settings - Fork 5
Client Downloading Interaction
#This is an outline of the process which the client will use when requested by the user to rice a given program.
##Certain files will be referenced in this document that will be listed and defined here:
- client - the riceDB program being run by the user
- rice - All of the configuration files used by a program
- config - a single configuration file used by a program
- index.json - a primary index file which contains a list of all available software in the riceDB as well as information about the vanilla configuration files that the program needs.
- sysinfo.json - a json which contains information about extra configs that a rice has which are not default and the locations they should be moved to, e.g. if a config for i3 referred to a wallpaper.png that wallpaper.png would be in sysinfo.json
- .[program]-rice - a folder created in a users home(~/) directory that contains all active and nonactive rices. All nonactive folders will be named the rices name, and contain a sysinfo.json and and all configuration files. The active folder will only contain a sysinfo.json. In addition to these folders there will be a file called active which will contain the name of the folder which is active.
##There are two way in which the client will be called:
- Using a program name, e.g. rice i3
- Using a program name and a specific config name, e.g. rice i3 logos-default
###In the first process the client will: Run search.py: this will query a file called index.json. Index.json contains a list of all programs for which the riceDB has configuration files for. Search.py will indicate whether or not the specified program is contained within the database. If it is not, it will try to return a list of close matches which will be displayed to the user. If it is, it will show a name/description of the program the user specified and let them choose Y/N. Once the user selects Yes, the program will then display a list of all available rices for that software, sorted by popularity or some factor that is tbd. The user may then select the rice he wants.
###In the second process the client will: Run search.py: first index.json will be queried using the program name to verify that it is a valid program. If it is not, it will report an error to the user and give them a list of possible software titles they may have meant to use. If it is valid, it will then look in a file known as index-[program name].json. This file contains a list of all rices for the program in its name and info about each rice. search.py will look through this sub-index and try to find the specified rice. It will return it and ask for confirmation if a rice exists which has the name the user specified, or try to return near matches in case the user had a typo in his query.
-
Once a rice has been selected by the user, the client will look at the json entry for that rice, which will contain a github repo link. The client will create a temporary folder into which the github directory is downloaded. Each github repo will contain 3 primary pieces of information: the actual configuration files, a md5 checksum, and a sysinfo.json file. The md5 checksum will be used to verify the integrity of the sysinfo.json and configuration files. The sysinfo.json file will be a json which contains entries in the format "file name":"system location". System location will refer to the area on the computer into which each file(given by file name) must be moved to. The client will then examine each system location for existing configs. It will then check if these existing configs are part of a riceDB installed config, or are the default/a user installed config. In the event of the latter, the client will create a folder in .[program]-rice with that will contain the current configs. All default configs specified in index.json will be moved to this folder, and the user will be asked to specify any additional configs to be moved in. A sysinfo.json will be added to the folder as well as these additional configs, and the sysinfo.json will contain information about those additional configs. In the former case, the client will look through the .[program]-rice for the folder specified in active, read that folder's sysinfo.json and move all files/folders defined in that sysinfo.json to that folder as well as all configs defined by index.json.
-
Once the currently installed configuration has been moved into the .[program]-rice folder, the client will examine the index.json and the sysinfo.json for that program and move files into their respective locations. It will then create a new folder in .[program]-rice with the given name of the rice and move the sysinfo.json file into that folder. It will also change the 'active' file in the .[program]-rice folder to the currently used rice name.