-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from gdgib/G2-415-OSXSupport
G2-415 OSX Support
- Loading branch information
Showing
11 changed files
with
187 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function install_force () { | ||
set +u | ||
if [ -z ${INSTALL_TEST+x} ]; then | ||
set -u | ||
INSTALL_TEST=0 | ||
fi | ||
set -u | ||
|
||
if [[ "${INSTALL_TEST}" = "1" ]]; then | ||
echo install ${PACKAGE} | ||
else | ||
${COMMON_DIR}/install ${PACKAGE} | ||
fi | ||
} | ||
|
||
function install () { | ||
PACKAGE=${1} | ||
|
||
PACKAGE_FILE="${COMMON_DIR}/packages/${PACKAGE}" | ||
if [ -x "${PACKAGE_FILE}" ]; then | ||
COMMAND="$("${PACKAGE_FILE}" --command)" | ||
else | ||
COMMAND="${PACKAGE}" | ||
fi | ||
|
||
if (! which ${COMMAND} > /dev/null 2>&1) || ([[ "${INSTALL_NATIVE}" = "1" ]] && [[ $(which ${COMMAND}) = *"/cygdrive/"* ]]); then | ||
PACKAGE="${PACKAGE}" install_force | ||
elif [ -x "${PACKAGE_FILE}" ] && (! "${PACKAGE_FILE}" --test > /dev/null 2>&1); then | ||
PACKAGE="${PACKAGE}" install_force | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
function help () { | ||
echo "$(basename ${0}): Check whether the $(basename ${0}) package is properly installed" | ||
echo | ||
echo "Usage: $(basename ${0})" | ||
echo -e "\tcommands:" | ||
echo -e "\t\t--help: Display this command line help" | ||
echo -e "\t\t--command: Print the command to be used as an argument to 'which'" | ||
echo -e "\t\t--test: Test if the package is properly installed, fail if it needs to be installed" | ||
echo | ||
} | ||
|
||
SELF_DIR=$(cd $(dirname ${0}) && pwd -P) | ||
SELF=${SELF_DIR}/$(basename ${0}) | ||
|
||
ACTUAL_COMMAND="$(basename "${0}")" | ||
|
||
if [[ $# -eq 1 ]]; then | ||
COMMAND="${1}" | ||
case ${COMMAND} in | ||
-h|--help|help) | ||
help | ||
exit 0 | ||
;; | ||
-c|--command) | ||
echo "${ACTUAL_COMMAND}" | ||
exit 0 | ||
;; | ||
-t|--test) | ||
"${ACTUAL_COMMAND}" --version | ||
exit 0 | ||
;; | ||
esac | ||
fi | ||
|
||
help | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
function help () { | ||
echo "$(basename ${0}): Check whether the $(basename ${0}) package is properly installed" | ||
echo | ||
echo "Usage: $(basename ${0})" | ||
echo -e "\tcommands:" | ||
echo -e "\t\t--help: Display this command line help" | ||
echo -e "\t\t--command: Print the command to be used as an argument to 'which'" | ||
echo -e "\t\t--test: Test if the package is properly installed, fail if it needs to be installed" | ||
echo | ||
} | ||
|
||
SELF_DIR=$(cd $(dirname ${0}) && pwd -P) | ||
SELF=${SELF_DIR}/$(basename ${0}) | ||
|
||
ACTUAL_COMMAND="mvn" | ||
|
||
if [[ $# -eq 1 ]]; then | ||
COMMAND="${1}" | ||
case ${COMMAND} in | ||
-h|--help|help) | ||
help | ||
exit 0 | ||
;; | ||
-c|--command) | ||
echo "${ACTUAL_COMMAND}" | ||
exit 0 | ||
;; | ||
-t|--test) | ||
"${ACTUAL_COMMAND}" --version | ||
exit 0 | ||
;; | ||
esac | ||
fi | ||
|
||
help | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load ../install | ||
|
||
@test "install_already" { | ||
INSTALL_TEST=1 INSTALL_NATIVE=0 run install which | ||
[ "$output" = "" ] | ||
} | ||
|
||
@test "install_now" { | ||
INSTALL_TEST=1 INSTALL_NATIVE=0 run install foobar | ||
[ "$output" = "install foobar" ] | ||
INSTALL_TEST=1 INSTALL_NATIVE=1 run install foobar | ||
[ "$output" = "install foobar" ] | ||
} | ||
|
||
@test "install_native" { | ||
INSTALL_TEST=1 INSTALL_NATIVE=1 run install powershell | ||
[ "$output" = "install powershell" ] | ||
} | ||
|
||
@test "install_scripted" { | ||
INSTALL_TEST=1 INSTALL_NATIVE=1 run install git | ||
[ "$output" = "" ] | ||
} | ||
|
||
@test "git_command" { | ||
run ${BATS_TEST_DIRNAME}/../packages/git --command | ||
[ "$status" -eq 0 ] | ||
[ "$output" = "git" ] | ||
} | ||
|
||
@test "git_test" { | ||
run ${BATS_TEST_DIRNAME}/../packages/git --test | ||
[ "$status" -eq 0 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# OSX | ||
|
||
[`install`](install) automates the installation of OSX packages, generally using [homebrew](https://brew.sh/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
function help () { | ||
echo "$(basename ${0}): Install packages on OSX" | ||
echo | ||
echo "Usage: $(basename ${0}) <package>*" | ||
echo | ||
} | ||
|
||
SELF_DIR=$(cd $(dirname ${0}) && pwd -P) | ||
SELF=${SELF_DIR}/$(basename ${0}) | ||
|
||
. ${SELF_DIR}/../../common/source.bash | ||
|
||
# Note that there can be more than one package to install... | ||
args_min 1 | ||
|
||
if ! which brew &> /dev/null; then | ||
echo -e "${CFMT_INFO}Installing homebrew for the first time${CFMT_NORMAL}" >&2 | ||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
fi | ||
|
||
echo -e "${CFMT_INFO}Updating brew${CFMT_NORMAL}" >&2 | ||
brew update | ||
|
||
echo -e "${CFMT_INFO}Installing ${@} using brew${CFMT_NORMAL}" >&2 | ||
brew install ${@} | ||
|
||
echo -e "${CFMT_SUCCESS}Installed ${@}${CFMT_NORMAL}" >&2 |