Files
atom/script/copy-files-to-bundle
Corey Johnson f624d2277e Compiling coffeescript is slow, so only compile the .coffee files if they are newer than the .js files
If a coffeescript file is deleted, this will not remove that file from the bundle. This is the source of a future bug that I'm hoping to avoid.
2012-09-19 16:08:26 -07:00

27 lines
1001 B
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"
mkdir -p "$RESOUCES_PATH/v8_extensions"
cp "$PROJECT_DIR/native/v8_extensions/"*.js "$RESOUCES_PATH/v8_extensions/"
for DIR in src static vendor spec benchmark bundles themes; do
for COFFEE_PATH in $(find "$DIR" -type f -name '*.coffee'); do
JAVASCRIPT_PATH=$(echo "$RESOUCES_PATH/$COFFEE_PATH" | sed 's/\.coffee$/.js/')
# Compiling coffeescript is slow, so only compile the .coffee files if
# they are newer than the .js files
if [ "$COFFEE_PATH" -nt "$JAVASCRIPT_PATH" ]; then
node_modules/.bin/coffee -c -o "$(dirname "$JAVASCRIPT_PATH")" "$COFFEE_PATH"
fi
done
done;