circuitdata 0.6.2 → 0.6.3

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: 6bda8756e4d8d9145a33cfd33d1834fad9354e12
4
- data.tar.gz: 812ecd65a520f13541b812d398686a3ed4293779
3
+ metadata.gz: 611504e3b618906c3034b1d9eea7c4e863a6e48b
4
+ data.tar.gz: 333947547beab6d85a82d1fe6ea38bbacff79915
5
5
  SHA512:
6
- metadata.gz: d80ce0e432010118d65cc2ccfe5849780fa5dc97323d20421ace594d51dc25dd3309cf712492c5e79a706293073928e94902cae029ea18d88791a000225b49c3
7
- data.tar.gz: 5f31206e9508f4cea850cd2aa371d668e1d8de53dd619d2ed6a496c23a381eb4a8e22360cec68e868b2bd6a864d8785f1a7f4add5db8302a0915f31307edfee1
6
+ metadata.gz: f1c44352aa96d8180a1d8edfe6d5357ce440be331c981866b7ec53d8d5fdd2ec07fc33301338d34c0c554c60eedfeda79c1c22018506b32f2925395390b0121b
7
+ data.tar.gz: 1d7ba1fa15a0d14f24ff9fb4e120b8f794127c0b5bdfdfc789b881ba60be08f32db73b2c19d0ec1c70724345cf6051c98f4ccbf8c940b13b3ee8a986f52011d6
@@ -113,6 +113,7 @@ module Circuitdata
113
113
  def self.create_documentation()
114
114
  docu = Tools.new()
115
115
  ra = docu.create_structure
116
+ #File.write('utils_README.md', docu.create_documentation(ra))
116
117
  docu.create_documentation(ra)
117
118
  end
118
119
 
@@ -566,7 +566,7 @@
566
566
  "required": ["name"],
567
567
  "properties": {
568
568
  "name": {
569
- "type": "string"
569
+ "$ref": "ottp_circuitdata_schema_definitions.json#/definitions/elements/dielectric/name"
570
570
  }
571
571
  },
572
572
  "aliases": "Laminate",
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "aliases": "",
44
- "name": "Soldermasks",
44
+ "descriptive_name": "Soldermasks",
45
45
  "description": "Materials used as soldermask"
46
46
  },
47
47
  "dielectrics": {
@@ -146,7 +146,7 @@
146
146
  }
147
147
  },
148
148
  "aliases": "",
149
- "name": "Dielectrics",
149
+ "descriptive_name": "Dielectrics",
150
150
  "description": "Materials used as dielectrics/laminates"
151
151
  },
152
152
  "stiffeners": {
@@ -154,7 +154,7 @@
154
154
  "additionalProperties": false,
155
155
  "required": ["name"],
156
156
  "properties": {
157
- "name": {
157
+ "descriptive_name": {
158
158
  "type": "string",
159
159
  "uom": null,
160
160
  "description": "The name of the Soldermask. Use the official name or some name as close to it as possible"
@@ -171,7 +171,7 @@
171
171
  }
172
172
  },
173
173
  "aliases": "",
174
- "name": "Stiffener",
174
+ "descriptive_name": "Stiffener",
175
175
  "uom": null,
176
176
  "description": "The materials to be used as stiffener"
177
177
  }
@@ -275,6 +275,106 @@
275
275
  "description": "The average copper coverage of the board"
276
276
  }
277
277
  },
