Skip to content

Commit

Permalink
Fixing stuff for release
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldijou committed Aug 10, 2015
1 parent 53a79d5 commit 2d07ac8
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 13 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,13 @@ function askForDependencies(dependencies, name) {
if (prompts.length > 0) {
context.log('');
context.log(chalk.underline(manager.name));
}

inquirer.prompt(prompts, function (answers) {
resolve(answers);
});
inquirer.prompt(prompts, function (answers) {
resolve(answers);
});
} else {
resolve({});
}
});
}

Expand Down
14 changes: 13 additions & 1 deletion lib/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ Dependency.prototype.setup = function () {
if (this.error) {
switch (this.error.code) {
case 'RATELIMIT':
this.message += ' (rate limit reached)';
this.message += ' (rate limit reached';
if (this.error.reset) {
var waitTime = Math.ceil(this.error.reset - Date.now() / 1000);
var waitSeconds = waitTime % 60;
var waitMinutes = (waitTime - waitSeconds) / 60;

this.message += ', reset in ';
if (waitMinutes > 0) {
this.message += waitMinutes + 'min ';
}
this.message += waitSeconds + 'sec';
}
this.message += ')';
break;
case 'FORBIDDEN':
this.message += ' (private package)';
Expand Down
4 changes: 2 additions & 2 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ module.exports = {
// We reach the rate limit for this provider
result.error = {code: 'RATELIMIT', limit: rateLimits[infos.type]};
} else if (response.statusCode && response.statusCode === 403) {
if (response.headers && response.headers['x-rateLimit-remaining'] === 0) {
if (response.headers && response.headers['x-ratelimit-remaining'] === '0') {
// Github rate limit
result.error = {
code: 'RATELIMIT',
limit: rateLimits[infos.type],
reset: response.headers['x-rateLimit-reset']
reset: response.headers['x-ratelimit-reset']
};
} else {
// Private package
Expand Down
5 changes: 3 additions & 2 deletions lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function npmLatest(dep) {
return {name: dep.name, latest: infos.version, versions: infos.versions || []};
}).catch(function (err) {
// Package doesn't exist in NPM registry
if (err.code && err.code === 'E404') {
if (err === '404 Not Found' || (err.code && err.code === 'E404')) {
return {name: dep.name, skipped: true, versions: [], error: {code: 'NOTFOUND'}};
} else {
throw err;
Expand Down Expand Up @@ -165,7 +165,8 @@ module.exports = new Manager({

return new Promise(function (resolve, reject) {
var updating = cp.spawn('node', args, {
cwd: process.cwd()
cwd: process.cwd(),
stdio: 'inherit'
});

updating.on('error', function (err) {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "outdated",
"version": "0.0.2",
"description": "Manage, update and prune your dependencies like a boss.",
"license": "Apache-2.0",
"homepage": "https://github.com/pauldijou/outdated",
"bugs": {
"email": "[email protected]",
Expand Down Expand Up @@ -42,7 +43,7 @@
"semver": "^5.0.0",
"npm": "^2.13.0",
"bower": "^1.4.1",
"bower-json": "^0.5.0",
"bower-json": "^0.6.0",
"string-length": "^1.0.0",
"yargs": "^3.10.0",
"chalk": "^1.0.0",
Expand All @@ -51,8 +52,8 @@
"inquirer": "^0.9.0",
"hosted-git-info": "^2.1.4",
"request": "^2.58.0",
"jspm": "0.16.0-beta.3",
"application-config": "0.1.2",
"jspm": "0.16.0-beta.6",
"application-config": "0.2.0",
"url": "0.10.3",
"omelette": "0.3.1"
},
Expand Down
4 changes: 3 additions & 1 deletion scripts/npm-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
var file = require('path').resolve(__dirname, '..', 'lib', 'npm.js');
var npm = require(file);

npm.utils.load(process.argv.slice(2)).then(npm.utils.install);
npm.utils.load().then(function () {
return npm.utils.install(process.argv.slice(2));
});
Empty file added test/demo/test.js
Empty file.

0 comments on commit 2d07ac8

Please sign in to comment.