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

Commit

Permalink
Merge pull request #128 from fengmk2/module-name-case-care
Browse files Browse the repository at this point in the history
fix #127 execSync and execsync.
  • Loading branch information
dead-horse committed Dec 27, 2013
2 parents c919956 + 6788180 commit cc60007
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
12 changes: 8 additions & 4 deletions docs/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CREATE TABLE `module` (
`gmt_create` datetime NOT NULL COMMENT 'create time',
`gmt_modified` datetime NOT NULL COMMENT 'modified time',
`author` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL COMMENT 'module name',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name',
`version` varchar(30) NOT NULL COMMENT 'module version',
`description` longtext,
`package` longtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT 'package.json',
Expand All @@ -38,30 +38,33 @@ CREATE TABLE `module` (
-- ALTER TABLE `module` CHANGE `package` `package` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci;
-- ALTER TABLE `module` CHANGE `description` `description` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci;
-- show create table module\G
-- ALTER TABLE `module` CHANGE `name` `name` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name';

CREATE TABLE `module_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`gmt_create` datetime NOT NULL COMMENT 'create time',
`gmt_modified` datetime NOT NULL COMMENT 'modified time',
`username` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL COMMENT 'module name',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name',
`log` longtext,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='module sync log';
-- ALTER TABLE `module_log` CHANGE `name` `name` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name';

CREATE TABLE `tag` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`gmt_create` datetime NOT NULL COMMENT 'create time',
`gmt_modified` datetime NOT NULL COMMENT 'modified time',
`name` varchar(100) NOT NULL COMMENT 'module name',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name',
`tag` varchar(30) NOT NULL COMMENT 'tag name',
`version` varchar(30) NOT NULL COMMENT 'module version',
`module_id` bigint(20) unsigned NOT NULL COMMENT 'module id',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`, `tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='module tag';
-- ALTER TABLE `tag` ADD `module_id` BIGINT( 20 ) UNSIGNED NOT NULL;
-- ALTER TABLE `tag` CHANGE `name` `name` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name';

CREATE TABLE `total` (
`name` varchar(100) NOT NULL COMMENT 'total name',
Expand Down Expand Up @@ -92,8 +95,9 @@ CREATE TABLE `download_total` (
`gmt_create` datetime NOT NULL COMMENT 'create time',
`gmt_modified` datetime NOT NULL COMMENT 'modified time',
`date` varchar(10) NOT NULL COMMENT 'YYYY-MM-DD format',
`name` varchar(100) NOT NULL COMMENT 'module name',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name',
`count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'download count',
PRIMARY KEY (`id`),
UNIQUE KEY `date_name` (`date`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='module download total info';
-- ALTER TABLE `download_total` CHANGE `name` `name` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'module name';
8 changes: 4 additions & 4 deletions proxy/sync_module_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ function SyncModuleWorker(options) {
}

this.names = options.name;
for (var i = 0; i < this.names.length; i++) {
// ensure package name is lower case
this.names[i] = this.names[i].toLowerCase();
}
// for (var i = 0; i < this.names.length; i++) {
// // ensure package name is lower case
// this.names[i] = this.names[i].toLowerCase();
// }

this.username = options.username;
this.concurrency = options.concurrency || 1;
Expand Down
8 changes: 3 additions & 5 deletions sync/sync_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ function subtract(subtracter, minuend) {
var map = {};
var results = [];
minuend.forEach(function (name) {
map[name.toLowerCase()] = true;
map[name] = true;
});
subtracter.forEach(function (name) {
var lowerName = name.toLowerCase();
if (!map[lowerName] && !/[A-Z]/.test(name)) {
// ensure package name is lower case
results.push(lowerName);
if (!map[name]) {
results.push(name);
}
});
return results;
Expand Down

0 comments on commit cc60007

Please sign in to comment.