How to use the ember-cli/lib/models/command.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 mvdwg / ember-cli-updater / lib / commands / update.js View on Github external
/* eslint-env node */
'use strict';

var Command = require('ember-cli/lib/models/command');

function cleanupVersion(rawVersion) {
  return 'v' + rawVersion.replace(/[~^]/, '');
}

module.exports = Command.extend({
  name: 'update',
  description: 'Update your ember-cli package.json from current version to the specified version',
  works: 'insideProject',

  run: function(commandOptions, rawArgs) {
    var path = require('path');
    var toTag = rawArgs.shift();

    if (!toTag) {
      this.ui.writeError('Usage: ember update ');
      return;
    }

    if (!/^v/.test(toTag)) {
      toTag = 'v' + toTag;
    }
github adopted-ember-addons / ember-electron / lib / commands / base.js View on Github external
'use strict';

const Command = require('ember-cli/lib/models/command');
const ElectronTask = require('../tasks/electron');
const ElectronMakeTask = require('../tasks/make');
const ElectronPackageTask = require('../tasks/package');
const YarnOrNpmTask = require('../tasks/yarn-or-npm');
const prepareRunCommand = require('../utils/prepare-run-command');

module.exports = Command.extend({
  init() {
    this._super(...arguments);
    Object.assign(this.tasks, {
      'Electron': ElectronTask,
      'ElectronMake': ElectronMakeTask,
      'ElectronPackage': ElectronPackageTask,
      'YarnOrNpm': YarnOrNpmTask
    });
  },

  async prepareRun() {
    // Set up the yarn/npm environment variable so forge uses the right package
    // manager
    await this.runTask('YarnOrNpm');

    await prepareRunCommand(this.project);
github nathanhammond / ember-capture / lib / commands / capture.js View on Github external
var path        = require('path');
var Command     = require('ember-cli/lib/models/command');
var Promise     = require('ember-cli/lib/ext/promise');
var SilentError = require('silent-error');
var PortFinder  = require('portfinder');
var win         = require('ember-cli/lib/utilities/windows-admin');
var EOL         = require('os').EOL;
var CaptureTask = require('../tasks/capture');

PortFinder.basePort = 49152;

var getPort = Promise.denodeify(PortFinder.getPort);
var defaultPort = process.env.PORT || 4200;
var defaultCapturePort = process.env.CAPTUREPORT || 3000;

module.exports = Command.extend({
  name: 'capture',
  description: 'Captures all states of your application.',

  availableOptions: [
    // generic
    { name: 'environment',         type: String,  default: 'capture',     aliases: ['e', { 'dev': 'development' }, { 'prod': 'production' }] },

    // ember serve options
    { name: 'port',                type: Number,  default: defaultPort,   aliases: ['p'] },
    { name: 'host',                type: String,                          aliases: ['H'],     description: 'Listens on all interfaces by default' },
    { name: 'proxy',               type: String,                          aliases: ['pr', 'pxy'] },
    { name: 'insecure-proxy',      type: Boolean, default: false,         aliases: ['inspr'], description: 'Set false to proxy self-signed SSL certificates' },
    { name: 'watcher',             type: String,  default: 'events',      aliases: ['w'] },
    { name: 'output-path',         type: path,    default: 'dist/',       aliases: ['op', 'out'] },
    { name: 'ssl',                 type: Boolean, default: false },
    { name: 'ssl-key',             type: String,  default: 'ssl/server.key' },
github angular / angular-cli / addon / ng2 / commands / format.js View on Github external
/* jshint node: true */
'use strict';

var Command = require('ember-cli/lib/models/command');
var FormatTask = require('../tasks/format');

module.exports = Command.extend({
  name: 'format',
  description: 'Formats code in existing project',
  works: 'insideProject',
  run: function () {
    var formatTask =
      new FormatTask({
        ui: this.ui,
        analytics: this.analytics,
        project: this.project
      });

    return formatTask.run();
  }
});
github typed-ember / ember-cli-typescript / lib / commands / precompile.js View on Github external
/* eslint-env node */
'use strict';

const tmpdir = require('../utilities/tmpdir');
const execa = require('execa');
const fs = require('fs-extra');
const path = require('path');
const walkSync = require('walk-sync');
const Command = require('ember-cli/lib/models/command'); // eslint-disable-line node/no-unpublished-require

const PRECOMPILE_MANIFEST = 'tmp/.ts-precompile-manifest';

module.exports = Command.extend({
  name: 'ts:precompile',
  works: 'insideProject',
  description:
    'Generates JS and declaration files from TypeScript sources in preparation for publishing.',

  availableOptions: [{ name: 'manifest-path', type: String, default: PRECOMPILE_MANIFEST }],

  run(options) {
    let manifestPath = options.manifestPath;
    let project = this.project;
    let outDir = `${tmpdir()}/e-c-ts-precompile-${process.pid}`;

    // prettier-ignore
    let flags = [
      '--outDir', outDir,
      '--rootDir', project.root,
github isleofcode / corber / lib / commands / -command.js View on Github external
const Command      = require('ember-cli/lib/models/command');
const Leek         = require('leek');
const ConfigStore  = require('configstore');
const uuid         = require('uuid');
const _get         = require('lodash').get;
const chalk        = require('chalk');
const logger       = require('../utils/logger');
const getVersions  = require('../utils/get-versions');

module.exports = Command.extend({
  // use `scope` instead of `works` in sub-objects
  works: 'everywhere',
  scope: 'insideProject',

  //h/t ember-cli
  getUUID() {
    let configStore = new ConfigStore('corber');
    let id = configStore.get('uuid');
    if (id === undefined) {
      id = uuid.v4().toString();
      configStore.set('uuid', id);
    }

    return id;
  },
github adopted-ember-addons / ember-electron / lib / commands / -command.js View on Github external
'use strict';

const Command = require('ember-cli/lib/models/command');

module.exports = Command.extend({
  init() {
    process.env.EMBER_CLI_ELECTRON = true;

    if (this._super && this._super.init) {
      this._super.init.apply(this, arguments);
    }
  },
});
github angular / angular-cli / packages / angular-cli / commands / completion.js View on Github external
/*eslint-disable no-console */
'use strict';

var Command = require('ember-cli/lib/models/command');
var path = require('path');
var fs = require('fs');

module.exports = Command.extend({
  name: 'completion',
  description: 'Adds autocomplete functionality to `ng` commands and subcommands',
  works: 'everywhere',
  run: function() {
    var scriptPath = path.resolve(__dirname, '..', 'utilities', 'completion.sh');
    var scriptOutput = fs.readFileSync(scriptPath, 'utf8');

    console.log(scriptOutput);
  }
});
github angular / angular-cli / addon / ng2 / commands / install.js View on Github external
'use strict';

var Command         = require('ember-cli/lib/models/command');
var SilentError     = require('silent-error');
var Promise         = require('ember-cli/lib/ext/promise');
var LibInstallTask  = require('../tasks/lib-install');

module.exports = Command.extend({
  name: 'install',
  description: 'Adds 3rd party library to existing project',
  works: 'insideProject',
  availableOptions: [
    { name: 'skip-injection', type: Boolean, default: false, aliases: ['s'] },
    { name: 'auto-injection', type: Boolean, default: false, aliases: ['ai'] },
  ],
  run: function (commandOptions, rawArgs) {
    if (!rawArgs.length) {
      var msg = 'The `ng install` command must take an argument with ' +
        'a package name.';

      return Promise.reject(new SilentError(msg));
    }

    var libInstallTask = new LibInstallTask({