Skip to content

Commit

Permalink
Merge a1a5f6f into 9ef7434
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Jul 26, 2015
2 parents 9ef7434 + a1a5f6f commit d8962cf
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 140 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ environment:

# Install scripts. (runs after repo cloning)
install:
- git rev-parse HEAD
# Get the latest stable version of Node 0.STABLE.latest
- ps: Install-Product node $env:nodejs_version
# Install PhantomJS
Expand Down
5 changes: 4 additions & 1 deletion dev/windows/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.cpus = 1
vb.cpus = 2
vb.memory = 2048
vb.customize ["modifyvm", :id, "--vram", "256"]

end

config.vm.provision "shell", path: "install.ps1"
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = Command.extend({
return Promise.reject(new SilentError(message));
}

var blueprintOpts = {
var blueprintOpts = {
dryRun: commandOptions.dryRun,
blueprint: commandOptions.blueprint || this._defaultBlueprint(),
rawName: packageName,
Expand Down
14 changes: 8 additions & 6 deletions lib/models/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ Command.prototype.validateAndRun = function(args) {
}

if (this.works === 'insideProject' && !this.isWithinProject) {
this.ui.writeLine('You have to be inside an ember-cli project in order to use ' +
'the ' + chalk.green(this.name) + ' command.');
return Promise.resolve();
return Promise.reject(new SilentError(
'You have to be inside an ember-cli project in order to use ' +
'the ' + chalk.green(this.name) + ' command.'
));
}

if (this.works === 'outsideProject' && this.isWithinProject) {
this.ui.writeLine('You cannot use the '+ chalk.green(this.name) +
' command inside an ember-cli project.');
return Promise.resolve();
return Promise.reject(new SilentError(
'You cannot use the '+ chalk.green(this.name) +
' command inside an ember-cli project.'
));
}

if (this.works === 'insideProject') {
Expand Down
27 changes: 10 additions & 17 deletions lib/tasks/npm-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

// Runs `npm install` in cwd

var Promise = require('../ext/promise');
var chalk = require('chalk');
var Task = require('../models/task');
var chalk = require('chalk');
var Task = require('../models/task');
var npm = require('../utilities/npm');

module.exports = Task.extend({
// The command to run: can be 'install' or 'uninstall'
Expand All @@ -25,28 +25,21 @@ module.exports = Task.extend({
loglevel: options.verbose ? 'verbose' : 'error',
logstream: this.ui.outputStream,
color: 'always',
// by default, do install peoples optional deps
'optional': 'optional' in options ? options.optional : true,
'save-dev': !!options['save-dev'],
'save-exact': !!options['save-exact'],
'optional': 'optional' in options ? options.optional : true
'save-exact': !!options['save-exact']
};

var packages = options.packages || [];

// npm otherwise is otherwise noisy, already submitted PR for npm to fix
// misplaced console.log
this.disableLogger();

var load = Promise.denodeify(this.npm.load);

return load(npmOptions)
.then(function() {
// if install is denodeified outside load.then(),
// it throws "Call npm.load(config, cb) before using this command."
var install = Promise.denodeify(this.npm.commands[this.command]);

return install(packages);
}.bind(this))
.finally(this.finally.bind(this))
.then(this.announceCompletion.bind(this));
return npm(this.command, packages, npmOptions, this.npm).
finally(this.finally.bind(this)).
then(this.announceCompletion.bind(this));
},

announceCompletion: function() {
Expand Down
38 changes: 38 additions & 0 deletions lib/utilities/npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict';

var Promise = require('../ext/promise');

//

/**
Runs the npm command `command` with the supplied args and load options.
Please note that the loaded module appears to retain some state, so do not
expect multiple invocations within the same process to work without quirks.
This problem is likely fixable.
@method npm
@param {String} command The npm command to run.
@param {Array} npmArgs The arguments passed to the npm command.
@param {Array} options The options passed when loading npm.
@param {Module} [npm] A reference to the npm module.
*/
module.exports = function npm(command, npmArgs, options/*, npm*/) {
var lib;
if (arguments.length === 4) {
lib = arguments[3];
} else {
lib = require('npm');
}

var load = Promise.denodeify(lib.load);

return load(options)
.then(function() {
// if install is denodeified outside load.then(),
// it throws "Call npm.load(config, cb) before using this command."
var operation = Promise.denodeify(lib.commands[command]);

return operation(npmArgs || []);
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"broccoli-kitchen-sink-helpers": "0.2.7",
"broccoli-merge-trees": "0.2.1",
"broccoli-sane-watcher": "^1.1.1",
"broccoli-sourcemap-concat": "1.0.0",
"broccoli-sourcemap-concat": "^1.0.0",
"broccoli-unwatched-tree": "0.1.1",
"broccoli-writer": "0.1.1",
"chalk": "1.1.0",
Expand Down
4 changes: 1 addition & 3 deletions tests/acceptance/addon-destroy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ describe('Acceptance: ember destroy in-addon', function() {
function generateInAddon(args) {
var generateArgs = ['generate'].concat(args);

return initAddon().then(function() {
return ember(generateArgs);
});
return ember(generateArgs);
}

function destroy(args) {
Expand Down
4 changes: 1 addition & 3 deletions tests/acceptance/addon-dummy-destroy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ describe('Acceptance: ember destroy in-addon-dummy', function() {
function generateInAddon(args) {
var generateArgs = ['generate'].concat(args);

return initAddon().then(function() {
return ember(generateArgs);
});
return ember(generateArgs);
}

function destroy(args) {
Expand Down
8 changes: 2 additions & 6 deletions tests/acceptance/blueprint-test-slow.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,27 @@ var cleanupRun = acceptance.cleanupRun;
var appName = 'some-cool-app';

describe('Acceptance: blueprint smoke tests', function() {
this.timeout(400000);

before(function() {
this.timeout(360000);
return createTestTargets(appName);
});

after(function() {
this.timeout(15000);
return teardownTestTargets();
});

beforeEach(function() {
this.timeout(10000);
return linkDependencies(appName);
});

afterEach(function() {
this.timeout(10000);
return cleanupRun().then(function() {
assertDirEmpty('tmp');
});
});

it('generating an http-proxy installs packages to package.json', function() {
this.timeout(450000);

return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'generate',
'http-proxy',
'api',
Expand Down
Loading

0 comments on commit d8962cf

Please sign in to comment.