forked from GameJs/gamejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename bash scripts and minified files for gamejs & application
all bash scripts in /bin and renamed, also copied lots of better shell patterns from ringojs scripts (e.g. now they can actually be symlinked into /usr/bin/ and still work :| ) renamed all scripts and output files to better match common minification scripts `app.min.js` and `gamejs.min.js` `gamejs.min.js` now put into gamejs home instead of deep into skeleton remove api/doc - must be rendered by user
- Loading branch information
Showing
42 changed files
with
215 additions
and
16,011 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 +1,2 @@ | ||
examples/skeleton/public/gamejs-wrapped.js | ||
gamejs.min.js | ||
docs/api/* |
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,44 @@ | ||
#!/bin/bash | ||
# ----------------------------------------------------------------------------- | ||
# Creates the API documentation for GameJs. | ||
# | ||
# REQUIRES RingoJs on path. | ||
# | ||
# Environment Variables | ||
# | ||
# 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" | ||
} | ||
|
||
if [ -z "$GAMEJS_HOME" ]; then | ||
GAMEJS_HOME="$(find_gamejs_home "$0")" | ||
fi | ||
|
||
rm -rf ${GAMEJS_HOME}/docs/api/ | ||
ringo-doc -q --file-urls --source ${GAMEJS_HOME}/lib/ --directory ${GAMEJS_HOME}/docs/api/ --name 'GameJs API' |
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,77 @@ | ||
#!/bin/bash | ||
# ----------------------------------------------------------------------------- | ||
# Wraps a game into one JavaScript file for efficient deployment. | ||
# Optional argument `compress`: | ||
# | ||
# $ ./bin/minify-app.sh /path/to/game/javascript/ [compress] | ||
# | ||
# REQUIRES RingoJs on path. | ||
# | ||
# Environment Variables | ||
# | ||
# GAMEJS_HOME (Optional) Ringo installation directory | ||
# 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" | ||
} | ||
|
||
if [ -z "$GAMEJS_HOME" ]; then | ||
GAMEJS_HOME="$(find_gamejs_home "$0")" | ||
fi | ||
|
||
if [ -z "$JAVA_HOME" ] ; then | ||
java_cmd='java' | ||
else | ||
if [ "$OSTYPE" == 'cygwin' ]; then | ||
java_cmd="`cygpath -u "$JAVA_HOME"`/bin/java" | ||
else | ||
java_cmd="$JAVA_HOME/bin/java" | ||
fi | ||
fi | ||
|
||
if [[ -z "$1" ]] ; then | ||
echo "Usage: $0 /path/to/game/javascript/ [compress]" | ||
echo "Creates app.min.js in the first argument directory." | ||
exit | ||
fi | ||
|
||
TEMP_WORKING=`mktemp --directory` | ||
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" | ||
if [ "$2" = "compress" ] ; then | ||
EXEC_CLOSURE="${java_cmd} -jar ${GAMEJS_HOME}/utils/closure-compiler/compiler.jar --jscomp_warning=internetExplorerChecks" | ||
fi | ||
|
||
|
||
rm -f ${WRAPPED_FILE} | ||
${EXEC_YABBLER} -i $1 -o ${TEMP_WORKING} | ||
${EXEC_YABBLER} -i ${GAMEJS_HOME}/lib/ -o ${TEMP_WORKING} | ||
cat ${GAMEJS_HOME}/examples/skeleton/public/yabble.js | ${EXEC_CLOSURE} > ${WRAPPED_FILE} | ||
find ${TEMP_WORKING} -type f -exec cat {} \; | ${EXEC_CLOSURE} >> ${WRAPPED_FILE} | ||
rm -rf ${TEMP_WORKING} |
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,65 @@ | ||
#!/bin/bash | ||
# ----------------------------------------------------------------------------- | ||
# Create wrapped GameJs file. | ||
# | ||
# Environment Variables | ||
# | ||
# GAMEJS_HOME (Optional) Ringo installation directory | ||
# 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" | ||
} | ||
|
||
if [ -z "$GAMEJS_HOME" ]; then | ||
GAMEJS_HOME="$(find_gamejs_home "$0")" | ||
fi | ||
|
||
if [ -z "$JAVA_HOME" ] ; then | ||
java_cmd='java' | ||
else | ||
if [ "$OSTYPE" == 'cygwin' ]; then | ||
java_cmd="`cygpath -u "$JAVA_HOME"`/bin/java" | ||
else | ||
java_cmd="$JAVA_HOME/bin/java" | ||
fi | ||
fi | ||
|
||
TEMP_WORKING=`mktemp --directory` | ||
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" | ||
OUTPUT_FILE_SKELETON="${GAMEJS_HOME}/examples/skeleton/public/gamejs.min.js" | ||
if [ "$1" = "compress" ] ; then | ||
EXEC_CLOSURE="${java_cmd} -jar ${GAMEJS_HOME}/utils/closure-compiler/compiler.jar --jscomp_warning=internetExplorerChecks" | ||
fi | ||
|
||
${EXEC_YABBLER} -i ${GAMEJS_HOME}/lib/ -o ${TEMP_WORKING} | ||
find ${TEMP_WORKING} -type f -exec cat {} \; | ${EXEC_CLOSURE} > ${OUTPUT_FILE} | ||
cp ${OUTPUT_FILE} ${OUTPUT_FILE_SKELETON} | ||
rm -rf ${TEMP_WORKING} | ||
echo "Wrote ${OUTPUT_FILE}" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.