circuitdata 0.2.4 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/circuitdata.rb +21 -11
- data/lib/circuitdata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c722d677313d0c1212c654764e69496766c3afe3
|
4
|
+
data.tar.gz: ff759d59645c447bf16a7201a8f2b4ae973850c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aaf62b7010faa06a2dad0972d429d84672e4c72527cdeb6f79ee79b0aa5c0aed6b44ed4e535f3dc6d1fdf940f575a1ffa9642df67e2ba4d6456fdcb24fb7d3a
|
7
|
+
data.tar.gz: 5c496657b8e001bab99a5b9918b44e4dd95cdc8972fd6f926827ffe2c43473e3df1d7886f7403f5ef4d744353f9e178a81fdf4485bd8d4f3e56ea24e22b066b1
|
data/lib/circuitdata.rb
CHANGED
@@ -16,18 +16,20 @@ module Circuitdata
|
|
16
16
|
capabilitieserrors: {},
|
17
17
|
}
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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)
|
19
|
+
unless productfile.is_a? Hash
|
20
|
+
# Check to see if the URIs are correct on the received files
|
21
|
+
if not File.exist?(productfile)
|
27
22
|
returnarray[:error] = true
|
28
|
-
returnarray[:errormessage] = "Could not access the file to
|
23
|
+
returnarray[:errormessage] = "Could not access the file to test"
|
29
24
|
return returnarray
|
30
25
|
end
|
26
|
+
if not checksfile.nil?
|
27
|
+
if not File.exist?(checksfile)
|
28
|
+
returnarray[:error] = true
|
29
|
+
returnarray[:errormessage] = "Could not access the file to check agains (profile or capability)"
|
30
|
+
return returnarray
|
31
|
+
end
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
# Validate the original files against the CircuitData schema
|
@@ -38,7 +40,11 @@ module Circuitdata
|
|
38
40
|
returnarray[:errormessage] = "Could not validate the product file against the CircuitData json schema"
|
39
41
|
prod.each do |valerror|
|
40
42
|
returnarray[:validationserrors][valerror[:fragment]] = [] unless returnarray[:validationserrors].has_key? valerror[:fragment]
|
41
|
-
|
43
|
+
begin
|
44
|
+
scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
|
45
|
+
rescue
|
46
|
+
keep = valerror[:message]
|
47
|
+
end
|
42
48
|
returnarray[:validationserrors][valerror[:fragment]] << keep
|
43
49
|
end
|
44
50
|
end
|
@@ -49,7 +55,11 @@ module Circuitdata
|
|
49
55
|
returnarray[:errormessage] = "Could not validate the file to check agains (profile or capability) against the CircuitData json schema"
|
50
56
|
checks.each do |valerror|
|
51
57
|
returnarray[:validationserrors][valerror[:fragment]] = [] unless returnarray[:validationserrors].has_key? valerror[:fragment]
|
52
|
-
|
58
|
+
begin
|
59
|
+
scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
|
60
|
+
rescue
|
61
|
+
keep = valerror[:message]
|
62
|
+
end
|
53
63
|
returnarray[:validationserrors][valerror[:fragment]] << keep
|
54
64
|
end
|
55
65
|
return returnarray
|
data/lib/circuitdata/version.rb
CHANGED