Created
November 20, 2012 17:22
-
-
Save jssjr/4119386 to your computer and use it in GitHub Desktop.
Mirror the opscode-cookbook repos
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
#!/usr/bin/env sh | |
### Mirror all of the opscode-cookbooks repositories | |
trap "exit 1" INT TERM # exit gracefully if we're in the main loop | |
repos=$(curl -s -o- https://api.github.com/users/opscode-cookbooks/repos\?per_page\=1000 \ | |
| ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each{|r| puts r["git_url"]}') | |
for repo in $repos ; do | |
repo_name=$(echo "$repo" | sed -e 's#^.*/\([^.]*\).git$#\1#') | |
echo "> $repo_name" | |
if [ -d "$repo_name" ] ; then | |
( cd "$repo_name" ; git pull ) | |
else | |
git clone "$repo" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment