Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruby support #292

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "ls {}".format(home_prefix(".cargo/bin/"))
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 sudo gem install --no-ri --no-rdoc"
alichtman marked this conversation as resolved.
Show resolved Hide resolved
run_cmd_if_no_dry_run(cmd, dry_run)
elif pm == "cargo":
print_red_bold("WARNING: Cargo reinstallation is not possible at the moment.\
\n -> https://github.com/rust-lang/cargo/issues/5593")
Expand Down