Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
fileList.forEach(function (file) {
var revisionId = file.filename,
metaPath = path.join(remoteDir, revisionId, "meta.json");
filePromises.push(readFile(metaPath, revisionId, sftp));
});
Promise.all(filePromises).then(resolve, reject);
});
};
conn.sftp(function (err, sftp) {
if (err) {
reject(err);
return;
}
Promise.all([
uploadIndex(sftp, indexPath, indexContents),
uploadMeta(sftp, metaPath, metaContents)
]).then(resolve, reject);
});
});
run: function(environment, config, verbose) {
var _this = this;
var promises = [];
var endpoints = config.index.endpoints.map(function(endpoint) {
return (endpoint.match(/\/front_end_builds\/builds$/) ?
endpoint :
endpoint + '/front_end_builds/builds');
});
endpoints.forEach(function(endpoint) {
promises.push(_this.notifyEndpoint(endpoint, config, verbose));
});
this.ui.pleasantProgress.start(chalk.green('Notifying ' + endpoints.join(', ')), chalk.green('.'));
return Promise.all(promises).then(function(posts) {
_this.ui.writeLine('Endpoints successfully notified.');
_this.ui.pleasantProgress.stop();
}).catch(function(reason){
_this.ui.writeLine(chalk.red(reason));
});
}
});
var processed = files.map(function(item){
return [item, [distDir, item].join('/'), [releaseDir, item].join('/')];
});
processed.push(['index.html', [distDir, 'index.html'].join('/'), [releaseDir, 'index.html'].join('/')]);
var promises = processed.map(function(item){
var fileName = item[0];
return this.ssh.put(item[1], item[2]).then(function() {
this.log(fileName + " uploaded.");
}.bind(this), function(error) {
this.log(fileName + " failed to upload.", {color: 'red'});
this.log(error, {color: 'red'});
}.bind(this));
}.bind(this));
return Promise.all(promises);
},
})
},
originBlueprintName: 'jsonapi-model'
});
var otherOptions = merge({}, options);
var promises = [
this._processBlueprint(type, 'jsonapi-model', modelOptions),
this._processBlueprint(type, 'jsonapi-adapter', otherOptions),
this._processBlueprint(type, 'jsonapi-serializer', otherOptions),
this._processBlueprint(type, 'jsonapi-service', otherOptions),
this._processBlueprint(type, 'jsonapi-initializer', otherOptions)
];
if (!!options.project.pkg['ember-addon']) {
promies.push( this._processBlueprint(type, 'addon-import', modelOptions) );
}
return Promise.all(promises);
}
};
filePath: filePath
};
var promise = uploader.uploadFile(params)
.then(function(uploadedFilePath) {
var message = chalk.green('\nSuccessfully uploaded: ' + uploadedFilePath);
ui.write(message);
}, function(error, filePath) {
var message = chalk.red('\nUpload failed: ' + filePath);
ui.write(message);
});
promises.push(promise);
});
var promise = Promise.all(promises)
.then(function() {
ui.write(chalk.bold.gray('\n\nTo deploy index.html run:'));
ui.write(chalk.gray('\nember deploy:index\n\n'));
});
return promise;
};
var expressServer = new ExpressServer({
ui: this.ui,
project: this.project,
watcher: watcher,
serverRoot: serverRoot,
serverWatcher: serverWatcher
});
var captureServer = new CaptureServer({
ui: this.ui,
analytics: this.analytics,
project: this.project,
expressServer: expressServer
});
return Promise.all([
expressServer.start(options),
captureServer.start(options)
]).then(function(servers) {
return new Promise(function(resolve, reject) {
var captureServer = servers[1];
captureServer.on('done', resolve);
});
});
}
});
if (include) {
locales.push(locale.locale);
}
return include;
});
var promises = data.map(function(item) {
var dataRelativePath = path.join('blueprints', 'locale', 'data', item.locale + '.js');
var dataFullPath = path.join(project.root, dataRelativePath);
var dataContents = '\'use strict;\'\nmodule.exports = ' + serialize(item) + ';';
return writeFile(dataFullPath, dataContents);
});
return Promise.all(promises).then(function() {
var relativePath = path.join('addon', 'utils', 'codes.js');
var fullPath = path.join(project.root, relativePath);
var contents = 'export default ' + serialize(locales) + ';';
return writeFile(fullPath, contents).then(function() {
ui.writeLine("Extracted " + locales.length + " locales");
});
});
},