Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove check update ...

  • Loading branch information...
commit 54c1c39a95cd291d69ad5a5557f5fa536291b7ed 1 parent 5a24c1a
@afc163 afc163 authored
Showing with 23 additions and 72 deletions.
  1. +22 −25 bin/spm
  2. +0 −46 lib/utils/check-update.js
  3. +1 −1  package.json
View
47 bin/spm
@@ -7,7 +7,6 @@ require('colorful').colorful();
var spm = require('..');
var program = require('../lib/utils/program');
var spawn = require('win-spawn');
-var checkUpdate = require('../lib/utils/check-update');
process.on('exit', function() {
console.log();
@@ -88,38 +87,36 @@ commander.on('--help', function() {
console.log();
});
-checkUpdate(function() {
- commander.parse(process.argv);
+commander.parse(process.argv);
- var args = process.argv.slice(3);
- var subcmd = commander.args[0];
+var args = process.argv.slice(3);
+var subcmd = commander.args[0];
- if (!subcmd) {
+if (!subcmd) {
+ process.stdout.write(commander.helpInformation());
+ commander.emit('--help');
+ process.exit();
+}
+
+if (subcmd === 'help') {
+ var helpcmd = commander.args[1];
+ if (!helpcmd) {
process.stdout.write(commander.helpInformation());
commander.emit('--help');
process.exit();
}
- if (subcmd === 'help') {
- var helpcmd = commander.args[1];
- if (!helpcmd) {
- process.stdout.write(commander.helpInformation());
- commander.emit('--help');
- process.exit();
- }
-
- var bin = executable(helpcmd);
- if (bin) {
- spawn(bin, ['--help'], {stdio: 'inherit', customFds: [0, 1, 2]});
- }
- } else {
- bin = executable(subcmd);
- if (bin) {
- spm.run.record(subcmd);
- spawn(bin, args, {stdio: 'inherit', customFds: [0, 1, 2]});
- }
+ var bin = executable(helpcmd);
+ if (bin) {
+ spawn(bin, ['--help'], {stdio: 'inherit', customFds: [0, 1, 2]});
+ }
+} else {
+ bin = executable(subcmd);
+ if (bin) {
+ spm.run.record(subcmd);
+ spawn(bin, args, {stdio: 'inherit', customFds: [0, 1, 2]});
+ }
}
-});
// helpers
View
46 lib/utils/check-update.js
@@ -1,46 +0,0 @@
-var request = require('request');
-var semver = require('semver');
-var fs = require('fs');
-var path = require('path');
-var log = require('./log');
-var version = require('../../package').version;
-require('colorful').colorful();
-
-module.exports = function(callback) {
-
- // check every month
- var HOME = process.env.HOME;
- if (!HOME) {
- HOME = process.env.HOMEDRIVE + process.env.HOMEPATH;
- }
- var UPDATE_FILE = path.join(HOME, '.spm', 'autoupdate');
- var lastCheckDate;
- var NOW = Date.now();
-
- if (fs.existsSync(UPDATE_FILE)) {
- lastCheckDate = parseInt(fs.readFileSync(UPDATE_FILE), 10);
- }
-
- if (lastCheckDate && NOW - lastCheckDate < 86400000 * 30) {
- callback();
- return;
- }
-
- request({
- url: 'https://registry.npmjs.org/spm',
- strictSSL: false
- }, function (error, response, body) {
- if (error) {
- console.log(error);
- } else if (response.statusCode == 200) {
- var latest = JSON.parse(body)['dist-tags'].latest;
- if (semver.lt(latest, version)) {
- console.log();
- console.log((' Your spm@' + version + ' is outdated, latest version is ' + latest + '.').to.yellow.color);
- console.log(' Try "npm install spm -g".'.to.green.color);
- }
- }
- fs.writeFileSync(UPDATE_FILE, NOW);
- callback();
- });
-};
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "spm",
- "version": "2.2.1",
+ "version": "2.2.2",
"preferGlobal": "true",
"description": "Static Package Manager",
"author": "Hsiaoming Yang <me@lepture.com>",
Please sign in to comment.
Something went wrong with that request. Please try again.