kwalify 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +12 -3
- data/MIT-LICENSE +1 -1
- data/README.txt +10 -10
- data/bin/kwalify +3 -3
- data/contrib/inline-require +54 -28
- data/contrib/kwalify +45 -44
- data/doc-api/classes/CommandOptionError.html +7 -7
- data/doc-api/classes/CommandOptionParser.html +18 -18
- data/doc-api/classes/Kwalify.html +1 -1
- data/doc-api/classes/Kwalify/AssertionError.html +6 -6
- data/doc-api/classes/Kwalify/BaseParser.html +60 -60
- data/doc-api/classes/Kwalify/CommandOptionError.html +6 -6
- data/doc-api/classes/Kwalify/Main.html +30 -30
- data/doc-api/classes/Kwalify/MetaValidator.html +18 -18
- data/doc-api/classes/Kwalify/Parser.html +6 -6
- data/doc-api/classes/Kwalify/PlainYamlParser.html +90 -90
- data/doc-api/classes/Kwalify/PlainYamlParser/Alias.html +6 -6
- data/doc-api/classes/Kwalify/Rule.html +24 -24
- data/doc-api/classes/Kwalify/SchemaError.html +6 -6
- data/doc-api/classes/Kwalify/SyntaxError.html +12 -12
- data/doc-api/classes/Kwalify/Util.html +8 -7
- data/doc-api/classes/Kwalify/ValidationError.html +6 -6
- data/doc-api/classes/Kwalify/Validator.html +39 -39
- data/doc-api/classes/Kwalify/YamlParser.html +84 -84
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +11 -11
- data/doc-api/files/kwalify/errors_rb.html +2 -2
- data/doc-api/files/kwalify/main_rb.html +2 -2
- data/doc-api/files/kwalify/messages_rb.html +2 -2
- data/doc-api/files/kwalify/meta-validator_rb.html +2 -2
- data/doc-api/files/kwalify/parser/base_rb.html +2 -2
- data/doc-api/files/kwalify/parser/yaml_rb.html +2 -2
- data/doc-api/files/kwalify/rule_rb.html +2 -2
- data/doc-api/files/kwalify/types_rb.html +2 -2
- data/doc-api/files/kwalify/util/assert-text-equal_rb.html +2 -2
- data/doc-api/files/kwalify/util/hash-interface_rb.html +2 -2
- data/doc-api/files/kwalify/util/hashlike_rb.html +2 -2
- data/doc-api/files/kwalify/util/option-parser_rb.html +2 -2
- data/doc-api/files/kwalify/util/ordered-hash_rb.html +2 -2
- data/doc-api/files/kwalify/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwalify/util_rb.html +2 -2
- data/doc-api/files/kwalify/validator_rb.html +2 -2
- data/doc-api/files/kwalify/yaml-parser_rb.html +2 -2
- data/doc-api/files/kwalify_rb.html +2 -2
- data/doc-api/fr_method_index.html +70 -70
- data/doc/users-guide.html +1 -1
- data/examples/address-book/address-book.schema.yaml +2 -2
- data/examples/invoice/invoice.schema.yaml +3 -3
- data/examples/tapkit/tapkit.schema.yaml +2 -2
- data/lib/kwalify.rb +3 -3
- data/lib/kwalify/errors.rb +3 -3
- data/lib/kwalify/kwalify.schema.yaml +3 -3
- data/lib/kwalify/main.rb +4 -4
- data/lib/kwalify/messages.rb +3 -3
- data/lib/kwalify/meta-validator.rb +3 -3
- data/lib/kwalify/parser/base.rb +3 -3
- data/lib/kwalify/parser/yaml.rb +3 -3
- data/lib/kwalify/rule.rb +3 -3
- data/lib/kwalify/templates/genclass-java.eruby +3 -3
- data/lib/kwalify/templates/genclass-php.eruby +2 -2
- data/lib/kwalify/templates/genclass-ruby.eruby +3 -3
- data/lib/kwalify/types.rb +3 -3
- data/lib/kwalify/util.rb +6 -5
- data/lib/kwalify/util/assert-text-equal.rb +3 -3
- data/lib/kwalify/util/hash-interface.rb +3 -3
- data/lib/kwalify/util/hashlike.rb +3 -3
- data/lib/kwalify/util/option-parser.rb +3 -3
- data/lib/kwalify/util/ordered-hash.rb +2 -2
- data/lib/kwalify/util/testcase-helper.rb +3 -3
- data/lib/kwalify/validator.rb +3 -3
- data/lib/kwalify/yaml-parser.rb +3 -3
- data/test/test-action.rb +3 -3
- data/test/test-action.yaml +3 -3
- data/test/test-databinding.rb +3 -3
- data/test/test-databinding.yaml +2 -2
- data/test/test-main.rb +3 -3
- data/test/test-main.yaml +34 -3
- data/test/test-metavalidator.rb +3 -3
- data/test/test-metavalidator.yaml +3 -3
- data/test/test-parser-yaml.rb +3 -3
- data/test/test-parser-yaml.yaml +3 -3
- data/test/test-rule.rb +3 -3
- data/test/test-rule.yaml +3 -3
- data/test/test-util.rb +125 -0
- data/test/test-validator.rb +3 -3
- data/test/test-validator.yaml +3 -3
- data/test/test-yaml-parser.rb +3 -3
- data/test/test-yaml-parser.yaml +4 -4
- data/test/test.rb +4 -3
- metadata +56 -55
data/doc/users-guide.html
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
<div align="left"><h1>Kwalify User's Guide (for Ruby)</h1></div>
|
16
16
|
<div align="left">
|
17
17
|
makoto kuwata <kwa(at)kuwata-lab.com><br>
|
18
|
-
last update: $Date
|
18
|
+
last update: $Date$<br>
|
19
19
|
</div>
|
20
20
|
|
21
21
|
<a name="preface"></a>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
##
|
2
2
|
## Kwalify schema example for address book
|
3
3
|
##
|
4
|
-
## $Release: 0.7.
|
5
|
-
## copyright(c) 2005-
|
4
|
+
## $Release: 0.7.2 $
|
5
|
+
## copyright(c) 2005-2010 kuwata-lab all rights reserved.
|
6
6
|
##
|
7
7
|
##
|
8
8
|
## NOTE: 'type: str' is omitted in this example because 'str' is default type.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
###
|
2
2
|
### Kwalify schema example for invoice
|
3
3
|
###
|
4
|
-
### $Rev
|
5
|
-
### $Release: 0.7.
|
6
|
-
### copyright(c) 2005-
|
4
|
+
### $Rev$
|
5
|
+
### $Release: 0.7.2 $
|
6
|
+
### copyright(c) 2005-2010 kuwata-lab all rights reserved.
|
7
7
|
###
|
8
8
|
|
9
9
|
type: map
|
data/lib/kwalify.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
###
|
2
|
-
### $Rev
|
3
|
-
### $Release: 0.7.
|
2
|
+
### $Rev$
|
3
|
+
### $Release: 0.7.2 $
|
4
4
|
### copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
###
|
6
6
|
|
7
7
|
|
8
8
|
module Kwalify
|
9
9
|
|
10
|
-
RELEASE = ("$Release: 0.7.
|
10
|
+
RELEASE = ("$Release: 0.7.2 $" =~ /[.\d]+/) && $&
|
11
11
|
|
12
12
|
end
|
13
13
|
|
data/lib/kwalify/errors.rb
CHANGED
data/lib/kwalify/main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
###
|
2
|
-
### $Rev
|
3
|
-
### $Release: 0.7.
|
4
|
-
### copyright(c) 2005-
|
2
|
+
### $Rev$
|
3
|
+
### $Release: 0.7.2 $
|
4
|
+
### copyright(c) 2005-2010 kuwata-lab all rights reserved.
|
5
5
|
###
|
6
6
|
|
7
7
|
require 'yaml'
|
@@ -323,7 +323,7 @@ module Kwalify
|
|
323
323
|
end
|
324
324
|
elsif ydoc.nil?
|
325
325
|
#* key=:validation_empty msg="%s#%d: empty.\n"
|
326
|
-
puts
|
326
|
+
puts Kwalify.msg(:validation_empty) % [filename, i]
|
327
327
|
else
|
328
328
|
#* key=:validation_valid msg="%s#%d: valid."
|
329
329
|
puts Kwalify.msg(:validation_valid) % [filename, i] unless @options[:quiet]
|
data/lib/kwalify/messages.rb
CHANGED
data/lib/kwalify/parser/base.rb
CHANGED
data/lib/kwalify/parser/yaml.rb
CHANGED
data/lib/kwalify/rule.rb
CHANGED
data/lib/kwalify/types.rb
CHANGED
data/lib/kwalify/util.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
###
|
2
|
-
### $Rev
|
3
|
-
### $Release: 0.7.
|
4
|
-
### copyright(c) 2005-
|
2
|
+
### $Rev$
|
3
|
+
### $Release: 0.7.2 $
|
4
|
+
### copyright(c) 2005-2010 kuwata-lab all rights reserved.
|
5
5
|
###
|
6
6
|
|
7
7
|
module Kwalify
|
@@ -17,7 +17,8 @@ module Kwalify
|
|
17
17
|
## untabified_str = YamlHelper.untabify(tabbed_str)
|
18
18
|
##
|
19
19
|
def untabify(str, width=8)
|
20
|
-
|
20
|
+
return str if str.nil?
|
21
|
+
list = str.split(/\t/, -1) # if 2nd arg is negative then split() doesn't remove tailing empty strings
|
21
22
|
last = list.pop
|
22
23
|
sb = ''
|
23
24
|
list.each do |s|
|
@@ -37,7 +38,7 @@ module Kwalify
|
|
37
38
|
## Kwalify::Util.traverse_schema(schema) do |rulehash|
|
38
39
|
## ## add module prefix to class name
|
39
40
|
## if rulehash['class']
|
40
|
-
## rulehash['class'] =
|
41
|
+
## rulehash['class'] = 'MyModule::' + rulehash['class']
|
41
42
|
## end
|
42
43
|
## end
|
43
44
|
def traverse_schema(schema, &block) #:yield: rulehash
|
data/lib/kwalify/validator.rb
CHANGED
data/lib/kwalify/yaml-parser.rb
CHANGED
data/test/test-action.rb
CHANGED
data/test/test-action.yaml
CHANGED
data/test/test-databinding.rb
CHANGED
data/test/test-databinding.yaml
CHANGED
data/test/test-main.rb
CHANGED
data/test/test-main.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
|
-
## $Rev
|
3
|
-
## $Release: 0.7.
|
4
|
-
## copyright(c) 2005-
|
2
|
+
## $Rev$
|
3
|
+
## $Release: 0.7.2 $
|
4
|
+
## copyright(c) 2005-2010 kuwata-lab all rights reserved.
|
5
5
|
##
|
6
6
|
---
|
7
7
|
- name: parseOptions1
|
@@ -382,3 +382,34 @@
|
|
382
382
|
#java: "*USER: anchor not found."
|
383
383
|
expected: |
|
384
384
|
##
|
385
|
+
---
|
386
|
+
- name: empty1
|
387
|
+
desc: ignore first empty document
|
388
|
+
method: execute
|
389
|
+
args: [ -f, empty1.schema, empty1.document ]
|
390
|
+
schema: |
|
391
|
+
type: map
|
392
|
+
mapping:
|
393
|
+
"name": { type: str }
|
394
|
+
document: |
|
395
|
+
---
|
396
|
+
name: Foo
|
397
|
+
expected: |
|
398
|
+
empty1.document#0: valid.
|
399
|
+
|
400
|
+
- name: empty2
|
401
|
+
desc: report 'empty.' when document is empty
|
402
|
+
method: execute
|
403
|
+
args: [ -f, empty2.schema, empty2.document ]
|
404
|
+
schema: |
|
405
|
+
type: map
|
406
|
+
mapping:
|
407
|
+
"name": { type: str }
|
408
|
+
document: |
|
409
|
+
---
|
410
|
+
name: Foo
|
411
|
+
---
|
412
|
+
expected: |
|
413
|
+
empty2.document#0: valid.
|
414
|
+
empty2.document#1: empty.
|
415
|
+
|
data/test/test-metavalidator.rb
CHANGED