-
-
Save grocky/e38c017f7b4177130d01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
proxy=$PROXY | |
if [ "$1" == "on" ]; then | |
echo "exporting proxy" | |
export http_proxy=$proxy | |
export https_proxy=$proxy | |
echo "setting git proxy to $proxy" | |
git config --global http.proxy $proxy | |
git config --global https.proxy $proxy | |
echo "setting npm proxy to $proxy" | |
npm config set proxy $proxy | |
npm config set https-proxy $proxy | |
echo "setting bower proxy to $proxy" | |
sed -i.bak 's|"proxy": ""|"proxy": "'"$proxy"'"|g' $HOME/.bowerrc | |
sed -i.bak 's|"https-proxy": ""|"https-proxy": "'"$proxy"'"|g' $HOME/.bowerrc | |
echo "setting Package Control proxy to $proxy" | |
sed -i.bak 's|"http_proxy": ""|"http_proxy": "'"$proxy"'"|g' "$home/AppData/Roaming/Sublime Text 3/Packages/User/Package Control.sublime-settings" | |
sed -i.bak 's|"https_proxy": ""|"https_proxy": "'"$proxy"'"|g' "$home/AppData/Roaming/Sublime Text 3/Packages/User/Package Control.sublime-settings" | |
else | |
echo "resetting proxy" | |
export http_proxy= | |
export https_proxy= | |
echo "resetting git proxy..." | |
git config --global --unset http.proxy > /dev/null 2>&1 | |
git config --global --unset https.proxy > /dev/null 2>&1 | |
echo "resetting npm proxy..." | |
npm config rm proxy > /dev/null 2>&1 | |
npm config rm https-proxy > /dev/null 2>&1 | |
echo "resetting bower proxy..." | |
sed -i.bak 's|"proxy": "'"$proxy"'"|"proxy": ""|g' $HOME/.bowerrc | |
sed -i.bak 's|"https-proxy": "'"$proxy"'"|"https-proxy": ""|g' $HOME/.bowerrc | |
echo "resetting Package Control proxy..." | |
sed -i.bak 's|"http_proxy": "'"$proxy"'"|"http_proxy": ""|g' "$home/AppData/Roaming/Sublime Text 3/Packages/User/Package Control.sublime-settings" | |
sed -i.bak 's|"https_proxy": "'"$proxy"'"|"https_proxy": ""|g' "$home/AppData/Roaming/Sublime Text 3/Packages/User/Package Control.sublime-settings" | |
fi |
Thanks! Yea, this was for a cygwin setup. But the only think that is windows specific is the location of the SublimeText settings.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good job!
Is this for Windows right ?