decaffeinate: Run post-processing cleanups on CommandRunner.coffee and 25 other files
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Sanity-check the conversion and remove this comment.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS207: Consider shorter variations of null checks
|
* DS207: Consider shorter variations of null checks
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-undef,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -88,13 +97,13 @@ module.exports = (CompileManager = {
|
|||||||
// only run chktex on LaTeX files (not knitr .Rtex files or any others)
|
// only run chktex on LaTeX files (not knitr .Rtex files or any others)
|
||||||
const isLaTeXFile = request.rootResourcePath != null ? request.rootResourcePath.match(/\.tex$/i) : undefined;
|
const isLaTeXFile = request.rootResourcePath != null ? request.rootResourcePath.match(/\.tex$/i) : undefined;
|
||||||
if ((request.check != null) && isLaTeXFile) {
|
if ((request.check != null) && isLaTeXFile) {
|
||||||
env['CHKTEX_OPTIONS'] = '-nall -e9 -e10 -w15 -w16';
|
env.CHKTEX_OPTIONS = '-nall -e9 -e10 -w15 -w16';
|
||||||
env['CHKTEX_ULIMIT_OPTIONS'] = '-t 5 -v 64000';
|
env.CHKTEX_ULIMIT_OPTIONS = '-t 5 -v 64000';
|
||||||
if (request.check === 'error') {
|
if (request.check === 'error') {
|
||||||
env['CHKTEX_EXIT_ON_ERROR'] = 1;
|
env.CHKTEX_EXIT_ON_ERROR = 1;
|
||||||
}
|
}
|
||||||
if (request.check === 'validate') {
|
if (request.check === 'validate') {
|
||||||
env['CHKTEX_VALIDATE'] = 1;
|
env.CHKTEX_VALIDATE = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +346,7 @@ module.exports = (CompileManager = {
|
|||||||
|
|
||||||
_parseSynctexFromCodeOutput(output) {
|
_parseSynctexFromCodeOutput(output) {
|
||||||
const results = [];
|
const results = [];
|
||||||
for (let line of Array.from(output.split("\n"))) {
|
for (const line of Array.from(output.split("\n"))) {
|
||||||
const [node, page, h, v, width, height] = Array.from(line.split("\t"));
|
const [node, page, h, v, width, height] = Array.from(line.split("\t"));
|
||||||
if (node === "NODE") {
|
if (node === "NODE") {
|
||||||
results.push({
|
results.push({
|
||||||
@@ -387,7 +396,7 @@ module.exports = (CompileManager = {
|
|||||||
if (error != null) { return callback(error); }
|
if (error != null) { return callback(error); }
|
||||||
return fs.readFile(compileDir + "/" + file_name + ".wc", "utf-8", function(err, stdout) {
|
return fs.readFile(compileDir + "/" + file_name + ".wc", "utf-8", function(err, stdout) {
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
//call it node_err so sentry doesn't use random path error as unique id so it can't be ignored
|
// call it node_err so sentry doesn't use random path error as unique id so it can't be ignored
|
||||||
logger.err({node_err:err, command, compileDir, project_id, user_id}, "error reading word count output");
|
logger.err({node_err:err, command, compileDir, project_id, user_id}, "error reading word count output");
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
@@ -412,37 +421,37 @@ module.exports = (CompileManager = {
|
|||||||
errors: 0,
|
errors: 0,
|
||||||
messages: ""
|
messages: ""
|
||||||
};
|
};
|
||||||
for (let line of Array.from(output.split("\n"))) {
|
for (const line of Array.from(output.split("\n"))) {
|
||||||
const [data, info] = Array.from(line.split(":"));
|
const [data, info] = Array.from(line.split(":"));
|
||||||
if (data.indexOf("Encoding") > -1) {
|
if (data.indexOf("Encoding") > -1) {
|
||||||
results['encode'] = info.trim();
|
results.encode = info.trim();
|
||||||
}
|
}
|
||||||
if (data.indexOf("in text") > -1) {
|
if (data.indexOf("in text") > -1) {
|
||||||
results['textWords'] = parseInt(info, 10);
|
results.textWords = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("in head") > -1) {
|
if (data.indexOf("in head") > -1) {
|
||||||
results['headWords'] = parseInt(info, 10);
|
results.headWords = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("outside") > -1) {
|
if (data.indexOf("outside") > -1) {
|
||||||
results['outside'] = parseInt(info, 10);
|
results.outside = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("of head") > -1) {
|
if (data.indexOf("of head") > -1) {
|
||||||
results['headers'] = parseInt(info, 10);
|
results.headers = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("Number of floats/tables/figures") > -1) {
|
if (data.indexOf("Number of floats/tables/figures") > -1) {
|
||||||
results['elements'] = parseInt(info, 10);
|
results.elements = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("Number of math inlines") > -1) {
|
if (data.indexOf("Number of math inlines") > -1) {
|
||||||
results['mathInline'] = parseInt(info, 10);
|
results.mathInline = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data.indexOf("Number of math displayed") > -1) {
|
if (data.indexOf("Number of math displayed") > -1) {
|
||||||
results['mathDisplay'] = parseInt(info, 10);
|
results.mathDisplay = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (data === "(errors") { // errors reported as (errors:123)
|
if (data === "(errors") { // errors reported as (errors:123)
|
||||||
results['errors'] = parseInt(info, 10);
|
results.errors = parseInt(info, 10);
|
||||||
}
|
}
|
||||||
if (line.indexOf("!!! ") > -1) { // errors logged as !!! message !!!
|
if (line.indexOf("!!! ") > -1) { // errors logged as !!! message !!!
|
||||||
results['messages'] += line + "\n";
|
results.messages += line + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
let ContentTypeMapper;
|
let ContentTypeMapper;
|
||||||
const Path = require('path');
|
const Path = require('path');
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Sanity-check the conversion and remove this comment.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -140,7 +148,7 @@ module.exports = (DockerRunner = {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
containerReturned = true;
|
containerReturned = true;
|
||||||
__guard__(options != null ? options.HostConfig : undefined, x => x.SecurityOpt = null); //small log line
|
__guard__(options != null ? options.HostConfig : undefined, x => x.SecurityOpt = null); // small log line
|
||||||
logger.log({err, exitCode, options}, "docker container has exited");
|
logger.log({err, exitCode, options}, "docker container has exited");
|
||||||
return callbackIfFinished();
|
return callbackIfFinished();
|
||||||
});
|
});
|
||||||
@@ -164,7 +172,7 @@ module.exports = (DockerRunner = {
|
|||||||
|
|
||||||
// merge settings and environment parameter
|
// merge settings and environment parameter
|
||||||
const env = {};
|
const env = {};
|
||||||
for (let src of [Settings.clsi.docker.env, environment || {}]) {
|
for (const src of [Settings.clsi.docker.env, environment || {}]) {
|
||||||
for (key in src) { value = src[key]; env[key] = value; }
|
for (key in src) { value = src[key]; env[key] = value; }
|
||||||
}
|
}
|
||||||
// set the path based on the image year
|
// set the path based on the image year
|
||||||
@@ -173,7 +181,7 @@ module.exports = (DockerRunner = {
|
|||||||
} else {
|
} else {
|
||||||
year = "2014";
|
year = "2014";
|
||||||
}
|
}
|
||||||
env['PATH'] = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/${year}/bin/x86_64-linux/`;
|
env.PATH = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/${year}/bin/x86_64-linux/`;
|
||||||
const options = {
|
const options = {
|
||||||
"Cmd" : command,
|
"Cmd" : command,
|
||||||
"Image" : image,
|
"Image" : image,
|
||||||
@@ -208,7 +216,7 @@ module.exports = (DockerRunner = {
|
|||||||
|
|
||||||
|
|
||||||
if ((Settings.path != null ? Settings.path.synctexBinHostPath : undefined) != null) {
|
if ((Settings.path != null ? Settings.path.synctexBinHostPath : undefined) != null) {
|
||||||
options["HostConfig"]["Binds"].push(`${Settings.path.synctexBinHostPath}:/opt/synctex:ro`);
|
options.HostConfig.Binds.push(`${Settings.path.synctexBinHostPath}:/opt/synctex:ro`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.clsi.docker.seccomp_profile != null) {
|
if (Settings.clsi.docker.seccomp_profile != null) {
|
||||||
@@ -254,7 +262,7 @@ module.exports = (DockerRunner = {
|
|||||||
})
|
})
|
||||||
;
|
;
|
||||||
const jobs = [];
|
const jobs = [];
|
||||||
for (let vol in volumes) {
|
for (const vol in volumes) {
|
||||||
(vol => jobs.push(cb => checkVolume(vol, cb)))(vol);
|
(vol => jobs.push(cb => checkVolume(vol, cb)))(vol);
|
||||||
}
|
}
|
||||||
return async.series(jobs, callback);
|
return async.series(jobs, callback);
|
||||||
@@ -279,7 +287,7 @@ module.exports = (DockerRunner = {
|
|||||||
DockerRunner.attachToContainer(options.name, attachStreamHandler, function(error){
|
DockerRunner.attachToContainer(options.name, attachStreamHandler, function(error){
|
||||||
if (error != null) { return callback(error); }
|
if (error != null) { return callback(error); }
|
||||||
return container.start(function(error) {
|
return container.start(function(error) {
|
||||||
if ((error != null) && ((error != null ? error.statusCode : undefined) !== 304)) { //already running
|
if ((error != null) && ((error != null ? error.statusCode : undefined) !== 304)) { // already running
|
||||||
return callback(error);
|
return callback(error);
|
||||||
} else {
|
} else {
|
||||||
return callback();
|
return callback();
|
||||||
@@ -434,7 +442,7 @@ module.exports = (DockerRunner = {
|
|||||||
return dockerode.listContainers({all: true}, function(error, containers) {
|
return dockerode.listContainers({all: true}, function(error, containers) {
|
||||||
if (error != null) { return callback(error); }
|
if (error != null) { return callback(error); }
|
||||||
const jobs = [];
|
const jobs = [];
|
||||||
for (let container of Array.from(containers || [])) {
|
for (const container of Array.from(containers || [])) {
|
||||||
(container =>
|
(container =>
|
||||||
DockerRunner.examineOldContainer(container, function(err, name, id, ttl) {
|
DockerRunner.examineOldContainer(container, function(err, name, id, ttl) {
|
||||||
if ((name.slice(0, 9) === '/project-') && (ttl <= 0)) {
|
if ((name.slice(0, 9) === '/project-') && (ttl <= 0)) {
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-useless-escape,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
no-proto,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
let Errors;
|
let Errors;
|
||||||
var NotFoundError = function(message) {
|
var NotFoundError = function(message) {
|
||||||
const error = new Error(message);
|
const error = new Error(message);
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Sanity-check the conversion and remove this comment.
|
||||||
module.exports = require("metrics-sharelatex");
|
module.exports = require("metrics-sharelatex");
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
no-useless-escape,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -17,7 +25,7 @@ module.exports = (OutputFileFinder = {
|
|||||||
findOutputFiles(resources, directory, callback) {
|
findOutputFiles(resources, directory, callback) {
|
||||||
if (callback == null) { callback = function(error, outputFiles, allFiles) {}; }
|
if (callback == null) { callback = function(error, outputFiles, allFiles) {}; }
|
||||||
const incomingResources = {};
|
const incomingResources = {};
|
||||||
for (let resource of Array.from(resources)) {
|
for (const resource of Array.from(resources)) {
|
||||||
incomingResources[resource.path] = true;
|
incomingResources[resource.path] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +36,7 @@ module.exports = (OutputFileFinder = {
|
|||||||
return callback(error);
|
return callback(error);
|
||||||
}
|
}
|
||||||
const outputFiles = [];
|
const outputFiles = [];
|
||||||
for (let file of Array.from(allFiles)) {
|
for (const file of Array.from(allFiles)) {
|
||||||
if (!incomingResources[file]) {
|
if (!incomingResources[file]) {
|
||||||
outputFiles.push({
|
outputFiles.push({
|
||||||
path: file,
|
path: file,
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-undef,
|
||||||
|
no-unused-vars,
|
||||||
|
node/no-deprecated-api,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-control-regex,
|
||||||
|
no-throw-literal,
|
||||||
|
no-unused-vars,
|
||||||
|
no-useless-escape,
|
||||||
|
standard/no-callback-literal,
|
||||||
|
valid-typeof,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -172,7 +183,7 @@ module.exports = (RequestParser = {
|
|||||||
|
|
||||||
_checkPath(path) {
|
_checkPath(path) {
|
||||||
// check that the request does not use a relative path
|
// check that the request does not use a relative path
|
||||||
for (let dir of Array.from(path.split('/'))) {
|
for (const dir of Array.from(path.split('/'))) {
|
||||||
if (dir === '..') {
|
if (dir === '..') {
|
||||||
throw "relative path in root resource";
|
throw "relative path in root resource";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -62,10 +68,10 @@ module.exports = (ResourceStateManager = {
|
|||||||
if (bytesRead === size) {
|
if (bytesRead === size) {
|
||||||
logger.error({file:stateFile, size, bytesRead}, "project state file truncated");
|
logger.error({file:stateFile, size, bytesRead}, "project state file truncated");
|
||||||
}
|
}
|
||||||
const array = __guard__(result != null ? result.toString() : undefined, x => x.split("\n")) || [],
|
const array = __guard__(result != null ? result.toString() : undefined, x => x.split("\n")) || [];
|
||||||
adjustedLength = Math.max(array.length, 1),
|
const adjustedLength = Math.max(array.length, 1);
|
||||||
resourceList = array.slice(0, adjustedLength - 1),
|
const resourceList = array.slice(0, adjustedLength - 1);
|
||||||
oldState = array[adjustedLength - 1];
|
const oldState = array[adjustedLength - 1];
|
||||||
const newState = `stateHash:${state}`;
|
const newState = `stateHash:${state}`;
|
||||||
logger.log({state, oldState, basePath, stateMatches: (newState === oldState)}, "checking sync state");
|
logger.log({state, oldState, basePath, stateMatches: (newState === oldState)}, "checking sync state");
|
||||||
if (newState !== oldState) {
|
if (newState !== oldState) {
|
||||||
@@ -82,7 +88,7 @@ module.exports = (ResourceStateManager = {
|
|||||||
let file;
|
let file;
|
||||||
if (callback == null) { callback = function(error) {}; }
|
if (callback == null) { callback = function(error) {}; }
|
||||||
for (file of Array.from(resources || [])) {
|
for (file of Array.from(resources || [])) {
|
||||||
for (let dir of Array.from(__guard__(file != null ? file.path : undefined, x => x.split('/')))) {
|
for (const dir of Array.from(__guard__(file != null ? file.path : undefined, x => x.split('/')))) {
|
||||||
if (dir === '..') {
|
if (dir === '..') {
|
||||||
return callback(new Error("relative path in resource file list"));
|
return callback(new Error("relative path in resource file list"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
no-useless-escape,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -105,7 +114,7 @@ module.exports = (ResourceWriter = {
|
|||||||
if (error != null) { return callback(error); }
|
if (error != null) { return callback(error); }
|
||||||
|
|
||||||
const jobs = [];
|
const jobs = [];
|
||||||
for (let file of Array.from(outputFiles || [])) {
|
for (const file of Array.from(outputFiles || [])) {
|
||||||
(function(file) {
|
(function(file) {
|
||||||
const { path } = file;
|
const { path } = file;
|
||||||
let should_delete = true;
|
let should_delete = true;
|
||||||
@@ -182,7 +191,7 @@ module.exports = (ResourceWriter = {
|
|||||||
logger.err({err, project_id, path, resource_url:resource.url, modified:resource.modified}, "error downloading file for resources");
|
logger.err({err, project_id, path, resource_url:resource.url, modified:resource.modified}, "error downloading file for resources");
|
||||||
}
|
}
|
||||||
return callback();
|
return callback();
|
||||||
}); //try and continue compiling even if http resource can not be downloaded at this time
|
}); // try and continue compiling even if http resource can not be downloaded at this time
|
||||||
} else {
|
} else {
|
||||||
const process = require("process");
|
const process = require("process");
|
||||||
fs.writeFile(path, resource.content, callback);
|
fs.writeFile(path, resource.content, callback);
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-unused-vars,
|
||||||
|
node/no-deprecated-api,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
no-cond-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
node/no-deprecated-api,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -28,7 +36,7 @@ module.exports = (ForbidSymlinks = function(staticFn, root, options) {
|
|||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
}
|
}
|
||||||
// check that the file does not use a relative path
|
// check that the file does not use a relative path
|
||||||
for (let dir of Array.from(file.split('/'))) {
|
for (const dir of Array.from(file.split('/'))) {
|
||||||
if (dir === '..') {
|
if (dir === '..') {
|
||||||
logger.warn({path}, "attempt to use a relative path");
|
logger.warn({path}, "attempt to use a relative path");
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
@@ -21,7 +27,7 @@ module.exports = (TikzManager = {
|
|||||||
checkMainFile(compileDir, mainFile, resources, callback) {
|
checkMainFile(compileDir, mainFile, resources, callback) {
|
||||||
// if there's already an output.tex file, we don't want to touch it
|
// if there's already an output.tex file, we don't want to touch it
|
||||||
if (callback == null) { callback = function(error, needsMainFile) {}; }
|
if (callback == null) { callback = function(error, needsMainFile) {}; }
|
||||||
for (let resource of Array.from(resources)) {
|
for (const resource of Array.from(resources)) {
|
||||||
if (resource.path === "output.tex") {
|
if (resource.path === "output.tex") {
|
||||||
logger.log({compileDir, mainFile}, "output.tex already in resources");
|
logger.log({compileDir, mainFile}, "output.tex already in resources");
|
||||||
return callback(null, false);
|
return callback(null, false);
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
node/no-deprecated-api,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/* eslint-disable
|
||||||
|
no-console,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|||||||
Reference in New Issue
Block a user