0.6.30 • Published 9 years ago

node.svntail v0.6.30

Weekly downloads
439
License
-
Repository
github
Last release
9 years ago

演示截图

SVN尾巴


安装手册

依赖

nodejs 0.6.1x
NodeJS官方网站 | 安装参考文章

定位hooks目录

一般hooks目录位于svn库根目录下,一般同级的目录还有dav、db、locks

通过NPM安装node.svntail

// 在hooks目录下运行
npm install node.svntail

NPM包详情

修改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-]*/$'
			},
			// 新增文件规则
			'TheNewFileNameRules' : {
				ruleName : 'The New File Name Validate Rules',
				//warnning : '新增文件规则为 : 英文小写字母、数字、中划线连接。'
				warnning : '(!) Found Some File(s) Name Errors, Rule: lowcase letters, number & line-through.',
				filter : {
					itemType : 'file',
					commitType : ['A']
				},
				validateRule : '^[a-z0-9-./]*$'
			},
			// JS目录文件规则
			'JsDirRules' : {
				ruleName : 'The Js Dir Validate Rules',
				warnning : '(!) New js file rule is : extname must be [js|md|js.seed|xml|html|spec.js].',
				filter : {
					itemType : 'file',
					commitType : ['A'],
					inRegx : ['^intl-style/trunk/deploy/htdocs/js/*','^intl-style/branches/.*?/deploy/htdocs/js/*'],
					// lib目录放行
					popRegx : ['^intl-style/trunk/deploy/htdocs/js/5v/lib/*','^intl-style/branches/.*?/deploy/htdocs/js/5v/lib/*']
				},
				validateRule : '^(.*?)\\.(?:js|md|js.seed|xml|html|spec.js).*$'
			},
			// CSS目录文件规则
			'CssDirRules' : {
				ruleName : 'The Css Dir Validate Rules',
				warnning : '(!) New css file rule is : extname must be [css|md|css.seed|html].',
				filter : {
					itemType : 'file',
					commitType : ['A'],
					inRegx : ['^intl-style/trunk/deploy/htdocs/css/*','^intl-style/branches/.*?/deploy/htdocs/css/*']
				},
				validateRule : '^(.*?)\\.(?:css|md|css.seed|html).*$'
			},
			// 图片目录文件规则
			'ImgDirRules' : {
				ruleName : 'The Images Dir Validate Rules',
				warnning : '(!) New image file rule is : extname must be [jpg|cur|gif|png|psd|md].',
				filter : {
					itemType : 'file',
					commitType : ['A'],
					inRegx : ['^intl-style/trunk/deploy/htdocs/simg/*','^intl-style/trunk/deploy/htdocs/wimg/*','^intl-style/branches/.*?/deploy/htdocs/simg/*','^intl-style/branches/.*?/deploy/htdocs/wimg/*']
				},
				validateRule : '^(.*?)\\.(?:jpg|cur|gif|png|psd|md).*$'
			}
		},
		// 编码检测规则
		'mod-validator-charset' : {
			// style utf-8 rule
			'TheUTF8NoBOMRules' : {
				ruleName : 'Files Charset Validate Rules',
				warnning : '(!) File(s) with wrong charset. there must be : ASCII, UTF-8(without BOM).',
				filter : {
					itemType : 'file'
				},
				validateRule : ['utf-8','ascii','null','windows-1252']
			}
		},
		// JS语法检测
		'mod-validator-jshint' : {
			'TheJsHintRules' : {
				ruleName : 'The Javascript Hint Rule',
				warnning : '(!) JsHint Warnning(s).',
				filter : {
					itemType : 'file',
					commitType : ['A','U','_U','UU','G'],
					extName : [".js"],
					inRegx : ['^intl-style/trunk/deploy/htdocs/js/*','^intl-style/branches/.*?/deploy/htdocs/js/*']
				}
			}
		},
		// 提交者检测
		'mod-validator-author' : {
			'JSCommitLimitRule' : {
				ruleName : 'The Javascript File Commit Limit',
				warnning : '(!) You can not commit in this dir. The free authors are \n[ {{freeAuthors}} ]',
				filter : {
					itemType : 'all',
					inRegx : ['^intl-style/trunk/deploy/htdocs/js/5v/app/*','^intl-style/trunk/deploy/htdocs/js/5v/util/*','^intl-style/trunk/deploy/htdocs/js/5v/lib/ae/*','^intl-style/trunk/deploy/htdocs/js/5v/mod/common/*','^intl-style/branches/.*?/deploy/htdocs/js/5v/mod/common/*','^intl-style/branches/.*?/deploy/htdocs/js/5v/lib/ae/*','^intl-style/branches/.*?/deploy/htdocs/js/5v/lib/util/*','^intl-style/branches/.*?/deploy/htdocs/js/5v/app/*','^intl-style/trunk/deploy/htdocs/css/6v/seeds/*','^intl-style/branches/.*?/deploy/htdocs/css/6v/seeds/*']
				},
				freeAuthors : ['zhenyu.zhaozy','nanqiao.dengnq','xiaoxin.zhangxx','yanhua.guyh','zhao.wuz','xiaoyun.fuxy','peng.hep','jianqing.zengjq','been.zhangb','nuo.xun']
			}
		}

	}
	// ↑ 各种检测模块配置
	
};

