-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync.sh
38 lines (32 loc) · 932 Bytes
/
sync.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
function __brew__() {
# Brewfile
echo "Dumping all things brew to Brewfile"
brew bundle dump --force
echo "Move the Brewfile to 'mac_os' or 'mac_os/work'"
}
function __npm__() {
# Global NPM packages
echo "Dumping npm packages to npm.txt"
npm ls -g -j --depth=0 | jq -r '.dependencies|keys|join("\n")' > npm.txt
}
function __pip__() {
# PIP packages
echo "Dumping PIP packages to pip.txt"
pip3 install --upgrade pip
# pip-chill is not globally installed so that
# it doesn't clash with the package installed in virtual environments
pip3 install pip-chill
pip-chill --no-version > pip.txt
pip3 uninstall pip-chill -y
echo "Done!"
}
if [ "$1" != "" ] && type "__$1__" &> /dev/null; then
eval "__$1__"
elif [ "$1" == "--complete" ]; then
__brew__
__npm__
__pip__
else
echo "Usage: ./sync.sh (brew/ npm/ pip | --complete)"
fi