Skip to content

Client Downloading Interaction

Ezra edited this page Mar 18, 2015 · 13 revisions

##Outline of the process which the client will use when requested by the user to rice a given program.

###Defenition of Terms:

  • 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] - a folder created in the ~/.riceDB/ 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 ways in which the client will be called:

  • Using a program name,

    e.g. rice i3 A number of screenshots will be brought up for i3. The user can browse for themes for his i3. This may be sorted by downloads.

  • Using a program name and a specific config name,

    e.g. rice i3 logos-default The client will install the theme "logos-default" for i3.

  1. 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.

  2. 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 as a zip and hashed. This hash will be sent to the server for validation purposes, and if a client's hash is ever different from the server's hash the server will re-download the corresponding package, search the metadata for an update and update the index.json. Each github repo will contain 3 primary pieces of information: the actual configuration files and a sysinfo.json file. 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] 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] 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.

  3. Once the currently installed configuration has been moved into the [program] 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] folder to the currently used rice name.

Clone this wiki locally