Skip to content

Commit

Permalink
Merge pull request #34 from firebase/v1.1.3
Browse files Browse the repository at this point in the history
v1.1.3
  • Loading branch information
Jacob Wenger committed Oct 22, 2014
2 parents 84e74db + 5e01358 commit ffa30bc
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.1.3
- Fixes progress bar so it doesn't stick at 100% at the end of long uploads
- Improves error messaging on login / token validation if the CLI version is out of date

## v1.1.2
- Adds client-side validation of new advanced features with better error messaging

Expand Down
2 changes: 1 addition & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function initApi() {
}

if (urlParts) {
api.adminUrl = process.env['FIREBASE_ADMIN_URL'];
api.adminUrl = process.env['FIREBASE_ADMIN_URL'];
}
}

Expand Down
16 changes: 8 additions & 8 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getPrompt(argv, schema, onComplete, index, results) {
if (typeof item.beforeValue === 'function') {
item.beforeValue(results);
}
prompt.get(schema[index], function (error, result) {
prompt.get(schema[index], function(error, result) {
if (error) {
console.log(chalk.red('Input Error'));
process.exit(1);
Expand Down Expand Up @@ -246,7 +246,7 @@ function uploadSite(settings, directoryRef, argv) {
}
if (bar) {
var uploadedCount = snapshot.hasChild('uploadedCount') ? snapshot.child('uploadedCount').val() : 0;
bar.update(uploadedCount / total);
bar.update(Math.floor(100 * uploadedCount / total) / 100);
}
} else if (status === 'removed') {
console.log(chalk.green('Sucessfully removed'));
Expand Down Expand Up @@ -291,7 +291,7 @@ function getSettings(argv) {
settingsJSON = fs.readFileSync(settingsFile);
settings = JSON.parse(settingsJSON);
} catch (err) {
console.log(chalk.red('Initialization Error') +' - Could not read ' +
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
'firebase.json settings file');
process.exit(1);
}
Expand Down Expand Up @@ -381,7 +381,7 @@ module.exports = {
process.exit(1);
}
console.log('Writing firebase.json settings file...');
var settingsJSON = JSON.stringify(settings, null, 2) + "\n";
var settingsJSON = JSON.stringify(settings, null, 2) + '\n';
try {
fs.writeFileSync(settingsFile, settingsJSON);
console.log(chalk.green('Successfully initialized app'));
Expand Down Expand Up @@ -565,7 +565,7 @@ module.exports = {
}
}

var settingsJSON = JSON.stringify(settings, null, 2) + "\n";
var settingsJSON = JSON.stringify(settings, null, 2) + '\n';
var settingsFile = path.join(projectDir, 'firebase.json');
try {
fs.writeFileSync(settingsFile, settingsJSON);
Expand Down Expand Up @@ -606,7 +606,7 @@ module.exports = {
}
var settings = getSettings(argv);
if (typeof(settings.firebase) !== 'string') {
console.log(chalk.red('Initialization Error') +' - Could not read ' +
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
'firebase.json settings file');
process.exit(1);
}
Expand Down Expand Up @@ -668,7 +668,7 @@ module.exports = {
}
var settings = getSettings(argv);
if (typeof(settings.firebase) !== 'string') {
console.log(chalk.red('Initialization Error') +' - Could not read ' +
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
'firebase.json settings file');
process.exit(1);
}
Expand Down Expand Up @@ -738,7 +738,7 @@ module.exports = {
open: function(argv) {
var settings = getSettings(argv);
if (typeof(settings.firebase) !== 'string') {
console.log(chalk.red('Initialization Error') +' - Could not read ' +
console.log(chalk.red('Initialization Error') + ' - Could not read ' +
'firebase.json settings file');
process.exit(1);
}
Expand Down
24 changes: 11 additions & 13 deletions lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ var auth = {
true,
function(statusCode, response) {
if (typeof(callback) === 'function') {
if (response.success) {
setTimeout(callback, 0, null);
} else if (response.minCLI) {
console.log(chalk.red('Outdated CLI Version') + ' - Please update to at ' +
if (typeof(response.error) !== 'undefined') {
console.log(chalk.red(response.error.message) + ' - Please update to at ' +
'least v' + response.minCLI + ' by running ' +
chalk.cyan('npm update -g ' + require('./firebase').name));
process.exit(1);
} else if (response.valid) {
setTimeout(callback, 0, null);
} else {
setTimeout(callback, 0, new Error('Invalid Access Token'));
}
Expand Down Expand Up @@ -147,23 +147,21 @@ var auth = {
if (token) {
this.token = token;
this.saveConfig(callback);
} else if (response.minCLI) {
console.log(chalk.red('Outdated CLI Version') + ' - Please update to at least ' +
'v' + response.minCLI + ' by running ' +
chalk.cyan('npm update -g ' + require('./firebase').name));
} else if (typeof(response.error) !== 'undefined') {
console.log(chalk.red(response.error.message) + ' - Please update to at ' +
'least v' + response.minCLI + ' by running ' +
chalk.cyan('npm update -g ' + require('./firebase').name));
process.exit(1);
} else {
if (typeof(callback) === 'function') {
setTimeout(callback, 0, new Error('Email or Password Invalid'));
}
} else if (typeof(callback) === 'function') {
setTimeout(callback, 0, new Error('Email or Password Invalid'));
}
},
saveConfig: function(callback) {
var data = {
email: this.email,
token: this.token
};
var dataString = JSON.stringify(data, null, 2) + "\n";
var dataString = JSON.stringify(data, null, 2) + '\n';
try {
fs.writeFileSync(this.configFile, dataString);
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = {
console.log(helpOverview + helpTemplates + helpFooter);
}, function(error) {
var errTemplates = '\n ';
errTemplates += chalk.red('Error: ') + 'Could not retrieve available templates.\n';
errTemplates += chalk.red('Error: ') + 'Could not retrieve available templates.\n';

console.log(helpOverview + errTemplates + helpFooter);
});
Expand Down Expand Up @@ -145,7 +145,7 @@ module.exports = {
'\n' +
' -f, --firebase Overrides the Firebase setting in the firebase.json\n' +
'\n' +
' Deletes the site associated with the Firebase detailed in the firebase.json\n' +
' Deletes the site associated with the Firebase detailed in the firebase.json\n' +
' settings file. The current user must have access to the Firebase, and if\n' +
' the user is not currently logged in, they are prompted to do so - see\n' +
' `firebase login --help` for more details.\n');
Expand Down
6 changes: 3 additions & 3 deletions lib/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {
if (message) {
params.push('message=' + encodeURIComponent(message));
}
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&')
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&');
var readStream = fs.createReadStream(filename);

var r = request.put({
Expand Down Expand Up @@ -94,7 +94,7 @@ module.exports = {
if (message) {
params.push('message=' + encodeURIComponent(message));
}
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&')
var url = api.uploadUrl + '/upload/' + firebase + '?' + params.join('&');
var readStream = fs.createReadStream(filename);

var r = request.put({
Expand All @@ -109,4 +109,4 @@ module.exports = {
form.append('site', readStream);
});
}
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "firebase-tools",
"preferGlobal": true,
"version": "1.1.2",
"version": "1.1.3",
"description": "The Firebase Command Line Tools",
"keywords": [
"firebase",
Expand Down

0 comments on commit ffa30bc

Please sign in to comment.