From dbe605b5cf65b6e06769118ebac022d5c2cddde1 Mon Sep 17 00:00:00 2001 From: Mora Date: Fri, 12 Jun 2015 15:03:57 +0800 Subject: [PATCH] Release 3.0.0-alpha.2 --- .jshintrc | 2 +- CHANGELOG.md | 7 +++++++ README.md | 2 ++ bin/def-doc.js | 12 ++++++------ bower.json | 2 +- examples/arguments.md | 8 +++----- examples/class-member-def.md | 2 +- examples/embed-def.md | 4 ++-- examples/multiple-def.md | 4 ++-- examples/random.md | 2 +- examples/range.md | 2 +- examples/rest-def.md | 6 +++--- examples/unique.md | 2 +- package.json | 2 +- test/testDefCompile.js | 12 ++++++------ 15 files changed, 38 insertions(+), 31 deletions(-) diff --git a/.jshintrc b/.jshintrc index eb16c8b..071e90d 100644 --- a/.jshintrc +++ b/.jshintrc @@ -17,7 +17,7 @@ "strict": false, "trailing": true, "smarttabs": true, - "maxlen": 120, + "maxlen": 140, "globals": { "describe" : false, "context" : false, diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9c38c..a10a823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ +3.0.0-alpha.2 / 2015-06-12 +========================== + + * 指定 doc 中的 example 的脚本名称为 javascript + * update readme + * Fix node v0.10 not support child_process.execSync + 3.0.0-alpha.1 / 2015-05-15 ========================== diff --git a/README.md b/README.md index cd9a461..9533831 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ when your code is compiled, you can use a smaller elegant.def script. ----------- | --------------- `@name` | `String`, Function name `@alias` | `String`, Function name alias +`@example` | `String`, Function example, used in generating doc `@defaults` | `Object`, Function's arguments default values `@rule` | The main config item (Continue to see more detail) @@ -240,6 +241,7 @@ __Case Insensitive__ * rule 可以指定名称,然后在函数执行是可以知道当前是匹配了哪条 rule * 整合我的 spa-bootstrap * 支持新类型 enum: (string flag = ok|cancel, string foo) +* 支持多 type: (string|int some, bool other) -> * * 根据 rule 自动化测试 * 自动测试 * silent def diff --git a/bin/def-doc.js b/bin/def-doc.js index 1538b14..5dbbb27 100755 --- a/bin/def-doc.js +++ b/bin/def-doc.js @@ -40,23 +40,23 @@ if (!program.args.length) { docs.forEach(function(docObj) { var source = relativeFile + '#L' + docObj.loc.start.line + '-' + docObj.loc.end.line; - result.push('### [' + (docObj.names && docObj.names.shift() || '(anonymous)') + '](' + source + ')'); + result.push('### [' + (docObj.names && docObj.names.length && docObj.names.join(' & ') || '(anonymous)') + '](' + source + ')'); if (docObj.desc) { result.push(docObj.desc); } - if (docObj.names && docObj.names.length) { - result.push('__Alias: __`' + docObj.names.join('`, `') + '`'); - } + //if (docObj.names && docObj.names.length) { + // result.push('__Alias:__ `' + docObj.names.join('`, `') + '`'); + //} - result.push('__Rules: __'); + result.push('__Rules:__ '); result.push(docObj.rules.map(function(rule) { return ' - `' + ruleToString(rule) + '`'; }).join(os.EOL)); if (docObj.examples.length) { - result.push('__Examples: __'); + result.push('__Examples:__ '); } docObj.examples.forEach(function(ex) { result.push('```js'); diff --git a/bower.json b/bower.json index 9b28ba0..ad07fb2 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "elegant.def", - "version": "3.0.0-alpha.1", + "version": "3.0.0-alpha.2", "homepage": "https://github.com/qiu8310/elegant.def", "authors": [ "Zhonglei Qiu " diff --git a/examples/arguments.md b/examples/arguments.md index e67d720..36fa91d 100644 --- a/examples/arguments.md +++ b/examples/arguments.md @@ -1,18 +1,16 @@ ## [arguments.js](arguments.js) -### [argFn](arguments.js#L3-20) +### [argFn & xx](arguments.js#L3-20) 这里是函数描述 -__Alias: __`xx` - -__Rules: __ +__Rules:__ - `() -> int` - `(int a = 0) -> int` - `(int a = 0, int b = 10) -> int` -__Examples: __ +__Examples:__ ```js diff --git a/examples/class-member-def.md b/examples/class-member-def.md index 2b59b26..32cbaf1 100644 --- a/examples/class-member-def.md +++ b/examples/class-member-def.md @@ -2,7 +2,7 @@ ### [(anonymous)](class-member-def.js#L7-12) -__Rules: __ +__Rules:__ - `(string words) -> string` diff --git a/examples/embed-def.md b/examples/embed-def.md index 397664c..24aace1 100644 --- a/examples/embed-def.md +++ b/examples/embed-def.md @@ -2,7 +2,7 @@ ### [someName](embed-def.js#L3-17) -__Rules: __ +__Rules:__ - `(int a) -> int` @@ -11,7 +11,7 @@ __Rules: __ ### [(anonymous)](embed-def.js#L8-13) -__Rules: __ +__Rules:__ - `(int a) -> int` diff --git a/examples/multiple-def.md b/examples/multiple-def.md index b72ca87..f08754e 100644 --- a/examples/multiple-def.md +++ b/examples/multiple-def.md @@ -2,7 +2,7 @@ ### [(anonymous)](multiple-def.js#L3-8) -__Rules: __ +__Rules:__ - `(int a) -> int` @@ -11,7 +11,7 @@ __Rules: __ ### [(anonymous)](multiple-def.js#L10-16) -__Rules: __ +__Rules:__ - `(int b) -> string` diff --git a/examples/random.md b/examples/random.md index b43de38..245de35 100644 --- a/examples/random.md +++ b/examples/random.md @@ -2,7 +2,7 @@ ### [(anonymous)](random.js#L6-13) -__Rules: __ +__Rules:__ - `() -> int` - `(int min = 0) -> int` diff --git a/examples/range.md b/examples/range.md index 33c8f9c..3b9b08b 100644 --- a/examples/range.md +++ b/examples/range.md @@ -2,7 +2,7 @@ ### [(anonymous)](range.js#L6-20) -__Rules: __ +__Rules:__ - `() -> array` - `(int start = 0) -> array` diff --git a/examples/rest-def.md b/examples/rest-def.md index 2ee950a..83fb489 100644 --- a/examples/rest-def.md +++ b/examples/rest-def.md @@ -2,7 +2,7 @@ ### [(anonymous)](rest-def.js#L3-11) -__Rules: __ +__Rules:__ - `(int ...all) -> int` @@ -11,7 +11,7 @@ __Rules: __ ### [(anonymous)](rest-def.js#L19-25) -__Rules: __ +__Rules:__ - `(array to = [], * ...others) -> array` @@ -20,7 +20,7 @@ __Rules: __ ### [(anonymous)](rest-def.js#L32-37) -__Rules: __ +__Rules:__ - `(int a, int ...b, string c) -> string` diff --git a/examples/unique.md b/examples/unique.md index 6c5a1b8..871891f 100644 --- a/examples/unique.md +++ b/examples/unique.md @@ -2,7 +2,7 @@ ### [(anonymous)](unique.js#L3-11) -__Rules: __ +__Rules:__ - `() -> int` - `(int a = 0) -> int` diff --git a/package.json b/package.json index 7e22b3c..0bc1b09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elegant.def", - "version": "3.0.0-alpha.1", + "version": "3.0.0-alpha.2", "description": "Elegant define javascript function", "main": "src/full.js", "scripts": { diff --git a/test/testDefCompile.js b/test/testDefCompile.js index 17dee1d..d492d15 100644 --- a/test/testDefCompile.js +++ b/test/testDefCompile.js @@ -50,23 +50,23 @@ describe('defCompile', function() { docs.forEach(function(docObj) { var source = relativeFile + '#L' + docObj.loc.start.line + '-' + docObj.loc.end.line; - result.push('### [' + (docObj.names && docObj.names.shift() || '(anonymous)') + '](' + source + ')'); + result.push('### [' + (docObj.names && docObj.names.length && docObj.names.join(' & ') || '(anonymous)') + '](' + source + ')'); if (docObj.desc) { result.push(docObj.desc); } - if (docObj.names && docObj.names.length) { - result.push('__Alias: __`' + docObj.names.join('`, `') + '`'); - } + //if (docObj.names && docObj.names.length) { + // result.push('__Alias:__ `' + docObj.names.join('`, `') + '`'); + //} - result.push('__Rules: __'); + result.push('__Rules:__ '); result.push(docObj.rules.map(function(rule) { return ' - `' + ruleToString(rule) + '`'; }).join(os.EOL)); if (docObj.examples.length) { - result.push('__Examples: __'); + result.push('__Examples:__ '); } docObj.examples.forEach(function(ex) { result.push('```js');