// 载入提交前检测模块
var preCommit = require('node.svntail/lib/hook-pre-commit.js');

// 传入自定义配置 开始运行
preCommit.start(config);

运行服务端(默认端口为99)

// 开启前注意配置SVN钩子端的remoteConnect及remoteApiSettings配置
node node.svntail/lib/server-reporter.js
0.6.30

9 years ago

0.6.21

10 years ago

0.6.20

10 years ago

0.6.19

10 years ago

0.6.18

10 years ago

0.6.17

10 years ago

0.6.16

10 years ago

0.6.12

10 years ago

0.6.11

10 years ago

0.5.91

11 years ago

0.5.90

11 years ago

0.5.83

11 years ago

0.5.82

11 years ago

0.5.81

11 years ago

0.5.80

11 years ago

0.5.74

11 years ago

0.5.73

11 years ago

0.5.71

11 years ago

0.5.70

11 years ago

0.5.64

11 years ago

0.5.63

11 years ago

0.5.62

11 years ago

0.5.61

11 years ago

0.5.60

11 years ago

0.5.57

11 years ago

0.5.56

11 years ago

0.5.55

11 years ago

0.5.54

11 years ago

0.5.53

11 years ago

0.5.52

11 years ago

0.5.51

11 years ago

0.5.50

11 years ago

0.5.40

11 years ago

0.5.30

11 years ago

0.5.20

11 years ago

0.5.19

11 years ago

0.5.18

11 years ago

0.5.17

11 years ago

0.5.16

11 years ago

0.5.15

11 years ago

0.5.14

11 years ago

0.5.12

11 years ago

0.5.11

11 years ago

0.5.10

11 years ago

0.5.6

12 years ago

0.5.5

12 years ago

0.5.4

12 years ago

0.5.3

12 years ago

0.5.2

12 years ago

0.5.1

12 years ago

0.5.0

12 years ago

0.4.9

12 years ago

0.4.8

12 years ago

0.4.7

12 years ago

0.4.6

12 years ago

0.4.5

12 years ago

0.4.2

12 years ago

0.4.1

12 years ago

0.4.0

12 years ago

0.3.9

12 years ago

0.3.7

12 years ago

0.3.6

12 years ago

0.3.5

12 years ago

0.3.4

12 years ago

0.3.3

12 years ago

0.3.2

12 years ago

0.3.1

12 years ago

0.3.0

12 years ago

0.2.9

12 years ago

0.2.8

12 years ago

0.2.7

12 years ago

0.2.6

12 years ago

0.2.5

12 years ago

0.2.4

12 years ago

0.2.3

12 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.9

12 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.3

12 years ago