.direnv folder to the last release.
SCRIPT WILL ONLY WORK WHEN DIRECTORY ENVIRONMENT IS ACTIVATED
Clone last release of
Copy every files listed in variable
TO_UPGRADE into their corresponding
.direnv. Backup old version next to their new version (in case
something went wrong for the user.
Finally, delete clonned repo.
Available options to pass to the script are:
Force cloning method to use SSH protocole
git is installed.
- Error message if
gitis not installed.
- 1 if
gitis not installed
Clone the latest version of
direnv_template release to
- Information message to tell the user repos will be clonned.
- 1 if there is errro while cloning the repo.
Compute SHA1 of old and new file and upgrade file if needed
Compute SHA1 of old and new file. If they differs, which means new file differs from the old one, backup the old file and replace it with the new file.
|string, path of file to upgrade
- Information message if new file replace an old one
Method which recursively upgrade every old file to new one if needed
For every nodes (files and folders), if node is a folder, add list of files
within this folders into a temporary array which is then passed recursively
to this method.
If node is a file, call
upgrade_file method to upgrade this file if
|bash array, list of files and folder to upgrade
Main method that run the upgrade direnv process.
Ensure git is installed, if git is installed, clone the latest release of direnv_template and upgrade old files to their latest release version while making a backup of the old file.
|Possible options that can be passed to the script, see script docstring.
- Error message if clone of
- Information message to inform user of the advancement of the process.
- 1 if something went wrong during upgrade process.
- 0 if everything went right.