Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #288 from Financial-Times/error-fix
Browse files Browse the repository at this point in the history
Shows bower install errors, and fixes bug that was showing errors twi…
  • Loading branch information
Alberto Elias committed Jul 6, 2015
2 parents 2b74a52 + f04c296 commit fc371f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Config:
* demoConfig: `String` The path to the demo config file. Default: `demos/src/config.json`
* updateorigami: `Boolean` The `demos` property of your `origami.json` file will be updated - to list the demo files that have been created.
* runServer: `Boolean` Whether you want to run a local server or not. If true, it also sets 'local' to true. Default: `false`
* livereload: `Boolean` Will enable livereload on `runServer`. Default: `true`

Runs:

Expand Down
3 changes: 1 addition & 2 deletions lib/origami-build-tools-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ var watch = !!argv.watch,
function reportTaskError(error) {
if (Array.isArray(error)) {
log.primaryError(error.join('\n'));
}
if (error) {
} else if (error) {
log.primaryError(error);
}
process.exit(1);
Expand Down
11 changes: 8 additions & 3 deletions lib/tasks/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ module.exports = function(gulp, config) {

if (config.runServer) {
promise = promise.then(function() {
module.exports.runServer(gulp);
module.exports.runServer(gulp, config);
});
}

Expand All @@ -301,24 +301,29 @@ module.exports = function(gulp, config) {
}
};

module.exports.runServer = function(gulp) {
module.exports.runServer = function(gulp, config) {
return new Promise(function(resolve, reject) {
portfinder.getPort(function (err, port) {
if (err) {
reject(err);
return;
}

if (server) {
resolve(server);
return;
}

config = config || {};

log.primary('Open http://localhost:'+port+'/demos/local/ in a browser to view the demos');

server = gulp.src('.')
.pipe(webserver({
directoryListing: true,
port: port,
host: '0.0.0.0',
livereload: true
livereload: (config.livereload === false || config.livereload === 'false') ? false : true
}));
resolve(server);
});
Expand Down
3 changes: 1 addition & 2 deletions lib/tasks/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ module.exports.runBowerInstall = function(config) {
resolve();
}, function(output) {
outputInstalling(configContainsOrigamiRegistry);
cliFailed(output);
reject();
reject(cliFailed(output));
});
});
} else {
Expand Down

0 comments on commit fc371f3

Please sign in to comment.