Skip to content

Commit

Permalink
make bower installation not require bower to be in PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Van Camp committed Feb 20, 2015
1 parent 71c9dff commit 73abd20
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/install-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var fs = require('fs.extra');
var path = require('path');
var semver = require('semver');
var bower = require('bower');
var format = require('util').format;
var chalk = require('chalk');
var os = require('os');
Expand Down Expand Up @@ -33,7 +33,10 @@ module.exports = function (bundlePath, installDev) {
}

if (fs.existsSync(bundlePath + '/package.json')) {
cmdline = installDev ? 'bower install' : 'bower install --production';
// rofl
// Amazing hack to synchronously install bower components without having to rely on
// `bower` being in the users' PATH.
cmdline = 'node ../../../node_modules/bower/bin/bower install' + (installDev ? '' : ' --production');
process.stdout.write(format('Installing bower dependencies (dev: %s)...', installDev));
try {
execSync(cmdline, { cwd: bundlePath, stdio: ['pipe', 'pipe', 'pipe']});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"preferGlobal": true,
"dependencies": {
"bower": "^1.3.12",
"chalk": "^0.5.1",
"commander": "^2.6.0",
"fs.extra": "^1.3.2",
Expand Down
7 changes: 5 additions & 2 deletions test/commands/3_update.mspec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = require('chai').assert;
var expect = require('chai').expect;
var fs = require('fs');
var path = require('path');
var MockProgram = require('../mocks/program');
Expand All @@ -14,6 +14,9 @@ describe('update command', function () {

it('shouldn\'t throw any errors', function () {
this.timeout(25000);
program.runWith('update agdq15-layouts');
function doUpdate() {
program.runWith('update agdq15-layouts');
}
expect(doUpdate).to.not.throw(Error);
});
});

0 comments on commit 73abd20

Please sign in to comment.