Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var ticketsRef = new Firebase(utils.addSubdomain(api.realtimeOrigin, 'firebase')
module.exports = new Command('login')
.description('sign into Firebase')
.action(function(options) {
if (utils.getInheritedOption(options, 'nonInteractive')) {
if (options.nonInteractive) {
return utils.reject('Cannot run login in non-interactive mode. Pass ' + chalk.bold('--token') + ' instead.', {exit: 1});
}

Expand Down
2 changes: 1 addition & 1 deletion lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Command.prototype.register = function(client) {
};

Command.prototype._prepare = function(options) {
if (!process.stdin.isTTY) {
if (!process.stdin.isTTY || utils.getInheritedOption(options, 'nonInteractive')) {
options.nonInteractive = true;
}
if (utils.getInheritedOption(options, 'debug')) {
Expand Down
35 changes: 25 additions & 10 deletions lib/deploy/hosting/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,41 @@ module.exports = function(context, options, payload) {

return new RSVP.Promise(function(resolve, reject) {
var lastCount = 0;

var bar = new ProgressBar(chalk.bold('Uploading:') + ' [:bar] :percent', {
total: upload.manifest.length,
width: 40,
complete: chalk.green('='),
incomplete: ' ',
clear: true
});
var lastPercent = 0;
var bar;
if (!options.nonInteractive && process.stderr) {
bar = new ProgressBar(chalk.bold('Uploading:') + ' [:bar] :percent', {
total: upload.manifest.length,
width: 40,
complete: chalk.green('='),
incomplete: ' ',
clear: true
});
} else {
process.stdout.write(chalk.cyan.bold('\ni') + chalk.bold(' Progress: ['));
}

local.versionRef.on('value', function(snap) {
var status = snap.child('status').val();
switch (status) {
case 'deploying':
var uc = snap.child('uploadedCount').val() || 0;
bar.tick(uc - lastCount);
var percent = Math.round(100.0 * uc / upload.manifest.length);
if (bar) {
bar.tick(uc - lastCount);
} else {
process.stdout.write(_.repeat(chalk.green('.'), percent - lastPercent));
lastPercent = percent;
}
lastCount = uc;
break;
case 'deployed':
if (bar) {
bar.terminate();
} else {
process.stdout.write(chalk.bold(']') + '\n\n');
}
utils.logSuccess(upload.manifest.length + ' files uploaded successfully');
bar.terminate();
local.versionRef.off('value');
resolve();
break;
Expand Down
3 changes: 1 addition & 2 deletions lib/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var inquirer = require('inquirer');
var _ = require('lodash');
var FirebaseError = require('./error');
var RSVP = require('rsvp');
var utils = require('./utils');

module.exports = function(options, questions) {
return new RSVP.Promise(function(resolve, reject) {
Expand All @@ -15,7 +14,7 @@ module.exports = function(options, questions) {
}
}

if (prompts.length && utils.getInheritedOption(options, 'nonInteractive')) {
if (prompts.length && options.nonInteractive) {
return reject(new FirebaseError('Missing required options (' + _.uniq(_.pluck(prompts, 'name')).join(', ') + ') while running in non-interactive mode', {
children: prompts,
exit: 1
Expand Down