mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
parent
aa27c0556c
commit
5321223240
1 changed files with 12 additions and 16 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/* global require, process */
|
/* global require, process */
|
||||||
|
|
||||||
var { exec, spawn } = require('child_process');
|
var { execSync, spawn } = require('child_process');
|
||||||
|
|
||||||
// All files required.
|
// All files required.
|
||||||
var FILES = [
|
var FILES = [
|
||||||
|
@ -38,11 +38,7 @@ var SHARED_FILES = [
|
||||||
var concatJS = function(outDir, init, outFile) {
|
var concatJS = function(outDir, init, outFile) {
|
||||||
var files;
|
var files;
|
||||||
files = FILES.concat(`init-${init}.js`);
|
files = FILES.concat(`init-${init}.js`);
|
||||||
return exec(`cat ${files.join(' ')} > ${outDir}/${outFile}`, function(err) {
|
execSync(`cat ${files.join(' ')} > ${outDir}/${outFile}`);
|
||||||
if (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var tasks = new Map();
|
var tasks = new Map();
|
||||||
|
@ -55,13 +51,13 @@ var task = function(key, msg, func) {
|
||||||
|
|
||||||
task('test', 'snowflake unit tests', function() {
|
task('test', 'snowflake unit tests', function() {
|
||||||
var jasmineFiles, outFile, proc;
|
var jasmineFiles, outFile, proc;
|
||||||
exec('mkdir -p test');
|
execSync('mkdir -p test');
|
||||||
exec('jasmine init >&-');
|
execSync('jasmine init >&-');
|
||||||
// Simply concat all the files because we're not using node exports.
|
// Simply concat all the files because we're not using node exports.
|
||||||
jasmineFiles = FILES.concat('init-testing.js', FILES_SPEC);
|
jasmineFiles = FILES.concat('init-testing.js', FILES_SPEC);
|
||||||
outFile = 'test/bundle.spec.js';
|
outFile = 'test/bundle.spec.js';
|
||||||
exec('echo "TESTING = true" > ' + outFile);
|
execSync('echo "TESTING = true" > ' + outFile);
|
||||||
exec('cat ' + jasmineFiles.join(' ') + ' | cat >> ' + outFile);
|
execSync('cat ' + jasmineFiles.join(' ') + ' | cat >> ' + outFile);
|
||||||
proc = spawn('jasmine', ['test/bundle.spec.js'], {
|
proc = spawn('jasmine', ['test/bundle.spec.js'], {
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
|
@ -71,27 +67,27 @@ task('test', 'snowflake unit tests', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
task('build', 'build the snowflake proxy', function() {
|
task('build', 'build the snowflake proxy', function() {
|
||||||
exec('rm -r build');
|
execSync('rm -r build');
|
||||||
exec('cp -r ' + STATIC + '/ build/');
|
execSync('cp -r ' + STATIC + '/ build/');
|
||||||
concatJS('build', 'badge', 'embed.js');
|
concatJS('build', 'badge', 'embed.js');
|
||||||
console.log('Snowflake prepared.');
|
console.log('Snowflake prepared.');
|
||||||
});
|
});
|
||||||
|
|
||||||
task('webext', 'build the webextension', function() {
|
task('webext', 'build the webextension', function() {
|
||||||
exec('mkdir -p webext');
|
execSync('mkdir -p webext');
|
||||||
exec(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} webext/`, { shell: '/bin/bash' });
|
execSync(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} webext/`, { shell: '/bin/bash' });
|
||||||
concatJS('webext', 'webext', 'snowflake.js');
|
concatJS('webext', 'webext', 'snowflake.js');
|
||||||
console.log('Webextension prepared.');
|
console.log('Webextension prepared.');
|
||||||
});
|
});
|
||||||
|
|
||||||
task('node', 'build the node binary', function() {
|
task('node', 'build the node binary', function() {
|
||||||
exec('mkdir -p build');
|
execSync('mkdir -p build');
|
||||||
concatJS('build', 'node', 'snowflake.js');
|
concatJS('build', 'node', 'snowflake.js');
|
||||||
console.log('Node prepared.');
|
console.log('Node prepared.');
|
||||||
});
|
});
|
||||||
|
|
||||||
task('clean', 'remove all built files', function() {
|
task('clean', 'remove all built files', function() {
|
||||||
exec('rm -r build test spec/support');
|
execSync('rm -r build test spec/support');
|
||||||
});
|
});
|
||||||
|
|
||||||
var cmd = process.argv[2];
|
var cmd = process.argv[2];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue