middleman-xmlvalidator 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 657c043b6cccfb08a4d56357544082d7d1283bdb
|
4
|
+
data.tar.gz: 81aa7f5fe1f411b0e3874d08baa8fbdab9c7e8d4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b4658ebc46f7a275320010f24b298aac5a18604d797cb6d3a07cc95224fea898d50d5cbafa8a8b3cd856fbe725daff36cec8d17b564c2b04e1613c69ab23ae1f
|
7
|
+
data.tar.gz: a72cb0703089ac03f6a1a17a3dc4c0e11cac11dab3e3b9d204a20783c5b9bb27fd9f7f4fbc46d623acf7eb0d488c8c94fb40d9915c2ba2a33bc13af853662916
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Middleman::Xmlvalidator
|
2
2
|
|
3
|
-
|
3
|
+
This gem is used with middleman to validate the RSS and XML files that are generated in the build folder. The gem uses NokoGiri and some different XML schemas to validate the files in question. Dig into the code to see how it works. It's pretty straight forward.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -3,49 +3,31 @@ module Middleman
|
|
3
3
|
class << self
|
4
4
|
def registered(app)
|
5
5
|
require 'nokogiri'
|
6
|
+
|
6
7
|
app.after_build do |builder|
|
7
8
|
puts "", "Validating with NokoGiri", ""
|
9
|
+
p Xmlvalidator.files_to_validate
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
Dir.glob("build/**/*crossdomain.xml").each do |full_path|
|
17
|
-
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'crossdomain.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
|
18
|
-
Xmlvalidator.validate(full_path, 'crossdomain.xsd').each do |error|
|
19
|
-
puts " " + error.message
|
20
|
-
end
|
21
|
-
end
|
11
|
+
Xmlvalidator.files_to_validate.each do |full_path|
|
12
|
+
file_name = full_path.split('/').last
|
13
|
+
validator_file = file_name.gsub(/\.\w*/, '.xsd')
|
14
|
+
validator_filepath = File.join(File.dirname(__FILE__), '/schema/' + validator_file)
|
15
|
+
validator = File.exists?(validator_filepath) ? validator_file : (file_name.end_with?('.rss') ? "RSSSchema.xsd" : "XMLSchema.xsd")
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
Xmlvalidator.validate(full_path, 'Sitemap3.xsd').each do |error|
|
17
|
+
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, validator) == true ? "COMPLETE".green : "ERRORS FOUND".red)
|
18
|
+
Xmlvalidator.validate(full_path, validator).each do |error|
|
26
19
|
puts " " + error.message
|
27
20
|
end
|
28
21
|
end
|
29
22
|
|
30
|
-
Dir.glob("build/**/*.rss").each do |full_path|
|
31
|
-
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'RSSSchema.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
|
32
|
-
Xmlvalidator.validate(full_path, 'RSSSchema.xsd').each do |error|
|
33
|
-
puts " " + error.message
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Dir.glob("build/**/*.xml").each do |full_path|
|
38
|
-
if not (full_path.match(/^.*BingSiteAuth.xml$/) || full_path.match(/^.*crossdomain.xml$/) || full_path.match(/^.*Sitemap.xml$/))
|
39
|
-
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'XMLSchema.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
|
40
|
-
Xmlvalidator.validate(full_path, 'XMLSchema.xsd').each do |error|
|
41
|
-
puts " " + error.message
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
23
|
puts "", "Validation with NokoGiri " + "Complete".green, ""
|
47
24
|
end
|
48
25
|
end
|
26
|
+
|
27
|
+
def files_to_validate
|
28
|
+
Dir.glob("build/**/*.{xml,rss}")
|
29
|
+
end
|
30
|
+
|
49
31
|
alias :included :registered
|
50
32
|
end
|
51
33
|
|
@@ -60,5 +42,6 @@ module Middleman
|
|
60
42
|
document = Nokogiri::XML(File.read(document_path))
|
61
43
|
schema.valid?(document)
|
62
44
|
end
|
45
|
+
|
63
46
|
end
|
64
47
|
end
|
File without changes
|
@@ -11,9 +11,9 @@ Gem::Specification.new do |g|
|
|
11
11
|
g.version = Middleman::Xmlvalidator::VERSION
|
12
12
|
g.authors = ["briananders"]
|
13
13
|
g.email = ["anders.brian@icloud.com"]
|
14
|
-
g.description = %q{This
|
14
|
+
g.description = %q{This gem is a middleman extension that is used for validating xml and rss files in your build folder.}
|
15
15
|
g.summary = %q{middleman extension to validate xml and rss files.}
|
16
|
-
g.homepage = "
|
16
|
+
g.homepage = "http://briananders.me"
|
17
17
|
g.license = "MIT"
|
18
18
|
|
19
19
|
g.files = `git ls-files`.split($/)
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |g|
|
|
24
24
|
g.add_development_dependency("bundler", ["~> 1.3"])
|
25
25
|
g.add_development_dependency("rake")
|
26
26
|
|
27
|
-
g.add_runtime_dependency("nokogiri", ["
|
28
|
-
g.add_runtime_dependency("middleman", ["
|
27
|
+
g.add_runtime_dependency("nokogiri", [">1.5.6"])
|
28
|
+
g.add_runtime_dependency("middleman", ["> 3.0.12"])
|
29
29
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-xmlvalidator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- briananders
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,53 +27,47 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: nokogiri
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>'
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.5.6
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>'
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.5.6
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: middleman
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>'
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 3.0.12
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>'
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 3.0.12
|
78
|
-
description: This
|
79
|
-
files in your build folder.
|
69
|
+
description: This gem is a middleman extension that is used for validating xml and
|
70
|
+
rss files in your build folder.
|
80
71
|
email:
|
81
72
|
- anders.brian@icloud.com
|
82
73
|
executables: []
|
@@ -94,35 +85,34 @@ files:
|
|
94
85
|
- lib/middleman/xmlvalidator/schema/BingSiteAuth.xsd
|
95
86
|
- lib/middleman/xmlvalidator/schema/RSSSchema.xsd
|
96
87
|
- lib/middleman/xmlvalidator/schema/Sitemap2.xsd
|
97
|
-
- lib/middleman/xmlvalidator/schema/Sitemap3.xsd
|
98
88
|
- lib/middleman/xmlvalidator/schema/XMLSchema.xsd
|
99
89
|
- lib/middleman/xmlvalidator/schema/crossdomain.xsd
|
90
|
+
- lib/middleman/xmlvalidator/schema/sitemap.xsd
|
100
91
|
- lib/middleman/xmlvalidator/version.rb
|
101
92
|
- lib/middleman_extension.rb
|
102
93
|
- middleman-xmlvalidator.gemspec
|
103
|
-
homepage:
|
94
|
+
homepage: http://briananders.me
|
104
95
|
licenses:
|
105
96
|
- MIT
|
97
|
+
metadata: {}
|
106
98
|
post_install_message:
|
107
99
|
rdoc_options: []
|
108
100
|
require_paths:
|
109
101
|
- lib
|
110
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
103
|
requirements:
|
113
|
-
- -
|
104
|
+
- - '>='
|
114
105
|
- !ruby/object:Gem::Version
|
115
106
|
version: '0'
|
116
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
108
|
requirements:
|
119
|
-
- -
|
109
|
+
- - '>='
|
120
110
|
- !ruby/object:Gem::Version
|
121
111
|
version: '0'
|
122
112
|
requirements: []
|
123
113
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 2.1.11
|
125
115
|
signing_key:
|
126
|
-
specification_version:
|
116
|
+
specification_version: 4
|
127
117
|
summary: middleman extension to validate xml and rss files.
|
128
118
|
test_files: []
|