Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
change(sync): remove dist syncer
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 29, 2015
1 parent 8c0f905 commit 9d3c33f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 538 deletions.
14 changes: 4 additions & 10 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Authors:
* dead_horse <[email protected]>
* fengmk2 <[email protected]> (http://fengmk2.github.com)
* fengmk2 <[email protected]> (http://fengmk2.com)
*/

'use strict';
Expand Down Expand Up @@ -37,6 +37,7 @@ var config = {
/*
* server configure
*/

registryPort: 7001,
webPort: 7002,
bindingHost: '127.0.0.1', // only binding on 127.0.0.1 for local access
Expand All @@ -45,6 +46,8 @@ var config = {
// if in debug mode, some middleware like limit wont load
// logger module will print to stdout
debug: true,
// page mode, enable on development env
pagemock: process.env.NODE_ENV === 'development',
// session secret
sessionSecret: 'cnpmjs.org test session secret',
// max request json body size
Expand Down Expand Up @@ -181,15 +184,6 @@ var config = {
* sync configs
*/

// sync dist config
// sync node.js dist from nodejs.org
noticeSyncDistError: true,
disturl: 'http://nodejs.org/dist',
syncDist: false,

pythonDisturl: 'https://www.python.org/ftp',
syncPythonDist: false,

// the official npm registry
// cnpm wont directly sync from this one
// but sometimes will request it for some package infomations
Expand Down
8 changes: 3 additions & 5 deletions docs/web/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ So `cnpm` is meaning: **Company npm**.

## Registry

* Our public registry: [r.cnpmjs.org](http://r.cnpmjs.org), syncing from [registry.npmjs.org](http://registry.npmjs.org)
* Current [cnpmjs.org](/) version: <span id="app-version"></span>
* Mirror of [Node.js Manual & Documentation](/dist/latest/docs/api/index.html)
* Mirror of [nodejs.org/dist](http://nodejs.org/dist): [/dist mirror](/dist)
* Mirror of [phantomjs downloads](https://bitbucket.org/ariya/phantomjs/downloads): [phantomjs mirror](/dist/phantomjs/)
- Our public registry: [r.cnpmjs.org](http://r.cnpmjs.org), syncing from [registry.npmjs.org](http://registry.npmjs.org)
- [cnpmjs.org](/) version: <span id="app-version"></span>
- [Node.js](https://nodejs.org) version: <span id="node-version"></span>

<table class="downloads">
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion servers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ app.use(middlewares.rt({headerName: 'X-ReadTime'}));
app.use(middlewares.rewrite('/favicon.ico', '/favicon.png'));
app.use(staticCache);

if (process.env.NODE_ENV === 'development') {
if (config.pagemock) {
app.use(require('koa-mock')({
datadir: path.join(rootdir, 'test', 'mocks')
}));
Expand Down
68 changes: 0 additions & 68 deletions sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var config = require('../config');
var mail = require('../common/mail');
var logger = require('../common/logger');
var totalService = require('../services/total');
var DistSyncer = require('./sync_dist');

var sync = null;

Expand Down Expand Up @@ -87,73 +86,6 @@ if (sync) {
setInterval(handleSync, syncInterval);
}

/**
* sync dist(node.js and phantomjs)
*/

var syncingDist = false;
var syncDist = co(function* () {
if (syncingDist) {
return;
}
syncingDist = true;
logger.syncInfo('Start syncing dist...');
var distSyncer = new DistSyncer({
disturl: config.disturl
});
try {
yield* distSyncer.start();
yield* distSyncer.syncPhantomjsDir();
} catch (err) {
err.message += ' (sync dist error)';
logger.syncError(err);
if (config.noticeSyncDistError) {
sendMailToAdmin(err, null, new Date());
}
}
syncingDist = false;
});

if (config.syncDist) {
syncDist();
setInterval(syncDist, syncInterval);
} else {
logger.syncInfo('sync dist disable');
}

/**
* sync python dist
*/

var syncingPythonDist = false;
var syncPythonDist = co(function* () {
if (syncingPythonDist) {
return;
}
syncingPythonDist = true;
logger.syncInfo('Start syncing python dist...');
var distSyncer = new DistSyncer({
disturl: config.pythonDisturl
});
try {
yield* distSyncer.start();
} catch (err) {
err.message += ' (sync python dist error)';
logger.syncError(err);
if (config.noticeSyncDistError) {
sendMailToAdmin(err, null, new Date());
}
}
syncingPythonDist = false;
});

if (config.syncPythonDist) {
syncPythonDist();
setInterval(syncPythonDist, syncInterval);
} else {
logger.syncInfo('sync python dist disable');
}

/**
* sync popular modules
*/
Expand Down
Loading

0 comments on commit 9d3c33f

Please sign in to comment.