зеркало из https://github.com/electron/electron.git
Rewrite compile-coffee script in python.
This commit is contained in:
Родитель
85d7e7b034
Коммит
5c48f03dfe
6
atom.gyp
6
atom.gyp
|
@ -264,14 +264,14 @@
|
|||
'rule_name': 'coffee',
|
||||
'extension': 'coffee',
|
||||
'inputs': [
|
||||
'script/compile-coffee',
|
||||
'script/compile-coffee.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
|
||||
],
|
||||
'action': [
|
||||
'sh',
|
||||
'script/compile-coffee',
|
||||
'python',
|
||||
'script/compile-coffee.py',
|
||||
'<(RULE_INPUT_PATH)',
|
||||
'<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).js',
|
||||
],
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# 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.
|
||||
|
||||
node --version > /dev/null 2>&1 || {
|
||||
if [ -e /opt/github/env.sh ]; then
|
||||
source /opt/github/env.sh
|
||||
else
|
||||
# Try Constructicon's PATH.
|
||||
export PATH="/usr/local/Cellar/node/0.8.21/bin:${PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
INPUT_FILE="${1}"
|
||||
OUTPUT_DIR=`dirname "$2"`
|
||||
|
||||
node_modules/.bin/coffee -c -o "$OUTPUT_DIR" "$INPUT_FILE"
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.util import *
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def main():
|
||||
input_file = sys.argv[1]
|
||||
output_dir = os.path.dirname(sys.argv[2])
|
||||
|
||||
node = get_node_path()
|
||||
coffee = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'coffee')
|
||||
subprocess.check_call([node, coffee, '-c', '-o', output_dir, input_file])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -68,3 +68,10 @@ def safe_mkdir(path):
|
|||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
|
||||
def get_node_path():
|
||||
node = os.path.join(os.path.dirname(__file__), '..', '..', 'node', 'node')
|
||||
if sys.platform == 'win32' or sys.platform == 'cygwin':
|
||||
node += '.exe'
|
||||
return node
|
||||
|
|
Загрузка…
Ссылка в новой задаче