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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8724ff5c75a67cdf1ee25bf8d4d56fc7cd53a0e
4
- data.tar.gz: 5374354ed564f33acd76d2ec2dc9c70df7615b4f
3
+ metadata.gz: c722d677313d0c1212c654764e69496766c3afe3
4
+ data.tar.gz: ff759d59645c447bf16a7201a8f2b4ae973850c0
5
5
  SHA512:
6
- metadata.gz: e8368602779f984cbdd08e724f521c1239f36a2832868b38e24970bb721963b019199f41ea875189c4d12e424afadf26032832250ca7048e07971a422a3447b1
7
- data.tar.gz: 0980b9365a3c2435ac6762436b124f312d337ef6778a7ad3aa52226534460e21420fdfb83acd94ee1d25f64992f962355f88afadc2158f3db4465d5694319382
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
- # 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)
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 check agains (profile or capability)"
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
- scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
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
- scrap, keep, scrap2 = valerror[:message].match("^(The\\sproperty\\s\\'[\\s\\S]*\\'\\s)([\\s\\S]*)(\\sin\\sschema\\sfile[\\s\\S]*)$").captures
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
@@ -1,3 +1,3 @@
1
1
  module Circuitdata
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuitdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Lydersen