From 0be3a79c4eb68e45a5d2a2d87388185ca256705e Mon Sep 17 00:00:00 2001
From: David Alger <david@classyllama.com>
Date: Sat, 30 Apr 2016 10:35:18 -0500
Subject: [PATCH] Reorganize a few things and remove the cache dir for composer
 bin since reason for introduction is now mute

---
 .travis.yml                  |  6 +++---
 dev/travis/before_install.sh | 25 ++++++++++++++-----------
 dev/travis/before_script.sh  | 24 +-----------------------
 3 files changed, 18 insertions(+), 37 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 17a8f373821..275ebfb2ee6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,7 @@ php:
   - 7.0
 env:
   global:
+    - COMPOSER_BIN_DIR=~/bin
     - INTEGRATION_SETS=2
   matrix:
     - TEST_SUITE=unit
@@ -22,9 +23,7 @@ env:
     - TEST_SUITE=static TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"'
 cache:
   apt: true
-  directories:
-    - $HOME/.composer/cache
-    - $HOME/.cache/bin
+  directories: $HOME/.composer/cache
 matrix:
   exclude:
     - php: 5.6
@@ -32,5 +31,6 @@ matrix:
     - php: 7.0
       env: TEST_SUITE=static
 before_install: ./dev/travis/before_install.sh
+install: composer install --no-interaction --prefer-dist
 before_script: ./dev/travis/before_script.sh
 script: cd dev/tests/$TEST_SUITE && phpunit $TEST_FILTER
diff --git a/dev/travis/before_install.sh b/dev/travis/before_install.sh
index c24fd130ec4..568cdb495b3 100755
--- a/dev/travis/before_install.sh
+++ b/dev/travis/before_install.sh
@@ -4,15 +4,18 @@
 # See COPYING.txt for license details.
 
 set -e
-PATH="$HOME/.cache/bin:$PATH"
+trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
 
-# install or update composer in casher dir
-if [ "$CASHER_DIR" ]; then
-    if [ -x $HOME/.cache/bin/composer ]; then
-        $HOME/.cache/bin/composer self-update
-    else
-        mkdir -p $HOME/.cache/bin
-        curl --connect-timeout 30 -sS https://getcomposer.org/installer \
-            | php -- --install-dir $HOME/.cache/bin/ --filename composer
-    fi
-fi
+# mock mail
+sudo service postfix stop
+echo # print a newline
+smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
+echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini
+
+# disable xdebug and adjust memory limit
+echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
+echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
+phpenv rehash;
+
+# If env var is present, configure support for 3rd party builds which include private dependencies
+test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true
diff --git a/dev/travis/before_script.sh b/dev/travis/before_script.sh
index e8b5e142a84..644d08d097e 100755
--- a/dev/travis/before_script.sh
+++ b/dev/travis/before_script.sh
@@ -4,20 +4,9 @@
 # See COPYING.txt for license details.
 
 set -e
-PATH="$HOME/.cache/bin:$PATH"
-
 trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
 
-# mock mail
-sudo service postfix stop
-echo # print a newline
-smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
-echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini
-
-# disable xDebug
-echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
-
-# prepare for integration tests
+# prepare for test suite
 case $TEST_SUITE in
     integration)
         cd dev/tests/integration
@@ -81,14 +70,3 @@ case $TEST_SUITE in
         cd ../../..
         ;;
 esac
-
-# change memory_limit for travis
-echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
-phpenv rehash;
-
-# install deps
-export COMPOSER_BIN_DIR=~/bin
-if [[ -n "$GITHUB_TOKEN" ]]; then
-    composer config github-oauth.github.com "$GITHUB_TOKEN"
-fi
-composer install --no-interaction --prefer-dist
-- 
GitLab