Skip to content

Commit

Permalink
Merge pull request #51 from alichtman/cargo_backup
Browse files Browse the repository at this point in the history
Add cargo backup
  • Loading branch information
alichtman authored May 30, 2018
2 parents 53df3da + 38d5be7 commit a9afea9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shallow_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,24 @@ def backup_packages(backup_path):

make_dir_warn_overwrite(backup_path)

package_managers = [
std_backup_package_managers = [
"brew",
"brew cask",
"gem"
]

for mgr in package_managers:
for mgr in std_backup_package_managers:
# deal with package managers that have spaces in them.
print(Fore.BLUE + "Backing up {} package list...".format(mgr) + Style.RESET_ALL)
command = "{0} list > {1}/{2}_list.txt".format(mgr, backup_path, mgr.replace(" ", "-"))
sp.run(command, shell=True, stdout=sp.PIPE)

# cargo
print(Fore.BLUE + "Backing up cargo package list..." + Style.RESET_ALL)
sp.run("ls {0}/.cargo/bin/ > {1}/cargo_list.txt".format(os.path.expanduser('~'), backup_path), shell=True, stdout=sp.PIPE)

# pip
print(Fore.BLUE + "Backing up {} package list...".format(mgr) + Style.RESET_ALL)
print(Fore.BLUE + "Backing up pip package list..." + Style.RESET_ALL)
sp.run("pip list --format=freeze > {}/pip_list.txt".format(backup_path), shell=True, stdout=sp.PIPE)

# npm
Expand Down

0 comments on commit a9afea9

Please sign in to comment.