circuitdata 0.3.2 → 0.3.4
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 +4 -4
- data/lib/circuitdata.rb +31 -8
- data/lib/circuitdata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de1c4f538c68286e354093ef876042e3cc143d2f
|
4
|
+
data.tar.gz: f70c19817d410e8315a355e20ac957a3bc2f55e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4de909b65a9d98b88b200b812edb5b61a921766f2f3b7198bcf332c82fcf953d4bd8734d029542a778525c31595ced1c7f6bb5dc248fc6e27726a7f1b468bade
|
7
|
+
data.tar.gz: aa828cbea7219133c8e20c72d9a54f2afdeaa44f21b61a3c27c15477c02485a5ec9c3a6482a1e08219a58ddf059ec25553ffaa57eea213a116dc82c280cdb08b
|
data/lib/circuitdata.rb
CHANGED
@@ -2,7 +2,7 @@ module Circuitdata
|
|
2
2
|
|
3
3
|
|
4
4
|
def self.content(checksjson)
|
5
|
-
|
5
|
+
number_of_products = 0
|
6
6
|
stackup = false
|
7
7
|
profile_defaults = false
|
8
8
|
profile_enforced = false
|
@@ -11,7 +11,7 @@ module Circuitdata
|
|
11
11
|
if checksjson.has_key? "open_trade_transfer_package"
|
12
12
|
if checksjson["open_trade_transfer_package"].has_key? "products"
|
13
13
|
if checksjson["open_trade_transfer_package"]["products"].length > 0
|
14
|
-
|
14
|
+
number_of_products = checksjson["open_trade_transfer_package"]["products"].length
|
15
15
|
checksjson["open_trade_transfer_package"]["products"].each do |key, value|
|
16
16
|
if checksjson["open_trade_transfer_package"]["products"][key].has_key? "stackup"
|
17
17
|
if checksjson["open_trade_transfer_package"]["products"][key]["stackup"].has_key? "specification_level"
|
@@ -50,7 +50,7 @@ module Circuitdata
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
return
|
53
|
+
return number_of_products, stackup, profile_defaults, profile_restricted, profile_enforced, capabilities
|
54
54
|
end
|
55
55
|
|
56
56
|
def self.read_json(content)
|
@@ -63,7 +63,7 @@ module Circuitdata
|
|
63
63
|
returncontent = nil
|
64
64
|
if content.is_a? Hash
|
65
65
|
begin
|
66
|
-
returncontent =
|
66
|
+
returncontent = content.to_json
|
67
67
|
rescue
|
68
68
|
error = true
|
69
69
|
message = "Could not convert the Hash into JSON"
|
@@ -114,7 +114,30 @@ module Circuitdata
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
return error, message, validationserrors
|
117
|
+
end
|
117
118
|
|
119
|
+
def self.compare_files(list)
|
120
|
+
# Will presume that the files are validated
|
121
|
+
# Prepare the return
|
122
|
+
ra = {
|
123
|
+
error: false,
|
124
|
+
errormessage: "",
|
125
|
+
summary: {},
|
126
|
+
conflicts: {},
|
127
|
+
files: []
|
128
|
+
}
|
129
|
+
if not list.is_a? Array
|
130
|
+
ra[:error] = true
|
131
|
+
ra[:errormessage] = "You have to feed this function with a list of files or hashes"
|
132
|
+
return ra
|
133
|
+
end
|
134
|
+
list.each do |totest|
|
135
|
+
error, message, returncontent = self.read_json(totest)
|
136
|
+
#puts returncontent
|
137
|
+
ra[:summary] = ra[:summary].merge(returncontent)
|
138
|
+
ra[:files] << totest
|
139
|
+
end
|
140
|
+
return ra
|
118
141
|
end
|
119
142
|
|
120
143
|
def self.compatibility_checker( productfile, checksfile=nil, validate_origins=true )
|
@@ -135,7 +158,7 @@ module Circuitdata
|
|
135
158
|
capabilitieserrors: {},
|
136
159
|
contains: {
|
137
160
|
file1: {
|
138
|
-
|
161
|
+
products: 0,
|
139
162
|
stackup: false,
|
140
163
|
profile_defaults: false,
|
141
164
|
profile_enforced: false,
|
@@ -143,7 +166,7 @@ module Circuitdata
|
|
143
166
|
capabilities: false
|
144
167
|
},
|
145
168
|
file2: {
|
146
|
-
|
169
|
+
products: 0,
|
147
170
|
stackup: false,
|
148
171
|
profile_defaults: false,
|
149
172
|
profile_enforced: false,
|
@@ -173,9 +196,9 @@ module Circuitdata
|
|
173
196
|
end
|
174
197
|
|
175
198
|
# Check against the content
|
176
|
-
returnarray[:contains][:file1][:
|
199
|
+
returnarray[:contains][:file1][:products], returnarray[:contains][:file1][:stackup], returnarray[:contains][:file1][:profile_defaults], returnarray[:contains][:file1][:profile_restricted], returnarray[:contains][:file1][:profile_enforced], returnarray[:contains][:file1][:capabilities] = self.content(json_productfile)
|
177
200
|
if not checksfile.nil?
|
178
|
-
returnarray[:contains][:file2][:
|
201
|
+
returnarray[:contains][:file2][:products], returnarray[:contains][:file2][:stackup], returnarray[:contains][:file2][:profile_defaults], returnarray[:contains][:file2][:profile_restricted], returnarray[:contains][:file2][:profile_enforced], returnarray[:contains][:file2][:capabilities] = self.content(json_checksfile)
|
179
202
|
end
|
180
203
|
|
181
204
|
if not checksfile.nil?
|
data/lib/circuitdata/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circuitdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Lydersen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|