-
Notifications
You must be signed in to change notification settings - Fork 23
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 #6 from laysent/master
Fix Windows Issues
- Loading branch information
Showing
8 changed files
with
798 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "0.8" | ||
- "0.12" | ||
- "0.10" | ||
- "0.11" | ||
before_install: | ||
- "npm install -g npm@1.4.x" | ||
- "4" | ||
- "iojs" | ||
script: | ||
- "npm run test-travis" | ||
after_script: | ||
- "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" | ||
matrix: | ||
fast_finish: true |
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 |
---|---|---|
@@ -1,24 +1,50 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
git stash -q --keep-index | ||
HAS_NODE=`which node 2> /dev/null || which nodejs 2> /dev/null || which iojs 2> /dev/null` | ||
|
||
# | ||
# There are some issues with Source Tree because paths are not set correctly for | ||
# the given environment. Sourcing the bash_profile seems to resolve this for bash users, | ||
# sourcing the zshrc for zshell users. | ||
# | ||
# https://answers.atlassian.com/questions/140339/sourcetree-hook-failing-because-paths-don-t-seem-to-be-set-correctly | ||
# | ||
function source_home_file { | ||
file="$HOME/$1" | ||
[[ -f "${file}" ]] && source "${file}" | ||
} | ||
|
||
if [[ -z "$HAS_NODE" ]]; then | ||
source_home_file ".bash_profile" || source_home_file ".zshrc" || source_home_file ".bashrc" || true | ||
fi | ||
|
||
NODE=`which node 2> /dev/null` | ||
NODEJS=`which nodejs 2> /dev/null` | ||
IOJS=`which iojs 2> /dev/null` | ||
LOCAL="/usr/local/bin/node" | ||
BINARY= | ||
|
||
if [[ -n $NODE ]]; then | ||
"$NODE" $("$NODE" -e "console.log(require.resolve('pre-push'))") | ||
elif [[ -n $NODEJS ]]; then | ||
"$NODEJS" $("$NODEJS" -e "console.log(require.resolve('pre-push'))") | ||
elif [[ -n $IOJS ]]; then | ||
"$IOJS" $("$IOJS" -e "console.log(require.resolve('pre-push'))") | ||
elif [[ -x $LOCAL ]]; then | ||
"$LOCAL" $("$LOCAL" -e "console.log(require.resolve('pre-push'))") | ||
# | ||
# Figure out which binary we need to use for our script execution. | ||
# | ||
if [[ -n "$NODE" ]]; then | ||
BINARY="$NODE" | ||
elif [[ -n "$NODEJS" ]]; then | ||
BINARY="$NODEJS" | ||
elif [[ -n "$IOJS" ]]; then | ||
BINARY="$IOJS" | ||
elif [[ -x "$LOCAL" ]]; then | ||
BINARY="$LOCAL" | ||
fi | ||
RESULT=$? | ||
|
||
git stash pop -q | ||
[ $RESULT -ne 0 ] && exit 1 | ||
exit 0 | ||
|
||
# | ||
# Add --dry-run cli flag support so we can execute this hook without side affects | ||
# and see if it works in the current environment | ||
# | ||
if [[ $* == *--dry-run* ]]; then | ||
if [[ -z "$BINARY" ]]; then | ||
exit 1 | ||
fi | ||
else | ||
"$BINARY" "$("$BINARY" -e "console.log(require.resolve('pre-push'))")" | ||
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
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
Oops, something went wrong.