#!/usr/bin/env bash

if [ "$1" == "browserstack" ]; then
    if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
        grunt browserstack;
        exit $?;
    fi
fi

if [ "$1" == "coverage" ]; then
    grunt coverage || exit $?;

    if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
        codeclimate < coverage/*/lcov.info; 
    fi
fi

#!/usr/bin/env bash

# Skip everything relying on travis secure variables when on a pull requests

if [ "$1" == "browserstack" ]; then
    if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
        grunt browserstack;
        exit $?;
    else
        echo "Skipping browserstack. (it's a pull request)"
    fi
fi

if [ "$1" == "coverage" ]; then
    grunt coverage || exit $?;

    if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
        if [ "$TRAVIS_BRANCH" == "master" ]; then
            codeclimate < coverage/*/lcov.info;
        else
            echo "Not sending coverage report (it's not master branch).";
        fi
    else
        echo "Not sending coverage reports (it's a pull request)"
    fi
fi

Allow coverage report submission to codeclimate only on master branch
Allow coverage report submission to codeclimate only on master branch
