var signApp = function () { var identity = utils.getSigningId(); if (identity) { var cmd = 'codesign --deep --force --sign "' + identity + '" "' + finalAppDir.path() + '"'; gulpUtil.log('Signing with:', cmd); return Q.nfcall(child_process.exec, cmd); } else { return Q(); } }
/** * get a given bundle * curl -X POST http://localhost:3000/api/bundle/<id> */ app.get('/api/bundle/:id', function(req, res) { Q.nfcall(request.get, config.b4db + '/' + req.params.id) .then(function(args) { let couchRes = args[0], bundle = JSON.parse(args[1]); res.json(couchRes.statusCode, bundle); }, function(err) { res.json(502, { error: "bad_gateway", reason: err.code }); }); });
/** * Returns a promise that will be resolved as soon as the file is created. * @param config * @returns {promise|*|Q.promise} */ function buildRdpFile(config) { var deferred = Q.defer(); var fileContent = getRdpFileContent(config); var fileName = path.normalize(os.tmpdir() + '/' + sanitize(config.address) + '.rdp'); Q.nfcall(fs.writeFile, fileName, fileContent) .then(function() { deferred.resolve(fileName); }) .fail(deferred.reject); return deferred.promise; }
/** * set the specified bundle's name with the specified name * curl -X PUT http://localhost:3000/api/bundle/<id>/name/<name> */ app.put('/api/bundle/:id/name/:name', function(req, res) { Q.nfcall(request.get, config.b4db + '/' + req.params.id) .then(function(args) { let couchRes = args[0], bundle = JSON.parse(args[1]); if (couchRes.statusCode !== 200) { return [couchRes, bundle]; } bundle.name = req.params.name; return Q.nfcall(request.put, { url: config.b4db + '/' + req.params.id, json: bundle }); }) .then(function(args) { let couchRes = args[0], body = args[1]; res.json(couchRes.statusCode, body); }) .catch(function(err) { res.json(502, { error: "bad_gateway", reason: err.code }); }); });
return Promise.nfcall(fs.stat, originalOutput).get('size'); }) .then((size) => {
args = yield Q.nfcall(request, config.b4db + req.params.id), couchRes = args[0], bundle = JSON.parse(args[1]);
return Promise.nfcall(fs.stat, originalOutput).get('size'); }).then(function (size) { opts.size = size;