circuitdata 0.2.4

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: c8724ff5c75a67cdf1ee25bf8d4d56fc7cd53a0e
4
+ data.tar.gz: 5374354ed564f33acd76d2ec2dc9c70df7615b4f
5
+ SHA512:
6
+ metadata.gz: e8368602779f984cbdd08e724f521c1239f36a2832868b38e24970bb721963b019199f41ea875189c4d12e424afadf26032832250ca7048e07971a422a3447b1
7
+ data.tar.gz: 0980b9365a3c2435ac6762436b124f312d337ef6778a7ad3aa52226534460e21420fdfb83acd94ee1d25f64992f962355f88afadc2158f3db4465d5694319382
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Andreas Lydersen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Circuitdata
2
+ This gem provides helper functions that allows you to do schema checks and control files up against each other according to the [CircuitData Language](https://circuitdata.org)
3
+
4
+ ## Installation
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'circuitdata'
9
+ ```
10
+
11
+ And then execute:
12
+ ```bash
13
+ $ bundle
14
+ ```
15
+
16
+ Or install it yourself as:
17
+ ```bash
18
+ $ gem install circuitdata
19
+ ```
20
+
21
+ ## Usage
22
+ If not in rails
23
+ ```
24
+ require 'circuitdata'
25
+ ```
26
+
27
+ ### Commands
28
+
29
+ ```
30
+ 2.3.0 :001 > require 'circuitdata'
31
+ => true
32
+ 2.3.0 :002 > # Test one file against the schema
33
+ 2.3.0 :004 > Circuitdata.compatibility_checker( 'testfile-product.json')
34
+ => {:error=>false, :errormessage=>"", :validationserrors=>{}, :restrictederrors=>{}, :enforcederrors=>{}, :capabilitieserrors=>{}}
35
+ 2.3.0 :005 >
36
+ 2.3.0 :006 > # Test two files up against each other (one must be a product file)
37
+ 2.3.0 :007 > Circuitdata.compatibility_checker( 'testfile-product.json', 'testfile-profile-restricted.json' )
38
+ => {:error=>true, :errormessage=>"The product to check did not meet the requirements", :validationserrors=>{}, :restrictederrors=>{"#/open_trade_transfer_package/products/testproduct/printed_circuits_fabrication_data/board/thickness"=>["of type number matched the disallowed schema"]}, :enforcederrors=>{}, :capabilitieserrors=>{}}
39
+ 2.3.0 :005 >
40
+ 2.3.0 :009 > # Turn off validation against the schema
41
+ 2.3.0 :008 > Circuitdata.compatibility_checker( 'testfile-product.json', 'testfile-profile-restricted.json', false )
42
+ => {:error=>true, :errormessage=>"The product to check did not meet the requirements", :validationserrors=>{}, :restrictederrors=>{"#/open_trade_transfer_package/products/testproduct/printed_circuits_fabrication_data/board/thickness"=>["of type number matched the disallowed schema"]}, :enforcederrors=>{}, :capabilitieserrors=>{}}
43
+ ```
44
+
45
+ ## License
46
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,278 @@
1
+ module Circuitdata
2
+ def self.compatibility_checker( productfile, checksfile=nil, validate_origins=true )
3
+
4
+ require 'json'
5
+ require 'json-schema'
6
+
7
+ $jsonschema_v1 = 'http://schema.circuitdata.org/v1/ottp_circuitdata_schema.json'
8
+
9
+ # prepare the return
10
+ returnarray = {
11
+ error: false,
12
+ errormessage: "",
13
+ validationserrors: {},
14
+ restrictederrors: {},
15
+ enforcederrors: {},
16
+ capabilitieserrors: {},
17
+ }
18
+
19
+ # Check to see if the URIs are correct on the received files
20
+ if not File.exist?(productfile)
21
+ returnarray[:error] = true
22
+ returnarray[:errormessage] = "Could not access the file to test"
23
+ return returnarray
24
+ end
25
+ if not checksfile.nil?
26
+ if not File.exist?(checksfile)
27
+ returnarray[:error] = true
28
+ returnarray[:errormessage] = "Could not access the file to check agains (profile or capability)"
29
+ return returnarray
30
+ end
31
+ end
32
+
33
+ # Validate the original files against the CircuitData schema
34
+ if validate_origins
35
+ prod = JSON::Validator.fully_validate($jsonschema_v1, productfile, :errors_as_objects => true)
36
+ if prod.count > 0
37
+ returnarray[:error] = true
38
+ returnarray[:errormessage] = "Could not validate the product file against the CircuitData json schema"
39
+ prod.each do |valerror|
40
+ returnarray[:validationserrors][valerror[:fragment]] = [] unless returnarray[:validationserrors].has_key? valerror[:fragment]
41
+ scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
42
+ returnarray[:validationserrors][valerror[:fragment]] << keep
43
+ end
44
+ end
45
+ if not checksfile.nil?
46
+ checks = JSON::Validator.fully_validate($jsonschema_v1, checksfile, :errors_as_objects => true)
47
+ if checks.count > 0
48
+ returnarray[:error] = true
49
+ returnarray[:errormessage] = "Could not validate the file to check agains (profile or capability) against the CircuitData json schema"
50
+ checks.each do |valerror|
51
+ returnarray[:validationserrors][valerror[:fragment]] = [] unless returnarray[:validationserrors].has_key? valerror[:fragment]
52
+ scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
53
+ returnarray[:validationserrors][valerror[:fragment]] << keep
54
+ end
55
+ return returnarray
56
+ end
57
+ end
58
+ end
59
+
60
+ if not checksfile.nil?
61
+ $has_restrictions = false
62
+ $has_enforced = false
63
+ $has_capabilities = false
64
+
65
+
66
+ restrictedschema = enforcedschema = capabilityschema = {
67
+ "$schema": "http://json-schema.org/draft-04/schema#",
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["open_trade_transfer_package"],
71
+ "properties": {
72
+ "open_trade_transfer_package": {
73
+ "type": "object",
74
+ "properties": {
75
+ "version": {
76
+ "type": "string",
77
+ "pattern": "^1.0$"
78
+ },
79
+ "information": {
80
+ "$ref": "https://raw.githubusercontent.com/elmatica/Open-Trade-Transfer-Package/master/v1/ottp_schema_definitions.json#/definitions/information"
81
+ },
82
+ "products": {
83
+ "type": "object",
84
+ "properties": {
85
+ "generic": {
86
+ "type": "object",
87
+ "properties": {},
88
+ "id": "generic",
89
+ "description": "this should validate any element under generic to be valid"
90
+ }
91
+ },
92
+ "patternProperties": {
93
+ "^(?!generic$).*": {
94
+ "type": "object",
95
+ "required": ["printed_circuits_fabrication_data"],
96
+ "properties": {
97
+ "printed_circuits_fabrication_data": {
98
+ "type": "object",
99
+ "required": ["version"],
100
+ "properties": {
101
+ "stackup": {
102
+ "type": "object",
103
+ "properties": {
104
+ "specified": {
105
+ "type": "object",
106
+ "properties": {
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+
123
+ checksjson = JSON.parse(File.read(checksfile))
124
+ if checksjson["open_trade_transfer_package"].has_key? "profiles"
125
+ # RUN THROUGH THE ENFORCED
126
+ if checksjson["open_trade_transfer_package"]["profiles"].has_key? "enforced"
127
+ $has_enforced = true
128
+ if checksjson["open_trade_transfer_package"]["profiles"]["enforced"].has_key? "printed_circuits_fabrication_data"
129
+ checksjson["open_trade_transfer_package"]["profiles"]["enforced"]["printed_circuits_fabrication_data"].each do |key, value|
130
+ if checksjson["open_trade_transfer_package"]["profiles"]["enforced"]["printed_circuits_fabrication_data"][key].is_a? Hash
131
+ checksjson["open_trade_transfer_package"]["profiles"]["enforced"]["printed_circuits_fabrication_data"][key].each do |subkey, subvalue|
132
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym] = {:type => "object", :properties => {} } unless enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties].has_key? key.to_sym
133
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym] = {:type => "object", :properties => {} } unless enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties].has_key? key.to_sym
134
+ if subvalue.is_a? String
135
+ if subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$") #This is a value range
136
+ from, too = subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$").captures
137
+ newhash = eval("{:minimum => #{from}, :maximum => #{too}}")
138
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
139
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
140
+ else # This is a normal string - check for commas
141
+ enum = []
142
+ subvalue.split(',').each { |enumvalue| enum << enumvalue.strip }
143
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => #{enum}}")
144
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => #{enum}}")
145
+ end
146
+ elsif subvalue.is_a? Numeric # This is a normal string
147
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => [#{subvalue.to_s}]}")
148
+ enforcedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => [#{subvalue.to_s}]}")
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
154
+ # RUN THROUGH THE RESTRICTED
155
+ elsif checksjson["open_trade_transfer_package"]["profiles"].has_key? "restricted"
156
+ $has_restrictions = true
157
+ if checksjson["open_trade_transfer_package"]["profiles"]["restricted"].has_key? "printed_circuits_fabrication_data"
158
+ checksjson["open_trade_transfer_package"]["profiles"]["restricted"]["printed_circuits_fabrication_data"].each do |key, value|
159
+ if checksjson["open_trade_transfer_package"]["profiles"]["restricted"]["printed_circuits_fabrication_data"][key].is_a? Hash
160
+ checksjson["open_trade_transfer_package"]["profiles"]["restricted"]["printed_circuits_fabrication_data"][key].each do |subkey, subvalue|
161
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym] = {:type => "object", :properties => {} } unless restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties].has_key? key.to_sym
162
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym] = {:type => "object", :properties => {} } unless restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties].has_key? key.to_sym
163
+ if subvalue.is_a? String
164
+ if subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$") #This is a value range
165
+ from, too = subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$").captures
166
+ newhash = {:not => {:allOf => [{:minimum => from.to_f},{:maximum => too.to_f}]}}
167
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
168
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
169
+ else # This is a normal string - check for commas
170
+ newhash = {:not => {:anyOf => [{ :enum => ""}]}}
171
+ enum = []
172
+ subvalue.split(',').each { |enumvalue| enum << enumvalue.strip }
173
+ newhash[:not][:anyOf][0][:enum] = enum
174
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
175
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
176
+ end
177
+ elsif subvalue.is_a? Numeric # This is a normal string
178
+ newhash = {:not => {:allOf => [{:minimum => subvalue.to_f},{:maximum => subvalue.to_f}]}}
179
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
180
+ restrictedschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
188
+ # RUN THROUGH THE CAPABILITIES
189
+ if checksjson["open_trade_transfer_package"].has_key? "capabilities"
190
+ $has_capabilities = true
191
+ if checksjson["open_trade_transfer_package"]["capabilities"].has_key? "printed_circuits_fabrication_data"
192
+ checksjson["open_trade_transfer_package"]["capabilities"]["printed_circuits_fabrication_data"].each do |key, value|
193
+ if checksjson["open_trade_transfer_package"]["capabilities"]["printed_circuits_fabrication_data"][key].is_a? Hash
194
+ checksjson["open_trade_transfer_package"]["capabilities"]["printed_circuits_fabrication_data"][key].each do |subkey, subvalue|
195
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym] = {:type => "object", :properties => {} } unless capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties].has_key? key.to_sym
196
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym] = {:type => "object", :properties => {} } unless capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties].has_key? key.to_sym
197
+ if subvalue.is_a? String
198
+ if subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$") #This is a value range
199
+ from, too = subvalue.match("^(\\d*|\\d*.\\d*)\\.\\.\\.(\\d*|\\d*.\\d*)$").captures
200
+ newhash = eval("{:minimum => #{from}, :maximum => #{too}}")
201
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
202
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = newhash
203
+ else # This is a normal string - check for commas
204
+ enum = []
205
+ subvalue.split(',').each { |enumvalue| enum << enumvalue.strip }
206
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => #{enum}}")
207
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => #{enum}}")
208
+ end
209
+ elsif subvalue.is_a? Numeric # This is a normal string
210
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => [#{subvalue.to_s}]}")
211
+ capabilityschema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties][:"^(?!generic$).*"][:properties][:printed_circuits_fabrication_data][:properties][:stackup][:properties][:specified][:properties][key.to_sym][:properties][subkey.to_sym] = eval("{:enum => [#{subvalue.to_s}]}")
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
218
+
219
+ # Test enforced
220
+ if $has_enforced
221
+ enforcedvalidate = JSON::Validator.fully_validate(enforcedschema.to_json, productfile, :errors_as_objects => true)
222
+ if enforcedvalidate.count > 0
223
+ returnarray[:error] = true
224
+ returnarray[:errormessage] = "The product to check did not meet the requirements"
225
+ enforcedvalidate.each do |valerror|
226
+ returnarray[:enforcederrors][valerror[:fragment]] = [] unless returnarray[:enforcederrors].has_key? valerror[:fragment]
227
+ begin
228
+ scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema[\\s\\S]*)$").captures
229
+ rescue
230
+ keep = valerror[:message]
231
+ end
232
+ returnarray[:enforcederrors][valerror[:fragment]] << keep
233
+ end
234
+ end
235
+ end
236
+
237
+
238
+ # Test restricted
239
+ if $has_restrictions
240
+ restrictedvalidate = JSON::Validator.fully_validate(restrictedschema.to_json, productfile, :errors_as_objects => true)
241
+ if restrictedvalidate.count > 0
242
+ returnarray[:error] = true
243
+ returnarray[:errormessage] = "The product to check did not meet the requirements"
244
+ restrictedvalidate.each do |valerror|
245
+ returnarray[:restrictederrors][valerror[:fragment]] = [] unless returnarray[:restrictederrors].has_key? valerror[:fragment]
246
+ begin
247
+ scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema[\\s\\S]*)$").captures
248
+ rescue
249
+ keep = valerror[:message]
250
+ end
251
+ returnarray[:restrictederrors][valerror[:fragment]] << keep
252
+ end
253
+ end
254
+ end
255
+
256
+ # Test capabilites
257
+ if $has_capabilities
258
+ capabilitiesvalidate = JSON::Validator.fully_validate(capabilityschema.to_json, productfile, :errors_as_objects => true)
259
+ if capabilitiesvalidate.count > 0
260
+ returnarray[:error] = true
261
+ returnarray[:errormessage] = "The product to check did not meet the requirements"
262
+ capabilitiesvalidate.each do |valerror|
263
+ returnarray[:capabilitieserrors][valerror[:fragment]] = [] unless returnarray[:capabilitieserrors].has_key? valerror[:fragment]
264
+ begin
265
+ scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema[\\s\\S]*)$").captures
266
+ rescue
267
+ keep = valerror[:message]
268
+ end
269
+ returnarray[:capabilitieserrors][valerror[:fragment]] << keep
270
+ end
271
+ end
272
+ end
273
+ end
274
+
275
+ return returnarray
276
+
277
+ end
278
+ end
@@ -0,0 +1,3 @@
1
+ module Circuitdata
2
+ VERSION = '0.2.4'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :circuitdata do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: circuitdata
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
+ platform: ruby
6
+ authors:
7
+ - Andreas Lydersen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json-schema
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.8'
27
+ description: This gem allows you to do basic test and comparison of JSON files agains
28
+ the CircuitData JSON schema
29
+ email:
30
+ - andreas.lydersen@ntty.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - lib/circuitdata.rb
38
+ - lib/circuitdata/version.rb
39
+ - lib/tasks/circuitdata_tasks.rake
40
+ homepage: http://circuitdata.org
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '2.3'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 2.6.8
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: This gem allows you to do basic test and comparison of JSON files agains
64
+ the CircuitData JSON schema
65
+ test_files: []