Skip to content

Commit

Permalink
Merge 72ecf0e into b14140d
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-coutinho committed Dec 26, 2020
2 parents b14140d + 72ecf0e commit 82b0fee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion shallow_backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,19 @@ def run_cmd_if_no_dry_run(command, dest, dry_run) -> int:
if not dry_run:
overwrite_dir_prompt_if_needed(backup_path, skip)

for mgr in ["brew", "brew cask", "gem"]:
for mgr in ["brew", "brew cask"]:
# deal with package managers that have spaces in them.
print_pkg_mgr_backup(mgr)
command = f"{mgr} list"
dest = f"{backup_path}/{mgr.replace(' ', '-')}_list.txt"
run_cmd_if_no_dry_run(command, dest, dry_run)

# ruby
print_pkg_mgr_backup("gem")
command = "gem list | tail -n+1 | sed 's/(/--version /' | sed 's/)//'"
dest = f"{backup_path}/gem_list.txt"
run_cmd_if_no_dry_run(command, dest, dry_run)

# cargo
print_pkg_mgr_backup("cargo")
command = r"cargo install --list | grep '^\w.*:$' | sed -E 's/ v(.*):$/ --version \1/'"
Expand Down
4 changes: 3 additions & 1 deletion shallow_backup/reinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def run_cmd_if_no_dry_run(command, dry_run) -> int:
elif pm == "macports":
print_red_bold("WARNING: Macports reinstallation is not supported.")
elif pm == "gem":
print_red_bold("WARNING: Gem reinstallation is not supported.")
print_pkg_mgr_reinstall(pm)
cmd = f"cat {packages_path}/gem_list.txt | xargs -L 1 gem install --no-ri --no-rdoc"
run_cmd_if_no_dry_run(cmd, dry_run)
elif pm == "cargo":
print_pkg_mgr_reinstall(pm)
cmd = f"cat {packages_path}/cargo_list.txt | xargs -L 1 cargo install"
Expand Down

0 comments on commit 82b0fee

Please sign in to comment.