README
演示截图
安装手册
依赖
nodejs 0.6.1x
NodeJS官方网站 | 安装参考文章
定位hooks目录
一般hooks目录位于svn库根目录下,一般同级的目录还有dav、db、locks
通过NPM安装node.svntail
// 在hooks目录下运行
npm install node.svntail
修改pre-commit文件(以下是示例)
注意!在一切开始前,首先要给pre-commit赋可执行权限,安装完成后建议运行 dos2unix pre-commit 转义其中的非ASCII字符.
#!/usr/bin/node
/**
* 配置集合
*/
var config = {
/**
* 总控开关 (on/off)
* @property config.switch {string}
*/
switch : "on",
/**
* 版本库地址
* @property config.repos {string}
*/
repos : process.argv[2],
/**
* 当前提交唯一标识戳 中间状态版本号
* @property config.txn {string}
*/
txn : process.argv[3],
/**
* 作用域
* @property config.scope {array}
*/
scope : ['^intl-style/*'],
/**
* debug 模式 (额外信息输出)
* @property config.debug {boolean}
*/
debug : false,
/**
* SVN提交内容缓存路径 检测作用域
* @property config.tempPath {string}
*/
tempPath : __dirname + '/temp-svntail-pre-commit/' + process.argv[3],
/**
* svnlook命令全路径
* 通过whereis svnlook可获取,通常是 /usr/bin/svnlook 或 /usr/local/bin/svnlook
* @property config.cmdSvnlook {string}
*/
cmdSvnlook : 'LANG=zh_CN.utf8 /usr/local/bin/svnlook',
/**
* 是否需要传输数据到远程API
* @property config.remoteConnect {boolean}
*/
remoteConnect : false,
/**
* 远程API设置 ( 用于发送提交信息至此API )
* @property config.remoteApiSettings {object}
*/
remoteApiSettings : {
host: 'reporter.aliui.com',
port: '99',
path: '/api.js',
method: 'POST'
},
/**
* 强制提交注释标识
* @property config.forceCommitLog {string}
*/
forceCommitLog : '--force-commit',
/**
* 是否自动删除缓存文件
* @property config.autoDelTemp {boolean}
*/
autoDelTemp : true,
/**
* 各种检测模块配置 (和检测模块同名)
* @property config.lintsConfig {object}
*/
validateConfigs : {
// 提交路径检测规则
'mod-validator-path' : {
// 新增目录规则
'TheNewDirNameRules' : {
ruleName : 'The New Dir Name Validate Rules',
//warnning : '新增目录规则为 : 英文小写字母、数字、中划线连接(开头允许一个下划线)'
warnning : '(!) Found Some Dir(s) Name Errors, Rule: lowcase letters, number & line-through[or begining_underline].',
filter : {
itemType : 'dir',
commitType : ['A']
},
validateRule : '^_?[a-z0-9-]*/