Skip to content

Commit

Permalink
Auto npm the github api for really-pull-all
Browse files Browse the repository at this point in the history
Add `-s` flag that will opt into using SSH paths
  • Loading branch information
dfreedm committed Nov 9, 2013
1 parent 2d9337d commit 4a40714
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 25 deletions.
41 changes: 28 additions & 13 deletions bin/pull-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ if [[ $OS = "Windows_NT" ]]; then
fi

# default to https auth
POLYMER_PATH=${POLYMER_PATH:-"https://github.com/Polymer"}
SSH=0

# Short names for all the repos
REPOS=(
REPOS=()
REPO_PATHS=()

prepare() {
if [ $SSH -eq 1 ]; then
POLYMER_PATH="[email protected]:Polymer"
else
POLYMER_PATH="https://github.com/Polymer"
fi

# Short names for all the repos
REPOS=(
CustomElements
HTMLImports
MutationObservers
Expand All @@ -27,18 +37,19 @@ REPOS=(
polymer
polymer-expressions
tools
)
)

# Array of all the repos with full path
REPO_PATHS=()
# Array of all the repos with full path
REPO_PATHS=()

for REPO in ${REPOS[@]}; do
REPO_PATHS+=("$POLYMER_PATH/$REPO.git")
done
for REPO in ${REPOS[@]}; do
REPO_PATHS+=("$POLYMER_PATH/$REPO.git")
done

# Web Animations has its own org, hardcode full path
REPOS+=("web-animations-js")
REPO_PATHS+=("https://github.com/web-animations/web-animations-js.git")
# Web Animations has its own org, hardcode full path
REPOS+=("web-animations-js")
REPO_PATHS+=("https://github.com/web-animations/web-animations-js.git")
}

# repos that fail to clone will be put here
FAILED=()
Expand Down Expand Up @@ -132,8 +143,11 @@ sync_repos() {
# only sync if run, not if importing functions
if [ ${0##*[/\\]} == "pull-all.sh" ]; then
# figure out what branch to pull with the -v "version" argument
while getopts ":v:" opt; do
while getopts ":v:s" opt; do
case $opt in
s)
SSH=1
;;
v)
BRANCH="$OPTARG"
;;
Expand All @@ -142,5 +156,6 @@ if [ ${0##*[/\\]} == "pull-all.sh" ]; then
;;
esac
done
prepare
sync_repos
fi
43 changes: 31 additions & 12 deletions bin/really-pull-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,35 @@ if [[ $OS = "Windows_NT" ]]; then
WINDOWS=1
fi

# default to https auth
GIT_PATH=${GIT_PATH:-"https://github.com/polymer-elements"}
REPOS=()
REPO_PATHS=()
SSH=0

# Short names for all the repos
script="${0%[/\\]*}/all-repos.js"
echo -e "\033[1;34m===== Fetching \033[1;37mGithub Repos \033[1;34m=====\033[0m"
REPOS=(`node $script polymer-elements`)
prepare() {
# default to https auth
if [ $SSH -eq 1 ]; then
GIT_PATH="[email protected]:polymer-elements"
else
GIT_PATH="https://github.com/polymer-elements"
fi

# Array of all the repos with full path
REPO_PATHS=()
# boostrap github api
pushd ${0%[/\\]*} > /dev/null
npm install
popd > /dev/null

# Gather repo list from github
script="${0%[/\\]*}/all-repos.js"
echo -e "\033[1;34m===== Fetching \033[1;37mGithub Repos \033[1;34m=====\033[0m"
REPOS=(`node $script polymer-elements`)

for REPO in ${REPOS[@]}; do
REPO_PATHS+=("$GIT_PATH/$REPO.git")
done
# Array of all the repos with full path
REPO_PATHS=()

for REPO in ${REPOS[@]}; do
REPO_PATHS+=("$GIT_PATH/$REPO.git")
done
}

# repos that fail to clone will be put here
FAILED=()
Expand Down Expand Up @@ -115,8 +130,11 @@ sync_repos() {
# only sync if run, not if importing functions
if [ ${0##*[/\\]} == "really-pull-all.sh" ]; then
# figure out what branch to pull with the -v "version" argument
while getopts ":v:" opt; do
while getopts ":v:s" opt; do
case $opt in
s)
SSH=1
;;
v)
BRANCH="$OPTARG"
;;
Expand All @@ -125,5 +143,6 @@ if [ ${0##*[/\\]} == "really-pull-all.sh" ]; then
;;
esac
done
prepare
sync_repos
fi

0 comments on commit 4a40714

Please sign in to comment.