schemacop 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rubocop.yml +42 -0
- data/.travis.yml +6 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +346 -0
- data/RUBY_VERSION +1 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/doc/Schemacop.html +208 -0
- data/doc/Schemacop/Exceptions.html +115 -0
- data/doc/Schemacop/Exceptions/Base.html +127 -0
- data/doc/Schemacop/Exceptions/InvalidSchema.html +141 -0
- data/doc/Schemacop/Exceptions/Validation.html +142 -0
- data/doc/Schemacop/Validator.html +254 -0
- data/doc/_index.html +177 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +405 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +405 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +69 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/schemacop.rb +11 -0
- data/lib/schemacop/exceptions.rb +10 -0
- data/lib/schemacop/validator.rb +138 -0
- data/schemacop.gemspec +49 -0
- data/test/schemacop_validator_test.rb +197 -0
- metadata +192 -0
data/RUBY_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p353
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
task :gemspec do
|
2
|
+
gemspec = Gem::Specification.new do |spec|
|
3
|
+
spec.name = 'schemacop'
|
4
|
+
spec.version = IO.read('VERSION').chomp
|
5
|
+
spec.authors = ['Sitrox']
|
6
|
+
spec.summary = %(
|
7
|
+
Schemacop validates ruby structures consisting of nested hashes and arrays
|
8
|
+
against simple schema definitions.
|
9
|
+
)
|
10
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
11
|
+
spec.executables = []
|
12
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
13
|
+
spec.require_paths = ['lib']
|
14
|
+
|
15
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
16
|
+
spec.add_development_dependency 'rake'
|
17
|
+
spec.add_development_dependency 'ci_reporter', '~> 2.0'
|
18
|
+
spec.add_development_dependency 'ci_reporter_minitest'
|
19
|
+
spec.add_development_dependency 'activesupport'
|
20
|
+
spec.add_development_dependency 'haml'
|
21
|
+
spec.add_development_dependency 'yard'
|
22
|
+
spec.add_development_dependency 'redcarpet'
|
23
|
+
end
|
24
|
+
|
25
|
+
File.open('schemacop.gemspec', 'w') { |f| f.write(gemspec.to_ruby.strip) }
|
26
|
+
end
|
27
|
+
|
28
|
+
# rubocop: disable Lint/HandleExceptions
|
29
|
+
begin
|
30
|
+
require 'rake/testtask'
|
31
|
+
require 'ci/reporter/rake/minitest'
|
32
|
+
Rake::TestTask.new do |t|
|
33
|
+
t.pattern = 'test/*_test.rb'
|
34
|
+
t.verbose = false
|
35
|
+
t.libs << 'test'
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/doc/Schemacop.html
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Schemacop
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!Schemacop.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (S)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Schemacop</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Schemacop
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/schemacop.rb<span class="defines">,<br />
|
83
|
+
lib/schemacop/validator.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Schemacop/Exceptions.html" title="Schemacop::Exceptions (module)">Exceptions</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Schemacop/Validator.html" title="Schemacop::Validator (class)">Validator</a></span>
|
98
|
+
|
99
|
+
|
100
|
+
</p>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Class Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#validate%21-class_method" title="validate! (class method)">+ (Object) <strong>validate!</strong>(schema, data) </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p><p>Validates <code>data</code> against <code>schema</code> and throws an exception on missmatch.</p>
|
134
|
+
</p>
|
135
|
+
</div></span>
|
136
|
+
|
137
|
+
</li>
|
138
|
+
|
139
|
+
|
140
|
+
</ul>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<div id="class_method_details" class="method_details_list">
|
146
|
+
<h2>Class Method Details</h2>
|
147
|
+
|
148
|
+
|
149
|
+
<div class="method_details first">
|
150
|
+
<h3 class="signature first" id="validate!-class_method">
|
151
|
+
|
152
|
+
+ (<tt>Object</tt>) <strong>validate!</strong>(schema, data)
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</h3><div class="docstring">
|
159
|
+
<div class="discussion">
|
160
|
+
<p><p>Validates <code>data</code> against <code>schema</code> and throws an exception on missmatch.</p>
|
161
|
+
</p>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
<div class="tags">
|
167
|
+
|
168
|
+
|
169
|
+
<p class="tag_title">See Also:</p>
|
170
|
+
<ul class="see">
|
171
|
+
|
172
|
+
<li><span class='object_link'><a href="Schemacop/Validator.html#validate%21-class_method" title="Schemacop::Validator.validate! (method)">Schemacop::Validator.validate!</a></span></li>
|
173
|
+
|
174
|
+
</ul>
|
175
|
+
|
176
|
+
</div><table class="source_code">
|
177
|
+
<tr>
|
178
|
+
<td>
|
179
|
+
<pre class="lines">
|
180
|
+
|
181
|
+
|
182
|
+
4
|
183
|
+
5
|
184
|
+
6</pre>
|
185
|
+
</td>
|
186
|
+
<td>
|
187
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop.rb', line 4</span>
|
188
|
+
|
189
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='id identifier rubyid_schema'>schema</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
190
|
+
<span class='const'>Validator</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='id identifier rubyid_schema'>schema</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
191
|
+
<span class='kw'>end</span></pre>
|
192
|
+
</td>
|
193
|
+
</tr>
|
194
|
+
</table>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div id="footer">
|
202
|
+
Generated on Mon Jun 6 15:59:00 2016 by
|
203
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
204
|
+
0.8.7.6 (ruby-2.0.0).
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</body>
|
208
|
+
</html>
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Schemacop::Exceptions
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Schemacop/Exceptions.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (E)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Schemacop.html" title="Schemacop (module)">Schemacop</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Exceptions</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Schemacop::Exceptions
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/schemacop/exceptions.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Defined Under Namespace</h2>
|
88
|
+
<p class="children">
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Exceptions/Base.html" title="Schemacop::Exceptions::Base (class)">Base</a></span>, <span class='object_link'><a href="Exceptions/InvalidSchema.html" title="Schemacop::Exceptions::InvalidSchema (class)">InvalidSchema</a></span>, <span class='object_link'><a href="Exceptions/Validation.html" title="Schemacop::Exceptions::Validation (class)">Validation</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
</p>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div id="footer">
|
109
|
+
Generated on Mon Jun 6 15:59:00 2016 by
|
110
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
+
0.8.7.6 (ruby-2.0.0).
|
112
|
+
</div>
|
113
|
+
|
114
|
+
</body>
|
115
|
+
</html>
|
@@ -0,0 +1,127 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Exception: Schemacop::Exceptions::Base
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!Schemacop/Exceptions/Base.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (B)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Schemacop.html" title="Schemacop (module)">Schemacop</a></span></span> » <span class='title'><span class='object_link'><a href="../Exceptions.html" title="Schemacop::Exceptions (module)">Exceptions</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Base</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Exception: Schemacop::Exceptions::Base
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">StandardError</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">StandardError</li>
|
82
|
+
|
83
|
+
<li class="next">Schemacop::Exceptions::Base</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/schemacop/exceptions.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
<div id="subclasses">
|
105
|
+
<h2>Direct Known Subclasses</h2>
|
106
|
+
<p class="children"><span class='object_link'><a href="InvalidSchema.html" title="Schemacop::Exceptions::InvalidSchema (class)">InvalidSchema</a></span>, <span class='object_link'><a href="Validation.html" title="Schemacop::Exceptions::Validation (class)">Validation</a></span></p>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div id="footer">
|
121
|
+
Generated on Mon Jun 6 15:59:00 2016 by
|
122
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
|
+
0.8.7.6 (ruby-2.0.0).
|
124
|
+
</div>
|
125
|
+
|
126
|
+
</body>
|
127
|
+
</html>
|