diff --git a/README.md b/README.md index 0cc3b102..d29cd84e 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ By default, `shallow-backup` backs these up. 2. App Config Files * Atom + * VSCode * Sublime Text 2/3 * Terminal.app @@ -99,8 +100,10 @@ By default, `shallow-backup` backs these up. * `cargo` * `gem` * `pip` + * `pip3` * `npm` * `macports` + * `VSCode` Extensions * `Sublime Text 2/3` Packages * System Applications diff --git a/shallow_backup/backup.py b/shallow_backup/backup.py index 4b16f887..aeb8f394 100644 --- a/shallow_backup/backup.py +++ b/shallow_backup/backup.py @@ -116,6 +116,12 @@ def backup_packages(backup_path, skip=False): dest = "{}/pip_list.txt".format(backup_path) run_cmd_write_stdout(command, dest) + # pip3 + print_pkg_mgr_backup("pip3") + command = "pip3 list --format=freeze" + dest = "{}/pip3_list.txt".format(backup_path) + run_cmd_write_stdout(command, dest) + # npm print_pkg_mgr_backup("npm") command = "npm ls --global --parseable=true --depth=0" @@ -137,6 +143,12 @@ def backup_packages(backup_path, skip=False): dest = "{}/apm_list.txt".format(backup_path) run_cmd_write_stdout(command, dest) + # vscode extensions + print_pkg_mgr_backup("VSCode") + command = "code --list-extensions --show-versions" + dest = "{}/vscode_extensions_list.txt".format(backup_path) + run_cmd_write_stdout(command, dest) + # macports print_pkg_mgr_backup("macports") command = "port installed requested" diff --git a/shallow_backup/compatibility.py b/shallow_backup/compatibility.py index 38df975d..7d5da9eb 100644 --- a/shallow_backup/compatibility.py +++ b/shallow_backup/compatibility.py @@ -17,23 +17,35 @@ def get_config_paths(): if "darwin" == get_os_name(): sublime2_path = os.path.join(get_home(), "Library/Application Support/Sublime Text 2") sublime3_path = os.path.join(get_home(), "Library/Application Support/Sublime Text 3") + vscode_path_1 = os.path.join(get_home(), "Library/Application Support/Code/User/settings.json") + vscode_path_2 = os.path.join(get_home(), "Library/Application Support/Code/User/Snippets") + vscode_path_3 = os.path.join(get_home(), "Library/Application Support/Code/User/keybindings.json") atom_path = os.path.join(get_home(), ".atom") terminal_path = os.path.join(get_home(), "Library/Preferences/com.apple.Terminal.plist") return { sublime2_path: "sublime2", sublime3_path: "sublime3", + vscode_path_1: "vscode/settings", + vscode_path_2: "vscode/Snippets", + vscode_path_3: "vscode/keybindings", atom_path: "atom", terminal_path: "terminal_plist" } else: sublime2_path = "/.config/sublime-text-2" sublime3_path = "/.config/sublime-text-3" + vscode_path_1 = "/.config/Code/User/settings.json" + vscode_path_2 = "/.config/Code/User/Snippets" + vscode_path_3 = "/.config/Code/User/keybindings.json" atom_path = os.path.join(get_home(), ".atom") return { # TODO: Double check these paths. Not sure these are right. sublime2_path: "sublime2", sublime3_path: "sublime3", + vscode_path_1: "vscode/settings", + vscode_path_2: "vscode/Snippets", + vscode_path_3: "vscode/keybindings", atom_path: "atom" } diff --git a/shallow_backup/config.py b/shallow_backup/config.py index 3cad389d..fe22cbb4 100644 --- a/shallow_backup/config.py +++ b/shallow_backup/config.py @@ -52,6 +52,7 @@ def get_default_config(): "default-gitignore": [ "dotfiles/.ssh", "dotfiles/.pypirc", + ".DS_Store" ], "config_mapping" : get_config_paths() } diff --git a/shallow_backup/reinstall.py b/shallow_backup/reinstall.py index d0feb947..3a6418c8 100644 --- a/shallow_backup/reinstall.py +++ b/shallow_backup/reinstall.py @@ -73,7 +73,7 @@ def reinstall_packages_sb(packages_path): package_mgrs = set() for file in os.listdir(packages_path): manager = file.split("_")[0].replace("-", " ") - if manager in ["gem", "brew-cask", "cargo", "npm", "pip", "brew", "apm", "macports"]: + if manager in ["gem", "brew-cask", "cargo", "npm", "pip", "pip3", "brew", "apm", "macports"]: package_mgrs.add(file.split("_")[0]) print_blue_bold("Package Manager Backups Found:") @@ -97,6 +97,10 @@ def reinstall_packages_sb(packages_path): print_pkg_mgr_reinstall(pm) cmd = "pip install -r {0}/pip_list.txt".format(packages_path) run_cmd(cmd) + elif pm == "pip3": + print_pkg_mgr_reinstall(pm) + cmd = "pip3 install -r {0}/pip3_list.txt".format(packages_path) + run_cmd(cmd) elif pm == "apm": print_pkg_mgr_reinstall(pm) cmd = "apm install --packages-file {0}/apm_list.txt".format(packages_path)