Skip to content

Commit

Permalink
Merge pull request #465 from aasanchez/master
Browse files Browse the repository at this point in the history
Add Github Access Token to composer
  • Loading branch information
fideloper committed May 24, 2015
2 parents cdfad85 + eceb2e7 commit 49afd98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ github_repo = "Vaprobash"
github_branch = "1.4.0"
github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"

# Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/
# https://github.com/settings/tokens
github_pat = ""

# Server Configuration

hostname = "vaprobash.dev"
Expand Down
20 changes: 15 additions & 5 deletions scripts/composer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ HHVM_IS_INSTALLED=$?
composer -v > /dev/null 2>&1
COMPOSER_IS_INSTALLED=$?

# Retrieve the Global Composer Packages, if any are given
COMPOSER_PACKAGES=($@)
# Contains all arguments that are passed
COMPOSER_ARG=($@)

GITHUB_OAUTH=${COMPOSER_ARG[0]}
COMPOSER_PACKAGES=${COMPOSER_ARG[@]:1}

# True, if composer is not installed
if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then
Expand Down Expand Up @@ -51,16 +54,23 @@ else
fi
fi

if [[ $GITHUB_OAUTH -ne "" ]]; then
if [[ ! $COMPOSER_IS_INSTALLED -ne 0 ]]; then
else
composer config -g github-oauth.github.com $GITHUB_OAUTH
fi
fi


# Install Global Composer Packages if any are given
if [[ ! -z $COMPOSER_PACKAGES ]]; then

echo ">>> Installing Global Composer Packages:"
echo " " $@
echo " " ${COMPOSER_PACKAGES[@]}
if [[ $HHVM_IS_INSTALLED -eq 0 ]]; then
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer global require $@
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer global require ${COMPOSER_PACKAGES[@]}
else
composer global require $@
composer global require ${COMPOSER_PACKAGES[@]}
fi

# Add Composer's Global Bin to ~/.profile path
Expand Down

0 comments on commit 49afd98

Please sign in to comment.