pulsar/script/copy-files-to-bundle
Kevin Sawicki d35c871e17 Install atom executable during window.startup()
Previously this was done during `rake install`.

Also default to `~/github/atom` as the default resource path
when no `--resource-path` argument is specified.  This argument
will now be required when running in dev mode if the repository
is not at the default location.

Closes #300
2013-02-22 21:19:34 -08:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# This can only be run by xcode or xcodebuild!
# Because of the way xcodebuild invokes external scripts we need to load
# The Setup's environment ourselves. If this isn't done, things like the
# node shim won't be able to find the stuff they need.
if [ -f /opt/github/env.sh ]; then
source /opt/github/env.sh
fi
RESOUCES_PATH="$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
DIRS="src static vendor"
# Compile .coffee files into bundle
COFFEE_FILES=$(find $DIRS -type file -name '*.coffee')
for COFFEE_FILE in $COFFEE_FILES; do
JS_FILE=$(echo "$RESOUCES_PATH/$COFFEE_FILE" | sed 's/.coffee/.js/' )
OUTPUT_PATH="$RESOUCES_PATH/$(dirname "$COFFEE_FILE")"
if [ $COFFEE_FILE -nt "$JS_FILE" ]; then
mkdir -p "$OUTPUT_PATH"
node_modules/.bin/coffee -c -o "$OUTPUT_PATH" "$COFFEE_FILE" || exit 1
fi
done;
# Compile .cson files into bundle
CSON_FILES=$(find $DIRS -type file -name '*.cson')
for CSON_FILE in $CSON_FILES; do
JSON_FILE=$(echo "$RESOUCES_PATH/$CSON_FILE" | sed 's/.cson/.json/' )
OUTPUT_PATH="$RESOUCES_PATH/$(dirname "$CSON_FILE")"
if [ $CSON_FILE -nt "$JSON_FILE" ]; then
mkdir -p "$OUTPUT_PATH"
node_modules/.bin/cson2json "$CSON_FILE" > "$JSON_FILE"
fi
done;
# Copy non-coffee files into bundle
rsync --archive --recursive --exclude="src/**/*.coffee" --exclude="src/**/*.cson" src static vendor spec benchmark themes dot-atom atom.sh "$RESOUCES_PATH"