Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_processBlueprint: function(type, name, options) {
var mainBlueprint = Blueprint.lookup(name, {
ui: this.ui,
analytics: this.analytics,
project: this.project,
// need to check blueprint paths from addons
paths: options.paths || [ path.resolve(__dirname, '..', '..', 'blueprints') ]
});
return Promise.resolve()
.then(function() {
return mainBlueprint[type](options);
})
.then(function() {
if (name === 'addon-import') { return; }
var testBlueprint = mainBlueprint.lookupBlueprint(name + '-test', {
ui: this.ui,
analytics: this.analytics,
project: this.project,
ignoreMissing: true
});
if (!testBlueprint) { return; }
if (testBlueprint.locals === Blueprint.prototype.locals) {
testBlueprint.locals = function(options) {
MockS3Uploader.prototype.uploadFile = function(params) {
MockS3Uploader.paths = MockS3Uploader.paths || [];
MockS3Uploader.paths.push(params.filePath);
return Promise.resolve(params.filePath);
};
MockTask.prototype.run = function(options) {
return Promise.resolve(options);
};
_modifyTavisYaml: function() {
var self = this;
var travisYaml = utils.getContents.call(this, '.travis.yml', 'yaml');
travisYaml.addons = travisYaml.addons || {};
travisYaml.after_script = travisYaml.after_script || [];
return Promise.resolve().then(function() {
if(!travisYaml.addons.code_climate) {
travisYaml.before_install.push('npm install -g codeclimate-test-reporter');
travisYaml.after_script.push('codeclimate-test-reporter < coverage/lcov.info');
return utils.prompt.call(self, 'input', '[Genie] CodeClimate Repo Token:').then(function(response) {
var token = response.answer.trim();
if(token === '') {
token = '';
self.ui.writeLine('[Genie] No worries! You can always enter it in later in your .travis.yml file');
}
travisYaml.addons.code_climate = {
repo_token: token
};
});
.then(function(files) {
var bucketPath = !!prependPath ?
s3.config.params.Bucket + '/' + prependPath :
s3.config.params.Bucket;
ui.startProgress(chalk.green('Uploading files to ') +
bucketPath, chalk.green('.'));
var promise = Promise.resolve();
files.forEach(function(file) {
var filePath = path.join(prependPath, file.path);
var params = buildFileParameters(file.fullPath, {
Key: filePath,
ContentLength: file.stat.size
});
promise = promise.then(
module.exports.uploadFile(s3, ui, file.fullPath, params)
).then(function() {
});
});
run: function(commandOptions) {
var port = commandOptions.port ? Promise.resolve(commandOptions.port) : getPort({ host: commandOptions.host });
return port.then(function(port) {
commandOptions = assign({}, commandOptions, {
port: port,
baseURL: this.project.config(commandOptions.environment).baseURL || '/'
});
if (commandOptions.proxy) {
if (!commandOptions.proxy.match(/^(http:|https:)/)) {
var message = 'You need to include a protocol with the proxy URL.' + EOL + 'Try --proxy http://' + commandOptions.proxy;
return Promise.reject(new SilentError(message));
}
}
var capture = new CaptureTask({
read: function(){
var self = this;
var configResult;
try {
configResult = require(this.pathToConfig)(this.environment);
} catch(e) {
this.ui.writeError(e);
return Promise.reject(new Error('Cannot load configuration file \'' + this.pathToConfig + '\'. Note that the default location of the ember-cli-deploy config file is now \''+ self.defaultConfigPath + '\''));
}
return Promise.resolve(configResult).then(function(config){
if (!Object.keys(config).length) {
throw new SilentError('You are using the `' + self.environment + '` environment but have not specified any configuration.' +
'\n\nPlease add a `' + self.environment + '` section to your `config/deploy.js` file.' +
'\n\nFor more information, go to: `https://github.com/ember-cli/ember-cli-deploy#config-file`');
}
return new Config({
project: self.project,
rawConfig: config
});
});
}
});
Pipeline.prototype.execute = function(context) {
context = context || { };
var ui = this._ui;
ui.write(blue('Executing pipeline\n'));
return this._hooksWithoutDidFail(this.hookNames())
.reduce(this._addHookExecutionPromiseToPipelinePromiseChain.bind(this, ui), Promise.resolve(context))
.then(this._notifyPipelineCompletion.bind(this, ui))
.catch(this._handlePipelineFailure.bind(this, ui, context))
.catch(this._abortPipelineExecution.bind(this, ui));
};
path: fullPath,
originalContents: originalContents,
contents: contentsToWrite,
inserted: false
};
if (contentsToWrite !== originalContents) {
returnValue.inserted = true;
return writeFile(fullPath, contentsToWrite)
.then(function() {
return returnValue;
});
} else {
return Promise.resolve(returnValue);
}
},
renameFile: function(pathOld, pathNew){
if (!config.distDir) {
config.distDir = 'dist';
}
if (!indexConfig) {
var message = chalk.yellow(errorMessage.replace('{0}', 'index'));
return Promise.reject(new SilentError(message));
}
for (var prop in defaultIndexConfig) {
if (!indexConfig.hasOwnProperty(prop) || indexConfig[prop] == null) {
indexConfig[prop] = defaultIndexConfig[prop];
}
}
return Promise.resolve(config);
};