Skip to content

Commit

Permalink
Merge pull request GameJs#45 from mindeavor/master
Browse files Browse the repository at this point in the history
Fixed script compatibility for OS X & bash refactor
  • Loading branch information
oberhamsi committed Jan 27, 2012
2 parents 7d737a0 + ac565c2 commit 1de9f8e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 80 deletions.
28 changes: 2 additions & 26 deletions bin/create-jsdoc.sh
Expand Up @@ -9,34 +9,10 @@
# GAMEJS_HOME (Optional) Ringo installation directory
# -----------------------------------------------------------------------------
# Many thanks to the RingoJs bash file writers.

#
# find_ringo_home - mostly an emulation of GNU's `readlink -f`
#
function find_gamejs_home() {
# save original working directory
ORIG_PWD="$(pwd -P)"

# walk the links! we cd into the dir of the target binary, read the link,
# make this link our new target, and start over. we stop as soon as the
# target is no link anymore.
T="$1"
while true; do
cd "$(dirname "$T")"
T="$(basename "$T")"
if [ ! -L "$T" ]; then break; fi
T="$(readlink "$T")"
done

# the final target is in bin/, change to parent and echo as home
cd ..
echo "$(pwd -P)"

# restore original working directory
cd "$ORIG_PWD"
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z "$GAMEJS_HOME" ]; then
source "$SCRIPT_DIR/find-gamejs-home.sh"
GAMEJS_HOME="$(find_gamejs_home "$0")"
fi

Expand Down
26 changes: 26 additions & 0 deletions bin/find-gamejs-home.sh
@@ -0,0 +1,26 @@
#!/bin/bash
#
# find_ringo_home - mostly an emulation of GNU's `readlink -f`
#
function find_gamejs_home() {
# save original working directory
ORIG_PWD="$(pwd -P)"

# walk the links! we cd into the dir of the target binary, read the link,
# make this link our new target, and start over. we stop as soon as the
# target is no link anymore.
T="$1"
while true; do
cd "$(dirname "$T")"
T="$(basename "$T")"
if [ ! -L "$T" ]; then break; fi
T="$(readlink "$T")"
done

# the final target is in bin/, change to parent and echo as home
cd ..
echo "$(pwd -P)"

# restore original working directory
cd "$ORIG_PWD"
}
30 changes: 3 additions & 27 deletions bin/minify-app.sh
Expand Up @@ -13,34 +13,10 @@
# JAVA_HOME (Optional) JDK installation directory
# -----------------------------------------------------------------------------
# Many thanks to the RingoJs bash file writers.

#
# find_ringo_home - mostly an emulation of GNU's `readlink -f`
#
function find_gamejs_home() {
# save original working directory
ORIG_PWD="$(pwd -P)"

# walk the links! we cd into the dir of the target binary, read the link,
# make this link our new target, and start over. we stop as soon as the
# target is no link anymore.
T="$1"
while true; do
cd "$(dirname "$T")"
T="$(basename "$T")"
if [ ! -L "$T" ]; then break; fi
T="$(readlink "$T")"
done

# the final target is in bin/, change to parent and echo as home
cd ..
echo "$(pwd -P)"

# restore original working directory
cd "$ORIG_PWD"
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z "$GAMEJS_HOME" ]; then
source "$SCRIPT_DIR/find-gamejs-home.sh"
GAMEJS_HOME="$(find_gamejs_home "$0")"
fi

Expand All @@ -60,7 +36,7 @@ if [[ -z "$1" ]] ; then
exit
fi

TEMP_WORKING=`mktemp --directory`
TEMP_WORKING=`mktemp -d /tmp/gamejs.XXXX`
WRAPPED_FILE=$1/app.min.js
EXEC_YABBLER="${java_cmd} -jar ${GAMEJS_HOME}/utils/rhino/js.jar ${GAMEJS_HOME}/utils/yabbler/yabbler.js"
EXEC_CLOSURE="cat"
Expand Down
30 changes: 3 additions & 27 deletions bin/minify-gamejs.sh
Expand Up @@ -8,34 +8,10 @@
# JAVA_HOME (Optional) JDK installation directory
# -----------------------------------------------------------------------------
# Many thanks to the RingoJs bash file writers.

#
# find_ringo_home - mostly an emulation of GNU's `readlink -f`
#
function find_gamejs_home() {
# save original working directory
ORIG_PWD="$(pwd -P)"

# walk the links! we cd into the dir of the target binary, read the link,
# make this link our new target, and start over. we stop as soon as the
# target is no link anymore.
T="$1"
while true; do
cd "$(dirname "$T")"
T="$(basename "$T")"
if [ ! -L "$T" ]; then break; fi
T="$(readlink "$T")"
done

# the final target is in bin/, change to parent and echo as home
cd ..
echo "$(pwd -P)"

# restore original working directory
cd "$ORIG_PWD"
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z "$GAMEJS_HOME" ]; then
source "$SCRIPT_DIR/find-gamejs-home.sh"
GAMEJS_HOME="$(find_gamejs_home "$0")"
fi

Expand All @@ -49,7 +25,7 @@ else
fi
fi

TEMP_WORKING=`mktemp --directory`
TEMP_WORKING=`mktemp -d /tmp/gamejs.XXXX`
EXEC_YABBLER="${java_cmd} -jar ${GAMEJS_HOME}/utils/rhino/js.jar ${GAMEJS_HOME}/utils/yabbler/yabbler.js"
EXEC_CLOSURE="cat"
OUTPUT_FILE="${GAMEJS_HOME}/gamejs.min.js"
Expand Down

0 comments on commit 1de9f8e

Please sign in to comment.