Skip to content

Commit

Permalink
Merge a66d5c4 into 9ef7434
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Jul 26, 2015
2 parents 9ef7434 + a66d5c4 commit 43c2eb2
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 138 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
24 changes: 9 additions & 15 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,22 @@ 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
};

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
23 changes: 23 additions & 0 deletions lib/utilities/npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

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

module.exports = function npm(command, packages, 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(packages || []);
});
};
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

0 comments on commit 43c2eb2

Please sign in to comment.