schematron 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.semver +2 -2
- data/bin/stron +20 -15
- data/schematron.gemspec +2 -2
- metadata +3 -3
data/.semver
CHANGED
data/bin/stron
CHANGED
@@ -6,29 +6,34 @@ require 'schematron'
|
|
6
6
|
|
7
7
|
include LibXML
|
8
8
|
|
9
|
-
|
10
|
-
XML.default_line_numbers = true
|
9
|
+
XML.default_line_numbers = true
|
11
10
|
|
12
|
-
|
11
|
+
begin
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# get args
|
14
|
+
schema_file = ARGV.shift or raise "schematron file required"
|
15
|
+
instance_file = ARGV.shift or raise "instance doc file required"
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
# parse the xml
|
18
|
+
schema_doc = XML::Document.file schema_file
|
19
|
+
instance_doc = XML::Document.file instance_file
|
20
|
+
stron = Schematron::Schema.new schema_doc
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
# validate
|
23
|
+
errors = stron.validate(instance_doc)
|
24
|
+
if errors.empty?
|
25
|
+
exit 0
|
26
|
+
else
|
27
|
+
|
28
|
+
errors.each do |error|
|
25
29
|
puts '%s "%s" on line %d: %s' % error.values_at(:type, :name, :line, :message)
|
26
30
|
end
|
27
31
|
|
28
|
-
rescue => e
|
29
|
-
puts "Usage: stron [schematron] [instance doc]"
|
30
|
-
puts e.message
|
31
32
|
exit 1
|
32
33
|
end
|
33
34
|
|
35
|
+
rescue => e
|
36
|
+
puts "Usage: stron [schematron] [instance doc]"
|
37
|
+
puts e.message
|
38
|
+
exit 2
|
34
39
|
end
|
data/schematron.gemspec
CHANGED
@@ -8,12 +8,12 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.homepage = 'http://github.com/flazz/schematron'
|
9
9
|
spec.authors = ["Francesco Lazzarino"]
|
10
10
|
spec.executables << 'stron'
|
11
|
-
|
11
|
+
|
12
12
|
spec.files = ["schematron.gemspec", "README.md", "LICENSE.txt", '.semver']
|
13
13
|
spec.files += Dir['lib/*.rb']
|
14
14
|
spec.files += Dir['spec/**/*']
|
15
15
|
spec.files += Dir['iso-schematron-xslt1/*']
|
16
|
-
spec.add_dependency 'semver', '~> 0.
|
16
|
+
spec.add_dependency 'semver', '~> 0.2.0'
|
17
17
|
spec.add_dependency 'libxml-ruby', '~> 1.1.2'
|
18
18
|
spec.add_dependency 'libxslt-ruby', '>= 0.9.1'
|
19
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schematron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Lazzarino
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-22 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.2.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: libxml-ruby
|