278
+ "dielectric": {
279
+ "name": {
280
+ "type": "string",
281
+ "uom": null,
282
+ "description": "The name of the Laminate. Use the official name or some name as close to it as possible."
283
+ },
284
+ "manufacturer": {
285
+ "type": "string",
286
+ "uom": null,
287
+ "description": "The name of the manufacturer"
288
+ },
289
+ "ipc_4101_sheet": {
290
+ "type": "integer",
291
+ "uom": null,
292
+ "description": "The reference sheet number of the IPC 4101 Standard."
293
+ },
294
+ "ipc_4103_sheet": {
295
+ "type": "integer",
296
+ "uom": null,
297
+ "description": "The reference sheet number of the IPC 4103 Standard."
298
+ },
299
+ "ipc_4204_sheet": {
300
+ "type": "integer",
301
+ "uom": null,
302
+ "description": "The reference sheet number of the IPC 4204 Standard."
303
+ },
304
+ "tg_min": {
305
+ "type": "integer",
306
+ "uom": null,
307
+ "description": "The minimum Glass Transition Temperature (Tg) required."
308
+ },
309
+ "tg_range_from": {
310
+ "type": "integer",
311
+ "uom": null,
312
+ "description": "The Glass Transition Temperature (Tg) range starts at."
313
+ },
314
+ "tg_range_to": {
315
+ "type": "integer",
316
+ "uom": null,
317
+ "description": "The Glass Transition Temperature (Tg) range ands at."
318
+ },
319
+ "td_min": {
320
+ "type": "integer",
321
+ "uom": null,
322
+ "description": "The minimum required temperature at which a base laminate material experiences an established percentage of weight loss using Thermograv imetric Analysis (TGA)."
323
+ },
324
+ "td_range_from": {
325
+ "type": "integer",
326
+ "uom": null,
327
+ "description": "The Td range starts at."
328
+ },
329
+ "td_range_to": {
330
+ "type": "integer",
331
+ "uom": null,
332
+ "description": "The Td range stops at."
333
+ },
334
+ "halogen_free": {
335
+ "type": "boolean",
336
+ "uom": null,
337
+ "description": "Indicates the material is material free or is required to be"
338
+ },
339
+ "rw_en45545_2_2013": {
340
+ "type": "boolean",
341
+ "uom": null,
342
+ "description": "Railway Europe EN45545-2:2013 compatible"
343
+ },
344
+ "rw_nf_f_16_101": {
345
+ "type": "boolean",
346
+ "uom": null,
347
+ "description": "Railway France NF F 16-101 compatible"
348
+ },
349
+ "rw_uni_cei_11170_3": {
350
+ "type": "boolean",
351
+ "uom": null,
352
+ "description": "Railway Italy UNI CEI 11170-3 compatible."
353
+ },
354
+ "rw_nfpa_130": {
355
+ "type": "boolean",
356
+ "uom": null,
357
+ "description": "Railway USA NFPA 130 compatible."
358
+ },
359
+ "ul": {
360
+ "type": "boolean",
361
+ "uom": null,
362
+ "description": "UL compatible."
363
+ },
364
+ "link": {
365
+ "type": "string",
366
+ "uom": null,
367
+ "description": "The link to some url that gives more information or a reference to the product."
368
+ },
369
+ "accept_equivalent": {
370
+ "type": "boolean",
371
+ "uom": null,
372
+ "description": "Equivalent material to the one specified is OK to use as a replacement if true."
373
+ },
374
+ "aliases": "",
375
+ "descriptive_name": "Dielectrics",
376
+ "description": "Materials used as dielectrics/laminates"
377
+ },
278
378
  "final_finish": {
279
379
  "finish": {
280
380
  "type": "string",
@@ -8,24 +8,29 @@ class Circuitdata::Tools
8
8
 
9
9
  def update_ra(type, key, value)
10
10
  parsed_elements = Circuitdata.read_json(@definitions_path)[2]
11
- unless @ra[:structured].has_key? key
12
- @ra[:structured][key] = {
11
+ unless @ra[:structured][:elements].has_key? key
12
+ @ra[:structured][:elements][key] = {
13
13
  :type => value[:type],
14
14
  :elements => {},
15
15
  :name => nil,
16
16
  :description => nil,
17
17
  :aliases => nil
18
18
  }
19
- @ra[:structured][key][:name] = value[:name] if value.has_key? :name
20
- @ra[:structured][key][:description] = value[:decription] if value.has_key? :decription
19
+ @ra[:structured][:elements][key][:name] = value[:descriptive_name] if value.has_key? :descriptive_name
20
+ @ra[:structured][:elements][key][:description] = value[:description] if value.has_key? :description
21
21
  if value.has_key? :aliases
22
- @ra[:structured][key][:aliases] = value[:aliases] unless value[:aliases] == ""
22
+ @ra[:structured][:elements][key][:aliases] = value[:aliases] unless value[:aliases] == ""
23
23
  end
24
24
  end
25
- if value.has_key? :properties
26
- value[:properties].each do |skey, svalue|
27
- unless @ra[:structured][key][:elements].has_key? skey
28
- @ra[:structured][key][:elements][skey] = {
25
+ if value[:type] == "array"
26
+ subelement = value[:items]
27
+ else
28
+ subelement = value
29
+ end
30
+ if subelement.has_key? :properties
31
+ subelement[:properties].each do |skey, svalue|
32
+ unless @ra[:structured][:elements][key][:elements].has_key? skey
33
+ @ra[:structured][:elements][key][:elements][skey] = {
29
34
  :in_product_generic => false,
30
35
  :in_product_stackup => false,
31
36
  :in_profile_default => false,
@@ -38,9 +43,7 @@ class Circuitdata::Tools
38
43
  :description => nil,
39
44
  :uom => nil,
40
45
  :minimum => nil,
41
- :maximum => nil,
42
- :in_profile_restricted_regex => nil,
43
- :in_capabilities_regex => nil
46
+ :maximum => nil
44
47
  }
45
48
  if svalue.has_key? :$ref
46
49
  elements = svalue[:$ref].split('/')
@@ -58,43 +61,43 @@ class Circuitdata::Tools
58
61
  end
59
62
  unless element.nil?
60
63
  if element.has_key? :type
61
- @ra[:structured][key][:elements][skey][:type] = element[:type]
64
+ @ra[:structured][:elements][key][:elements][skey][:type] = element[:type]
62
65
  if element[:type] == "array"
63
66
  if element.has_key? :items and element[:items].has_key? :type
64
- @ra[:structured][key][:elements][skey][:arrayitems] == element[:items][:type]
67
+ @ra[:structured][:elements][key][:elements][skey][:arrayitems] == element[:items][:type]
65
68
  end
66
69
  end
67
70
  end
68
- @ra[:structured][key][:elements][skey][:enum] = element[:enum] if element.has_key? :enum
69
- @ra[:structured][key][:elements][skey][:description] = element[:description] if element.has_key? :description
70
- @ra[:structured][key][:elements][skey][:uom] = element[:uom] if element.has_key? :uom
71
- @ra[:structured][key][:elements][skey][:minimum] = element[:minimum] if element.has_key? :minimum
72
- @ra[:structured][key][:elements][skey][:maximum] = element[:maximum] if element.has_key? :maximum
71
+ @ra[:structured][:elements][key][:elements][skey][:enum] = element[:enum] if element.has_key? :enum
72
+ @ra[:structured][:elements][key][:elements][skey][:description] = element[:description] if element.has_key? :description
73
+ @ra[:structured][:elements][key][:elements][skey][:uom] = element[:uom] if element.has_key? :uom
74
+ @ra[:structured][:elements][key][:elements][skey][:minimum] = element[:minimum] if element.has_key? :minimum
75
+ @ra[:structured][:elements][key][:elements][skey][:maximum] = element[:maximum] if element.has_key? :maximum
73
76
  end
74
77
  else
75
78
  if [:in_profile_restricted, :in_capabilities].include? type
76
- case @ra[:structured][key][:elements][skey][:type]
79
+ case @ra[:structured][:elements][key][:elements][skey][:type]
77
80
  when *["number", "integer", "boolean", "string"]
78
- @ra[:structured][key][:elements][skey][:type] = "number" if @ra[:structured][key][:elements][skey][:type] == "integer"
79
- unless ( svalue.has_key? :type and svalue[:type] == "array" ) and ( svalue.has_key? :items and svalue[:items].has_key? :type and svalue[:items][:type] == @ra[:structured][key][:elements][skey][:type])
80
- (@ra[:errors][type][key] ||= {})[skey] = "Type is #{@ra[:structured][key][:elements][skey][:type]}, wrong check"
81
+ @ra[:structured][:elements][key][:elements][skey][:type] = "number" if @ra[:structured][:elements][key][:elements][skey][:type] == "integer"
82
+ unless ( svalue.has_key? :type and svalue[:type] == "array" ) and ( svalue.has_key? :items and svalue[:items].has_key? :type and svalue[:items][:type] == @ra[:structured][:elements][key][:elements][skey][:type])
83
+ (@ra[:errors][type][key] ||= {})[skey] = "Type is #{@ra[:structured][:elements][key][:elements][skey][:type]}, wrong check"
81
84
  end
82
85
  when "array"
83
86
  unless svalue.has_key? :type and svalue[:type] == "array"
84
- (@ra[:errors][type][key] ||= {})[skey] = "Type is #{@ra[:structured][key][:elements][skey][:type]}, wrong check"
87
+ (@ra[:errors][type][key] ||= {})[skey] = "Type is #{@ra[:structured][:elements][key][:elements][skey][:type]}, wrong check"
85
88
  end
86
89
  else
87
- puts "unknown type #{@ra[:structured][key][:elements][skey][:type]} in #{key}, #{skey}"
90
+ puts "unknown type #{@ra[:structured][:elements][key][:elements][skey][:type]} in #{key}, #{skey} when doing #{type}"
88
91
  end
89
92
  end
90
93
  end
91
- @ra[:structured][key][:elements][skey][type] = true
94
+ @ra[:structured][:elements][key][:elements][skey][type] = true
92
95
  end
93
96
  end
94
97
  end
95
98
 
96
99
  def create_structure
97
- @ra[:structured] = {}
100
+ @ra[:structured] = {:elements => {}, :custom => {}}
98
101
  @ra[:errors] = {:in_profile_restricted => {}, :in_capabilities => {}}
99
102
  parsed_schema = Circuitdata.read_json(@schema_path)[2]
100
103
  parsed_schema[:properties][:open_trade_transfer_package][:properties][:products][:patternProperties]["^(?!generic$).*".to_sym][:properties][:printed_circuits_fabrication_data][:properties].each do |key, value|
@@ -116,57 +119,52 @@ class Circuitdata::Tools
116
119
  parsed_schema[:properties][:open_trade_transfer_package][:properties][:capabilities][:properties][:printed_circuits_fabrication_data][:properties].each do |key, value|
117
120
  self.update_ra(:in_capabilities, key, value)
118
121
  end
119
- @ra[:structured].sort.to_h
120
- @ra[:structured].delete(:version)
122
+ @ra[:structured][:elements].sort.to_h
123
+ @ra[:structured][:elements].delete(:version)
124
+
121
125
  return @ra
122
126
  end
123
127
 
124
128
  def create_documentation(ra)
125
- ra[:documentation] = "## Elements and tags\n"
126
- ra[:structured].each do |element_key, element_value|
127
- ra[:documentation] += "[#{element_key}](##{element_key.to_s.downcase.tr(" ", "-")})\n"
129
+ ra[:documentation] = "## Elements and tags\n====================\n\n"
130
+ ra[:structured][:elements].each do |element_key, element_value|
131
+ ra[:documentation] += "### #{element_key} [link](##{element_key.to_s.downcase.tr(" ", "-")})\n"
128
132
  element_value[:elements].each do |e_key, e_value|
129
133
  ra[:documentation] += "* #{e_key}\n"
130
134
  end
131
135
  ra[:documentation] += "\n"
132
136
  end
133
- ra[:structured].each do |element_key, element_value|
137
+ ra[:structured][:elements].each do |element_key, element_value|
134
138
  ra[:documentation] += "### #{element_key}\n"
135
- ra[:documentation] += "Name: #{element_value[:name]}\n" unless element_value[:name].nil?
136
- ra[:documentation] += "Aliases: #{element_value[:aliases]}\n" unless element_value[:aliases].nil?
139
+ ra[:documentation] += "Name: #{element_value[:descriptive_name]}\n\n" unless element_value[:descriptive_name].nil?
140
+ ra[:documentation] += "Aliases: #{element_value[:aliases]}\n\n" unless element_value[:aliases].nil?
137
141
  ra[:documentation] += "#{element_value[:description]}\n" unless element_value[:description].nil?
138
142
  ra[:documentation] += "\n"
143
+ if element_value[:type] == "array"
144
+ ra[:documentation] += "**You must specify this as en array when used in a generic product description or a stackup, but as a single object when used in any of the other parts.**\n\n"
145
+ end
139
146
  element_value[:elements].each do |e_key, e_value|
140
147
  ra[:documentation] += "#### #{e_key}\n"
141
- ra[:documentation] += "Aliases: #{e_value[:aliases]}\n" unless e_value[:aliases].nil?
142
- ra[:documentation] += "#{e_value[:description]}\n" unless e_value[:description].nil?
143
- ra[:documentation] += "Unit of Measure: #{e_value[:uom][0]}\n" unless e_value[:uom].nil?
144
- unless e_value[:type].nil?
145
- if e_value[:type] == "array"
146
- if e_value[:arrayitems].nil?
147
- ra[:documentation] += "Type: #{e_value[:type].capitalize} of unknown type\n"
148
- else
149
- ra[:documentation] += "Type: #{e_value[:type].capitalize} of #{e_value[:arrayitems].capitalize}\n"
150
- end
151
- else
152
- ra[:documentation] += "Type: #{e_value[:type].capitalize}\n"
153
- end
154
- end
148
+ ra[:documentation] += "Aliases: #{e_value[:aliases]}\n\n" unless e_value[:aliases].nil?
149
+ ra[:documentation] += "#{e_value[:description]}\n\n" unless e_value[:description].nil?
150
+ ra[:documentation] += "Unit of Measure: #{e_value[:uom][0]}\n\n" unless e_value[:uom].nil?
155
151
  if e_value.has_key? :enum and not e_value[:enum].nil?
156
152
  ra[:documentation] += "Use one of these values:\n"
157
153
  e_value[:enum].each do |ev|
158
154
  ra[:documentation] += "* #{ev}\n"
159
155
  end
156
+ ra[:documentation] += "\n"
157
+ end
158
+ ra[:documentation] += "| | Generic product | Stackup | Profile defaults | Profile enforced | Profile restricted | Capabilities |\n"
159
+ ra[:documentation] += "|-:|:---------------:|:-------:|:----------------:|:----------------:|:------------------:|:------------:|\n| **Use in:** | "
160
+ [e_value[:in_product_generic], e_value[:in_product_stackup], e_value[:in_profile_default], e_value[:in_profile_enforced], e_value[:in_profile_restricted], e_value[:in_capabilities]].each do |part|
161
+ part.nil? ? ra[:documentation] += "Disallowed | " : ra[:documentation] += "Allowed | "
162
+ end
163
+ ra[:documentation] += "\n|**Format:** | #{e_value[:type]} | #{e_value[:type]} | #{e_value[:type]} | #{e_value[:type]} | Array of #{e_value[:type]}s | Array of #{e_value[:type]}s |\n"
164
+ if e_value[:enum].nil? and e_value[:type] == "number"
165
+ ra[:documentation] += "|**Min value:** | #{e_value[:minimum]} | #{e_value[:minimum]} | #{e_value[:minimum]} | #{e_value[:minimum]} | Each item: #{e_value[:minimum]} | Each item: #{e_value[:minimum]} |\n" unless e_value[:minimum].nil?
166
+ ra[:documentation] += "|**Max value:** | #{e_value[:maximum]} | #{e_value[:maximum]} | #{e_value[:maximum]} | #{e_value[:maximum]} | Each item : #{e_value[:maximum]} | Each item: #{e_value[:maximum]} |\n" unless e_value[:maximum].nil?
160
167
  end
161
- ra[:documentation] += "Use in:\n"
162
- e_value[:in_product_generic] ? ra[:documentation] += "* *Generic product section: Allowed*\n" : ra[:documentation] += "* *Generic product section: Disallowed*\n"
163
- e_value[:in_product_stackup] ? ra[:documentation] += "* *Stackup product section: Allowed*\n" : ra[:documentation] += "* *Gtackup product section: Disallowed*\n"
164
- e_value[:in_profile_default] ? ra[:documentation] += "* *Profile defaults section: Allowed*\n" : ra[:documentation] += "* *Profile defaults section: Disallowed*\n"
165
- e_value[:in_profile_enforced] ? ra[:documentation] += "* *Profile enforced section: Allowed*\n" : ra[:documentation] += "* *Profile enforced section: Disallowed*\n"
166
- e_value[:in_profile_restricted] ? ra[:documentation] += "* *Profile restricted section: Allowed*\n" : ra[:documentation] += "* *Profile restricted section: Disallowed*\n"
167
- ra[:documentation] += "* - Value in restricted section must match regex #{e_value[:in_profile_restricted_regex]}\n" unless e_value[:in_profile_restricted_regex].nil?
168
- e_value[:in_capabilities] ? ra[:documentation] += "* *Capabilites section: Allowed*\n" : ra[:documentation] += "* *Capabilities section: Disallowed*\n"
169
- ra[:documentation] += "* - Value in capabilites section must match regex #{e_value[:in_capabilities_regex]}\n" unless e_value[:in_capabilities_regex].nil?
170
168
  ra[:documentation] += "\n"
171
169
  end
172
170
  end
@@ -1,3 +1,3 @@
1
1
  module Circuitdata
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.3'
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.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Lydersen