#!/usr/bin/env bash

declare -a JDKS_DIRECTORIES_TO_REMOVE=()

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# OS X

if [ "$TRAVIS_OS_NAME" = "osx" ]; then

    # Install `ShellCheck` (required for testing)
    brew install shellcheck

    # Export directory where Java binaries are located in linux
    JDKS_DIRECTORIES_TO_REMOVE=(
        /Library/Java/JavaVirtualMachines/*.jdk
    )

fi

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# To better simulate a clean OS install, remove certain things
# included by default by Travis CI

rm -rf "$NVM_DIR"
for i in "${JDKS_DIRECTORIES_TO_REMOVE[@]}"; do
    sudo rm -rf "${i}"
done

#!/usr/bin/env bash

declare -a JDKS_DIRECTORIES_TO_REMOVE=()

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# OS X

if [ "$TRAVIS_OS_NAME" = "osx" ]; then

    # Install `ShellCheck` (required for testing)
    brew install shellcheck

    # To better simulate a clean macOS install, remove certain things
    # included by default by Travis CI with brew
    brew cask uninstall java6
    brew cask uninstall java7
    brew cask uninstall java

    # Export directory where Java binaries are located in linux
    JDKS_DIRECTORIES_TO_REMOVE=(
        /Library/Java/JavaVirtualMachines/*.jdk
    )

fi

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# To better simulate a clean OS install, remove certain things
# included by default by Travis CI

rm -rf "$NVM_DIR"
for i in "${JDKS_DIRECTORIES_TO_REMOVE[@]}"; do
    sudo rm -rf "${i}"
done

Fix issue with jenv add java 8 on travisci with xcode8 image
[test] Fix issue with jenv add java 8 on travisci with xcode8 image

Using the newly update travisci xcode8 image, adding java 8 to jenv
was failing because brew thought it was already installed even though
we removed the directories in /Library/Java/JavaVirtualMachines/*.jdk
in ./test/customize_environment.sh

I have now added brew uninstall of java 6 to 8 to
./test/customize_environment.sh
