How to use the ember-cli/lib/models/task.extend 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 nathanhammond / ember-capture / lib / tasks / server / capture-server.js View on Github external
// Close this driver, remove it from the lookup.
    driver.quit().thenFinally(function() {
      delete drivers[browser];

      // If we're all out of drivers, we're done capturing.
      var driverCount = o_keys(drivers).length;
      if (driverCount === 0) {
        app.emit('done');
      }
    });
  });

  return app;
}

module.exports = Task.extend({
  captureServer: function(options) {
    if (this._captureServer) {
      return this._captureServer;
    }

    this._drivers = getDrivers(options);
    this._captureServer = createServer(this._drivers, options);

    var captureServerURL = 'http://' + this.displayHost(options.captureHost) + ':' + options.capturePort + '/';
    var serverURL = 'http' + (options.ssl ? 's' : '') + '://' + this.displayHost(options.host) + ':' + options.port + cleanBaseURL(options.baseURL) + options.testPage;

    // Bind to the expressServer being ready before kicking off.
    this.expressServer.on('listening', function() {
      o_keys(this._drivers).forEach(function(browser) {
        var driver = this._drivers[browser];
github nathanhammond / ember-capture / lib / tasks / capture.js View on Github external
/* jshint node: true */
'use strict';

var existsSync       = require('exists-sync');
var path             = require('path');
var ExpressServer    = require('ember-cli/lib/tasks/server/express-server');
var Promise          = require('ember-cli/lib/ext/promise');
var Task             = require('ember-cli/lib/models/task');
var Watcher          = require('ember-cli/lib/models/watcher');
var Builder          = require('ember-cli/lib/models/builder');
var ServerWatcher    = require('ember-cli/lib/models/server-watcher');
var CaptureServer    = require('./server/capture-server');

module.exports = Task.extend({
  run: function(options) {
    var builder = new Builder({
      ui: this.ui,
      outputPath: options.outputPath,
      project: this.project,
      environment: options.environment
    });

    var watcher = new Watcher({
      ui: this.ui,
      builder: builder,
      analytics: this.analytics,
      options: options
    });

    var serverRoot = './server';
github angular / angular-cli / addon / ng2 / tasks / e2e.js View on Github external
/* jshint node: true */
'use strict';

var Promise = require('ember-cli/lib/ext/promise');
var Task = require('ember-cli/lib/models/task');
var exec = Promise.denodeify(require('shelljs').exec);

module.exports = Task.extend({
  run: function () {
    return exec(`npm run e2e -- ${this.project.ngConfig.e2e.protractor.config}`);
  }
});
github angular / angular-cli / packages / angular-cli / tasks / npm-task.js View on Github external
/*eslint-disable no-console */
'use strict';

// Runs `npm install` in cwd

var chalk = require('chalk');
var Task  = require('ember-cli/lib/models/task');
var npm   = require('../utilities/npm');

module.exports = Task.extend({
  // The command to run: can be 'install' or 'uninstall'
  command: '',
  // Message to send to ui.startProgress
  startProgressMessage: '',
  // Message to send to ui.writeLine on completion
  completionMessage: '',

  init: function() {
    this.npm = this.npm || require('npm');
  },
  // Options: Boolean verbose
  run: function(options) {
    this.ui.startProgress(chalk.green(this.startProgressMessage), chalk.green('.'));

    var npmOptions = {
      loglevel: options.verbose ? 'verbose' : 'error',
github tedconf / ember-cli-front-end-builds / lib / tasks / deploy-index.js View on Github external
var passwdUser   = require('passwd-user');
var crypto       = require('crypto');

var sha, branch;

if (typeof execSync12 === 'function') {
  // node 0.12.x
  sha = execSync12('git rev-parse HEAD').toString().trim();
  branch = execSync12('git rev-parse --abbrev-ref HEAD').toString().trim();
} else {
  // node 0.10.x
  sha = execSync10('git rev-parse HEAD').stdout.trim();
  branch = execSync10('git rev-parse --abbrev-ref HEAD').stdout.trim();
}

module.exports = Task.extend({
  /*
    The consuming app's deploy.json can use Mustache for dynamic portions.

    e.g. distPrefix: "dist-{{SHA}}"
  */
  getDistPrefix: function(assetsConfig) {
    var prefix = '';

    if (assetsConfig && assetsConfig.distPrefix) {
      var str = assetsConfig.distPrefix;
      prefix = Mustache.render(str, {
        SHA: sha
      }) + '/';
    }

    return prefix;
github isleofcode / corber / lib / tasks / -task.js View on Github external
const Task = require('ember-cli/lib/models/task');

module.exports = Task.extend({
  init() {
    this._super.apply(this, arguments);

    process.env.CORBER = true;
  }
});
github tedconf / ember-cli-front-end-builds / lib / tasks / setup.js View on Github external
var Task         = require('ember-cli/lib/models/task');
var Promise      = require('ember-cli/lib/ext/promise');
var fs           = require('fs');

module.exports = Task.extend({
  options: null,

  run: function(environment, verbose) {
    var task = this,
        show = function(f) {
          return function() { return task[f].call(task); };
        },
        ask = function(f) {
          return show("ask" + f.charAt(0).toUpperCase() + f.substr(1));
        },
        deploy = {};

    return this.checkExisting()
      .then(show('welcome'))

      .then(ask('environment'))
github bobisjan / ember-format / lib / tasks / format-locales.js View on Github external
'use strict';

var chalk = require('chalk');
var cldr = require('cldr');
var path = require('path');
var fs = require('fs-extra');
var Promise = require('ember-cli/lib/ext/promise');
var Task = require('ember-cli/lib/models/task');
var serialize = require('serialize-javascript');

var writeFile = Promise.denodeify(fs.outputFile);

module.exports = Task.extend({

  run: function(options) {
    var ui = this.ui;
    var displayPath = this.displayPath();
    var fullPath = path.join(this.project.root, displayPath);
    var content = this.contentFor(options.locales);

    return writeFile(fullPath, content).then(function() {
      ui.writeLine('  ' + chalk.green('create') + ' ' + displayPath);
    });
  },

  contentFor: function(locales) {
    var data = {};

    locales.forEach(function(locale) {
github ember-cli-deploy / ember-cli-deploy / lib / tasks / deploy-index.js View on Github external
var ConfigurationReader = require('../utilities/configuration-reader');
var AdapterRegistry     = require('../utilities/adapter-registry');
var Promise             = require('ember-cli/lib/ext/promise');
var Task                = require('ember-cli/lib/models/task');
var chalk               = require('chalk');
var fs                  = require('fs');

var readFile = Promise.denodeify(fs.readFile);

module.exports = Task.extend({
  run: function(options) {
    var self = this;
    var ui = this.ui;
    return new ConfigurationReader({
      environment: options.environment,
      configFile: options.deployConfigFile,
      project: this.project,
      ui: ui
    }).read().then(function(config){
      var adapterType = config.get('store.type');
      var taggingAdapterType = config.get('tagging');
      var manifest = config.get('manifestPrefix');

      var adapterRegistry = new AdapterRegistry({ project: self.project });

      var Adapter = adapterRegistry
github angular / angular-cli / addon / ng2 / tasks / lib-uninstall.js View on Github external
var nodeModules = path.resolve('./node_modules');
var checkDirs   = ['components', 'providers', 'directives', 'pipes'];


function existsSync(path) {
  try {
    fs.accessSync(path);
    return true;
  }
  catch (e) {
    return false;
  }
}


module.exports = Task.extend({
  command: '',
  completionOKMessage: '',
  completionErrorMessage: 'Error uninstalling packages. Did you misspelt it?',

  run: function(options) {
    this.packages = options.packages || [];
    this.autoRemove = options.autoRemove || false;
    this.disableLogger();

    this.ui.startProgress(chalk.green('Uninstalling 3rd party package:',
      this.packages.join(', ')), chalk.green('.'));

    this.getPackagesDataBeforeRemoved(this.packages);

    this.npmOptions = ' --loglevel error --color always --optional --save-dev ' +
                      '--save-exact ' + !!options['save-exact'];