Last active
August 29, 2015 14:02
-
-
Save jenux/37c86c3253a35336470a to your computer and use it in GitHub Desktop.
Set gem sources to "taobao" or reset to "rubygems.org"
This file contains hidden or 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/bash | |
| param=$1 | |
| oldsource=`gem sources | tail -n 1` | |
| if [ "$param"x = "setx" ]; then | |
| newsource="https://ruby.taobao.org/" | |
| else | |
| newsource="https://rubygems.org/" | |
| fi | |
| #echo "oldsource: $oldsource" | |
| #echo "newsource: $newsource" | |
| case "$param" in | |
| set|reset) | |
| gem sources --remove $oldsource | |
| gem sources -a $newsource | |
| echo "gem source updated:" | |
| gem source -l | |
| ;; | |
| *) | |
| echo "Usage: $0 {set|reset}" | |
| exit 1 | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment