mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -04:00
- broker.coffee contains the xhr stuff - COR enabled on the go broker - POST body reflection works
51 lines
1.3 KiB
CoffeeScript
51 lines
1.3 KiB
CoffeeScript
fs = require 'fs'
|
|
{spawn, exec} = require 'child_process'
|
|
|
|
# All coffeescript files required.
|
|
FILES = [
|
|
'shims.coffee'
|
|
'util.coffee'
|
|
'proxypair.coffee'
|
|
'websocket.coffee'
|
|
'broker.coffee'
|
|
'snowflake.coffee'
|
|
]
|
|
FILES_TEST = [
|
|
'snowflake_test.coffee'
|
|
]
|
|
FILES_ALL = FILES.concat FILES_TEST
|
|
OUTFILE = 'build/snowflake.coffee'
|
|
STATIC = 'static'
|
|
|
|
concatCoffeeFiles = -> exec 'cat ' + FILES.join(' ') + ' | cat > ' + OUTFILE
|
|
|
|
copyStaticFiles = -> exec 'cp ' + STATIC + '/* build/'
|
|
|
|
compileCoffee = ->
|
|
exec 'coffee -o build -c build/snowflake.coffee', (err, stdout, stderr) ->
|
|
throw err if err
|
|
|
|
task 'test', 'snowflake unit tests', ->
|
|
exec 'mkdir -p test'
|
|
testFile = 'test/snowflake.bundle.coffee'
|
|
exec 'cat ' + FILES.join(' ') + ' snowflake_test.coffee | cat > ' + testFile
|
|
exec 'coffee ' + testFile + ' -v', (err, stdout, stderr) ->
|
|
throw err if err
|
|
console.log stdout + stderr
|
|
|
|
task 'build', 'build the snowflake proxy', ->
|
|
exec 'mkdir -p build'
|
|
concatCoffeeFiles()
|
|
copyStaticFiles()
|
|
compileCoffee()
|
|
console.log 'Snowflake prepared.'
|
|
|
|
task 'lint', 'ensure idiomatic coffeescript', ->
|
|
spawn 'coffeelint', FILES_ALL, {
|
|
file: 'coffeelint.json'
|
|
stdio: 'inherit'
|
|
}
|
|
|
|
task 'clean', 'remove all built files', ->
|
|
exec 'rm -r build'
|
|
exec 'rm -r test'
|