How to use the ember-cli/lib/ext/promise.resolve function in ember-cli

To help you get started, we’ve selected a few ember-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixelhandler / ember-jsonapi-resources / blueprints / jsonapi-resource / index.js View on Github external
_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) {
github achambers / ember-cli-deploy-original / tests / helpers / mock-s3-uploader.js View on Github external
MockS3Uploader.prototype.uploadFile = function(params) {
  MockS3Uploader.paths = MockS3Uploader.paths || [];

  MockS3Uploader.paths.push(params.filePath);

  return Promise.resolve(params.filePath);
};
github achambers / ember-cli-deploy-original / tests / helpers / mock-task.js View on Github external
MockTask.prototype.run = function(options) {
  return Promise.resolve(options);
};
github offirgolan / ember-addon-genie / blueprints / genie-coverage / index.js View on Github external
_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
          };
        });
github Vestorly / ember-cli-s3-sync / lib / utils / s3-tool.js View on Github external
.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() {

        });
      });
github nathanhammond / ember-capture / lib / commands / capture.js View on Github external
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({
github ember-cli-deploy / ember-cli-deploy / lib / utilities / configuration-reader.js View on Github external
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
      });
    });
  }
});
github ember-cli-deploy / ember-cli-deploy / lib / utilities / pipeline.js View on Github external
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));
};
github ember-admin / ember-cli-admin / lib / proccess-text-content.js View on Github external
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){
github achambers / ember-cli-deploy-original / lib / validators / index-config.js View on Github external
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);
};