bcl 0.5.4 → 0.5.5
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/bcl/component.rb +34 -34
- data/lib/bcl/component_from_spreadsheet.rb +7 -7
- data/lib/bcl/component_methods.rb +29 -21
- data/lib/bcl/component_spreadsheet.rb +8 -8
- data/lib/bcl/core_ext.rb +7 -7
- data/lib/bcl/master_taxonomy.rb +15 -15
- data/lib/bcl/tar_ball.rb +3 -3
- data/lib/bcl/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c879a3a43c8b31973a5432fda978ef90aade0139
|
4
|
+
data.tar.gz: 2e7889e68d19f79576462a527e039a791dfa552a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f1c26d8815663a569edac566e0ffb939a0c683decdd279e8df597b3cf612e9a09e61c01c7efa6b70660ff84dcfc650f3eb451dd22bf3d5f274d141d89b1a76
|
7
|
+
data.tar.gz: 34903fceacea4d40817c4880e290820e158191db0d03e7b0811025abcd319c29f624e7ecd0a8e9b9840b16494a09438db10c1708d063200670660a14d5982047
|
data/lib/bcl/component.rb
CHANGED
@@ -60,10 +60,10 @@ module BCL
|
|
60
60
|
|
61
61
|
@path = save_path
|
62
62
|
|
63
|
-
#
|
63
|
+
# TODO: validate against master taxonomy
|
64
64
|
end
|
65
65
|
|
66
|
-
# TODO This isn't implemented at the moment
|
66
|
+
# TODO: This isn't implemented at the moment
|
67
67
|
def open_component_xml(filename)
|
68
68
|
read_component_xml(filename)
|
69
69
|
end
|
@@ -219,7 +219,7 @@ module BCL
|
|
219
219
|
|
220
220
|
at = newcomp.componentData.componentDataAttributes
|
221
221
|
@attributes.each do |attrib|
|
222
|
-
if (attrib.value.to_s != '')
|
222
|
+
if (attrib.value.to_s != '') && (attrib.name.to_s != '')
|
223
223
|
if attrib.units != ''
|
224
224
|
at.addAttribute(tc(attrib.name), attrib.value, attrib.units)
|
225
225
|
else
|
@@ -232,7 +232,7 @@ module BCL
|
|
232
232
|
comp_tag = ''
|
233
233
|
@tags.each do |tag|
|
234
234
|
tg.addTag(tc(tag.descriptor))
|
235
|
-
if (tag.descriptor != 'energyplus')
|
235
|
+
if (tag.descriptor != 'energyplus') && (tag.descriptor != 'construction')
|
236
236
|
# create a map of component tags to directories
|
237
237
|
comp_tag = tag.descriptor
|
238
238
|
if comp_tag == 'interior wall'
|
@@ -284,7 +284,7 @@ module BCL
|
|
284
284
|
# setup the xml file
|
285
285
|
comp_xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
|
286
286
|
comp_xml.component('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
287
|
-
'xsi:noNamespaceSchemaLocation' => "#{@schema_url}")
|
287
|
+
'xsi:noNamespaceSchemaLocation' => "#{@schema_url}") do
|
288
288
|
comp_xml.name @name
|
289
289
|
comp_xml.uid @uuid
|
290
290
|
comp_xml.version_id @vuid
|
@@ -294,57 +294,57 @@ module BCL
|
|
294
294
|
|
295
295
|
# comp_xml.fidelity_level @fidelity_level if @fidelity_level != ""
|
296
296
|
|
297
|
-
comp_xml.provenances
|
297
|
+
comp_xml.provenances do
|
298
298
|
@provenances.each do |prov|
|
299
|
-
comp_xml.provenance
|
299
|
+
comp_xml.provenance do
|
300
300
|
comp_xml.author prov.author
|
301
301
|
comp_xml.datetime prov.datetime
|
302
302
|
comp_xml.comment prov.comment
|
303
|
-
|
303
|
+
end
|
304
304
|
end
|
305
|
-
|
305
|
+
end
|
306
306
|
|
307
|
-
comp_xml.tags
|
307
|
+
comp_xml.tags do
|
308
308
|
@tags.each do |tag|
|
309
309
|
comp_xml.tag tag.descriptor
|
310
310
|
end
|
311
|
-
|
311
|
+
end
|
312
312
|
|
313
|
-
comp_xml.attributes
|
313
|
+
comp_xml.attributes do
|
314
314
|
@attributes.each do |attrib|
|
315
|
-
if (attrib.value.to_s != '')
|
316
|
-
comp_xml.attribute
|
315
|
+
if (attrib.value.to_s != '') && (attrib.name.to_s != '')
|
316
|
+
comp_xml.attribute do
|
317
317
|
comp_xml.name attrib.name
|
318
318
|
comp_xml.value attrib.value
|
319
319
|
comp_xml.datatype attrib.datatype
|
320
320
|
comp_xml.units attrib.units if attrib.units != ''
|
321
|
-
|
321
|
+
end
|
322
322
|
end
|
323
323
|
end
|
324
|
-
|
324
|
+
end
|
325
325
|
|
326
|
-
comp_xml.source
|
326
|
+
comp_xml.source do
|
327
327
|
comp_xml.manufacturer @source_manufacturer if @source_manufacturer != ''
|
328
328
|
comp_xml.model @source_model if @source_model != ''
|
329
329
|
comp_xml.serial_no @source_serial_no if @source_serial_no != ''
|
330
330
|
comp_xml.year @source_year if @source_year != ''
|
331
331
|
comp_xml.url @source_url if @source_url != ''
|
332
|
-
|
332
|
+
end
|
333
333
|
|
334
334
|
unless @files.nil?
|
335
|
-
comp_xml.files
|
335
|
+
comp_xml.files do
|
336
336
|
@files.each do |file|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
337
|
+
comp_xml.file do
|
338
|
+
comp_xml.version do
|
339
|
+
comp_xml.software_program file.version_software_program
|
340
|
+
comp_xml.identifier file.version_id
|
341
|
+
end
|
342
|
+
|
343
|
+
comp_xml.filename file.filename
|
344
|
+
comp_xml.filetype file.filetype
|
345
|
+
end
|
346
|
+
end
|
346
347
|
end
|
347
|
-
}
|
348
348
|
end
|
349
349
|
|
350
350
|
# check if we should write out costs, don't write if all values are 0 or nil
|
@@ -360,9 +360,9 @@ module BCL
|
|
360
360
|
# end
|
361
361
|
|
362
362
|
if write_costs
|
363
|
-
comp_xml.costs
|
363
|
+
comp_xml.costs do
|
364
364
|
@costs.each do |cost|
|
365
|
-
comp_xml.cost
|
365
|
+
comp_xml.cost do
|
366
366
|
comp_xml.instance_name cost.cost_name
|
367
367
|
comp_xml.cost_type cost.cost_type
|
368
368
|
comp_xml.category cost.category
|
@@ -375,12 +375,12 @@ module BCL
|
|
375
375
|
comp_xml.source cost.source if cost.source != ''
|
376
376
|
comp_xml.reference_component_name cost.reference_component_name if cost.reference_component_name != ''
|
377
377
|
comp_xml.reference_component_id cost.reference_component_id if cost.reference_component_id != ''
|
378
|
-
|
378
|
+
end
|
379
379
|
end
|
380
|
-
|
380
|
+
end
|
381
381
|
end
|
382
382
|
|
383
|
-
|
383
|
+
end
|
384
384
|
|
385
385
|
xmlfile.close
|
386
386
|
end
|
@@ -124,7 +124,7 @@ module BCL
|
|
124
124
|
filetype = values.delete_at(0)
|
125
125
|
filepath = values.delete_at(0)
|
126
126
|
# not all components(rows) have all files; skip if filename "" or nil
|
127
|
-
next if filename == ''
|
127
|
+
next if filename == '' || filename.nil?
|
128
128
|
# skip the file if it doesn't exist at the specified location
|
129
129
|
unless File.exist?(filepath)
|
130
130
|
puts "[ComponentFromSpreadsheet] ERROR #{filepath} -> File does not exist, will not be included in component xml"
|
@@ -159,9 +159,9 @@ module BCL
|
|
159
159
|
num_rows = xlsx_data.size
|
160
160
|
# puts "Number of Rows: #{xlsx_data.size}"
|
161
161
|
num_rows = 2
|
162
|
-
|
162
|
+
loop do
|
163
163
|
test = xlsx_data[num_rows][0]
|
164
|
-
if test.nil?
|
164
|
+
if test.nil? || test.empty?
|
165
165
|
# num_rows -= 1
|
166
166
|
break
|
167
167
|
end
|
@@ -177,7 +177,7 @@ module BCL
|
|
177
177
|
value1 = xlsx_data[0][index]
|
178
178
|
value2 = xlsx_data[1][index]
|
179
179
|
|
180
|
-
if
|
180
|
+
if !value1.nil? && !value1.empty?
|
181
181
|
unless header.nil?
|
182
182
|
headers << header
|
183
183
|
end
|
@@ -186,13 +186,13 @@ module BCL
|
|
186
186
|
header.children = []
|
187
187
|
end
|
188
188
|
|
189
|
-
if
|
189
|
+
if !value2.nil? && !value2.empty?
|
190
190
|
unless header.nil?
|
191
191
|
header.children << value2
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
if (value1.nil?
|
195
|
+
if (value1.nil? || value1.empty?) && (value2.nil? || value2.empty?)
|
196
196
|
break
|
197
197
|
end
|
198
198
|
|
@@ -219,7 +219,7 @@ module BCL
|
|
219
219
|
|
220
220
|
# get uid, if empty set it
|
221
221
|
component.uid = xlsx_data[i][1]
|
222
|
-
if component.uid.nil?
|
222
|
+
if component.uid.nil? || component.uid.empty?
|
223
223
|
component.uid = UUID.new.generate
|
224
224
|
puts "#{component.name} uid missing; creating new one"
|
225
225
|
xlsx_worksheet.add_cell(i, 1, component.uid)
|
@@ -58,7 +58,7 @@ module BCL
|
|
58
58
|
username = @config[:server][:user][:username]
|
59
59
|
password = @config[:server][:user][:password]
|
60
60
|
@group_id = group_id || @config[:server][:user][:group]
|
61
|
-
puts "logging in using credentials in .bcl/config.yml: Connecting to #{url} on port #{port} as #{username}"
|
61
|
+
puts "logging in using credentials in .bcl/config.yml: Connecting to #{url} on port #{port} as #{username} with group #{@group_id}"
|
62
62
|
else
|
63
63
|
@group_id = group_id
|
64
64
|
puts "logging in using credentials in function arguments: Connecting to #{url} on port #{port} as #{username} with group #{@group_id}"
|
@@ -74,7 +74,7 @@ module BCL
|
|
74
74
|
@http.use_ssl = true
|
75
75
|
end
|
76
76
|
|
77
|
-
data = %
|
77
|
+
data = %({"username":"#{username}","password":"#{password}"})
|
78
78
|
# data = {"username" => username, "password" => password}
|
79
79
|
|
80
80
|
login_path = '/api/user/login.json'
|
@@ -158,9 +158,12 @@ module BCL
|
|
158
158
|
puts "retrieving measures that match search_term: #{search_term.nil? ? 'nil' : search_term} and filters: #{filter_term.nil? ? 'nil' : filter_term}"
|
159
159
|
measures = []
|
160
160
|
retrieve_measures(search_term, filter_term, return_all_pages) do |m|
|
161
|
-
|
162
|
-
|
163
|
-
|
161
|
+
begin
|
162
|
+
r = parse_measure_metadata(m)
|
163
|
+
measures << r if r
|
164
|
+
rescue => e
|
165
|
+
puts "[ERROR] Parsing measure #{e.message}:#{e.backtrace.join("\n")}"
|
166
|
+
end
|
164
167
|
end
|
165
168
|
|
166
169
|
measures
|
@@ -275,7 +278,7 @@ module BCL
|
|
275
278
|
measure_hash[:version_id] = doc.xpath('/measure/version_id').first.content
|
276
279
|
measure_hash[:modeler_description] = doc.xpath('/measure/modeler_description').first.content
|
277
280
|
measure_hash[:description] = doc.xpath('/measure/description').first.content
|
278
|
-
measure_hash[:tags] = doc.xpath('/measure/tags/tag').map
|
281
|
+
measure_hash[:tags] = doc.xpath('/measure/tags/tag').map(&:content)
|
279
282
|
f.close
|
280
283
|
end
|
281
284
|
|
@@ -344,17 +347,22 @@ module BCL
|
|
344
347
|
measure_filename = "#{temp_dir_name}/measure.rb"
|
345
348
|
measure_hash = parse_measure_file(measure[:measure][:name], measure_filename)
|
346
349
|
|
347
|
-
|
350
|
+
if measure_hash.empty?
|
351
|
+
puts 'Measure Hash was empty... moving on'
|
352
|
+
else
|
353
|
+
#puts measure_hash.inspect
|
348
354
|
m_result = measure_hash
|
349
355
|
# move the directory to the class name
|
350
356
|
new_dir_name = File.join(@parsed_measures_path, measure_hash[:classname])
|
351
|
-
|
352
|
-
|
353
|
-
|
357
|
+
#puts "Moving #{temp_dir_name} to #{new_dir_name}"
|
358
|
+
if temp_dir_name == new_dir_name
|
359
|
+
puts "Destination directory is the same as the processed directory"
|
360
|
+
else
|
361
|
+
FileUtils.rm_rf(new_dir_name) if File.exist?(new_dir_name) && temp_dir_name != measure_hash[:classname]
|
362
|
+
FileUtils.move(temp_dir_name, new_dir_name) unless temp_dir_name == measure_hash[:classname]
|
363
|
+
end
|
354
364
|
# create a new measure.json file for parsing later if need be
|
355
365
|
File.open(File.join(new_dir_name, 'measure.json'), 'w') { |f| f << MultiJson.dump(measure_hash, pretty: true) }
|
356
|
-
else
|
357
|
-
puts 'Measure Hash was empty... moving on'
|
358
366
|
end
|
359
367
|
else
|
360
368
|
puts "Problems downloading #{measure[:measure][:name]}... moving on"
|
@@ -479,7 +487,7 @@ module BCL
|
|
479
487
|
# TODO remove special characters in the filename; they create firewall errors
|
480
488
|
# filename = filename.gsub(/\W/,'_').gsub(/___/,'_').gsub(/__/,'_').chomp('_').strip
|
481
489
|
|
482
|
-
file_b64 = Base64.encode64(File.
|
490
|
+
file_b64 = Base64.encode64(File.binread(filepath))
|
483
491
|
|
484
492
|
data = {}
|
485
493
|
data['file'] = {
|
@@ -663,22 +671,22 @@ module BCL
|
|
663
671
|
full_url = '/api/search/'
|
664
672
|
|
665
673
|
# add search term
|
666
|
-
if !search_str.nil?
|
667
|
-
full_url
|
674
|
+
if !search_str.nil? && search_str != ''
|
675
|
+
full_url += search_str
|
668
676
|
# strip out xml in case it's included. make sure .json is included
|
669
677
|
full_url = full_url.gsub('.xml', '')
|
670
678
|
unless search_str.include? '.json'
|
671
|
-
full_url
|
679
|
+
full_url += '.json'
|
672
680
|
end
|
673
681
|
else
|
674
|
-
full_url
|
682
|
+
full_url += '*.json'
|
675
683
|
end
|
676
684
|
|
677
685
|
# add api_version
|
678
686
|
if @api_version < 2.0
|
679
687
|
puts "WARNING: attempting to use search with api_version #{@api_version}. Use API v2.0 for this functionality."
|
680
688
|
end
|
681
|
-
full_url
|
689
|
+
full_url += "?api_version=#{@api_version}"
|
682
690
|
|
683
691
|
# add filters
|
684
692
|
unless filter_str.nil?
|
@@ -702,7 +710,7 @@ module BCL
|
|
702
710
|
if filter_str.include? 'show_rows='
|
703
711
|
full_url = full_url.gsub(/show_rows=\d{1,}/, 'show_rows=200')
|
704
712
|
else
|
705
|
-
full_url
|
713
|
+
full_url += '&show_rows=200'
|
706
714
|
end
|
707
715
|
# make sure filter_str doesn't already have a page=x
|
708
716
|
full_url.gsub(/page=\d{1,}/, '')
|
@@ -752,12 +760,12 @@ module BCL
|
|
752
760
|
|
753
761
|
def download_component(uid)
|
754
762
|
result = @http.get("/api/component/download?uids=#{uid}")
|
755
|
-
puts "
|
763
|
+
puts "Downloading: http://#{@http.address}/api/component/download?uids=#{uid}"
|
756
764
|
# puts "RESULTS: #{result.inspect}"
|
757
765
|
# puts "RESULTS BODY: #{result.body}"
|
758
766
|
# look at response code
|
759
767
|
if result.code == '200'
|
760
|
-
puts 'Download Successful'
|
768
|
+
#puts 'Download Successful'
|
761
769
|
result.body ? result.body : nil
|
762
770
|
else
|
763
771
|
puts "Download fail. Error code #{result.code}"
|
@@ -172,7 +172,7 @@ module BCL
|
|
172
172
|
filetype = values.delete_at(0)
|
173
173
|
filepath = values.delete_at(0)
|
174
174
|
# not all components(rows) have all files; skip if filename "" or nil
|
175
|
-
next if filename == ''
|
175
|
+
next if filename == '' || filename.nil?
|
176
176
|
# skip the file if it doesn't exist at the specified location
|
177
177
|
unless File.exist?(filepath)
|
178
178
|
puts "[ComponentSpreadsheet] ERROR #{filepath} -> File does not exist, will not be included in component xml"
|
@@ -208,9 +208,9 @@ module BCL
|
|
208
208
|
|
209
209
|
# find number of rows, first column should be name, should not be empty
|
210
210
|
num_rows = 1
|
211
|
-
|
211
|
+
loop do
|
212
212
|
test = xlsx_worksheet.Range("A#{num_rows}").Value
|
213
|
-
if test.nil?
|
213
|
+
if test.nil? || test.empty?
|
214
214
|
num_rows -= 1
|
215
215
|
break
|
216
216
|
end
|
@@ -225,7 +225,7 @@ module BCL
|
|
225
225
|
value1 = col.Rows('1').Value
|
226
226
|
value2 = col.Rows('2').Value
|
227
227
|
|
228
|
-
if
|
228
|
+
if !value1.nil? && !value1.empty?
|
229
229
|
unless header.nil?
|
230
230
|
headers << header
|
231
231
|
end
|
@@ -234,13 +234,13 @@ module BCL
|
|
234
234
|
header.children = []
|
235
235
|
end
|
236
236
|
|
237
|
-
if
|
237
|
+
if !value2.nil? && !value2.empty?
|
238
238
|
unless header.nil?
|
239
239
|
header.children << value2
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
-
if (value1.nil?
|
243
|
+
if (value1.nil? || value1.empty?) && (value2.nil? || value2.empty?)
|
244
244
|
break
|
245
245
|
end
|
246
246
|
|
@@ -268,7 +268,7 @@ module BCL
|
|
268
268
|
|
269
269
|
# get uid, if empty set it
|
270
270
|
component.uid = xlsx_worksheet.Range("B#{i}").value
|
271
|
-
if component.uid.nil?
|
271
|
+
if component.uid.nil? || component.uid.empty?
|
272
272
|
component.uid = UUID.new.generate
|
273
273
|
puts "#{component.name} uid missing; creating new one"
|
274
274
|
xlsx_worksheet.Range("B#{i}").value = component.uid
|
@@ -276,7 +276,7 @@ module BCL
|
|
276
276
|
|
277
277
|
# get version_id, if empty set it
|
278
278
|
component.version_id = xlsx_worksheet.Range("C#{i}").value
|
279
|
-
if component.version_id.nil?
|
279
|
+
if component.version_id.nil? || component.version_id.empty?
|
280
280
|
component.version_id = UUID.new.generate
|
281
281
|
puts "#{component.name} version id missing; creating new one"
|
282
282
|
xlsx_worksheet.Range("C#{i}").value = component.version_id
|
data/lib/bcl/core_ext.rb
CHANGED
@@ -19,18 +19,18 @@
|
|
19
19
|
|
20
20
|
class String
|
21
21
|
def to_underscore
|
22
|
-
gsub(/::/, '/')
|
23
|
-
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
24
|
-
gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
25
|
-
tr('-', '_')
|
26
|
-
downcase
|
22
|
+
gsub(/::/, '/')
|
23
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
24
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
25
|
+
.tr('-', '_')
|
26
|
+
.downcase
|
27
27
|
end
|
28
28
|
|
29
29
|
# simple method to create titles -- very custom to catch known inflections
|
30
30
|
def titleize
|
31
31
|
arr = %w(a an the by to)
|
32
32
|
upcase_arr = %w(DX EDA AEDG LPD COP)
|
33
|
-
r = gsub('_', ' ').gsub(/\w+/)
|
33
|
+
r = gsub('_', ' ').gsub(/\w+/) do |match|
|
34
34
|
match_result = match
|
35
35
|
if upcase_arr.include?(match.upcase)
|
36
36
|
match_result = upcase_arr[upcase_arr.index(match.upcase)]
|
@@ -40,7 +40,7 @@ class String
|
|
40
40
|
match_result = match.capitalize
|
41
41
|
end
|
42
42
|
match_result
|
43
|
-
|
43
|
+
end
|
44
44
|
|
45
45
|
r
|
46
46
|
end
|
data/lib/bcl/master_taxonomy.rb
CHANGED
@@ -111,9 +111,9 @@ module BCL
|
|
111
111
|
|
112
112
|
# setup the xml file
|
113
113
|
xml.instruct!(:xml, version: '1.0', encoding: 'UTF-8')
|
114
|
-
xml.schema('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance')
|
114
|
+
xml.schema('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') do
|
115
115
|
write_tag_to_xml(root_tag, 0, xml, output_type)
|
116
|
-
|
116
|
+
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -167,7 +167,7 @@ module BCL
|
|
167
167
|
|
168
168
|
terms = get_terms(tag)
|
169
169
|
|
170
|
-
#
|
170
|
+
# TODO: check for all required attributes
|
171
171
|
terms.each do |_term|
|
172
172
|
# if term.required
|
173
173
|
# make sure we find attribute
|
@@ -191,7 +191,7 @@ module BCL
|
|
191
191
|
next
|
192
192
|
end
|
193
193
|
|
194
|
-
#
|
194
|
+
# TODO: validate value, datatype, units
|
195
195
|
|
196
196
|
end
|
197
197
|
|
@@ -223,7 +223,7 @@ module BCL
|
|
223
223
|
|
224
224
|
# find number of rows by parsing until hit empty value in first column
|
225
225
|
row_num = 3
|
226
|
-
|
226
|
+
loop do
|
227
227
|
term = parse_term(terms_worksheet, row_num)
|
228
228
|
if term.nil?
|
229
229
|
break
|
@@ -331,7 +331,7 @@ module BCL
|
|
331
331
|
term.tp_additional_data_user_info = terms_worksheet.Columns(33).Rows(row).Value
|
332
332
|
|
333
333
|
# trigger to quit parsing the xcel doc
|
334
|
-
if term.first_level.nil?
|
334
|
+
if term.first_level.nil? || term.first_level.empty?
|
335
335
|
return nil
|
336
336
|
end
|
337
337
|
|
@@ -348,7 +348,7 @@ module BCL
|
|
348
348
|
tag = create_tag(level_hierarchy, term.description)
|
349
349
|
end
|
350
350
|
|
351
|
-
if term.name.nil?
|
351
|
+
if term.name.nil? || term.name.strip.empty?
|
352
352
|
# this row is really about the tag
|
353
353
|
tag.description = term.description
|
354
354
|
|
@@ -399,7 +399,7 @@ module BCL
|
|
399
399
|
end
|
400
400
|
|
401
401
|
def check_tag(tag)
|
402
|
-
if tag.description.nil?
|
402
|
+
if tag.description.nil? || tag.description.empty?
|
403
403
|
puts "[check_tag] tag '#{tag.level_hierarchy}' has no description"
|
404
404
|
end
|
405
405
|
|
@@ -454,7 +454,7 @@ module BCL
|
|
454
454
|
end
|
455
455
|
|
456
456
|
def check_term(term)
|
457
|
-
if term.description.nil?
|
457
|
+
if term.description.nil? || term.description.empty?
|
458
458
|
# puts "[check_term] term '#{term.level_hierarchy}.#{term.name}' has no description"
|
459
459
|
end
|
460
460
|
end
|
@@ -464,7 +464,7 @@ module BCL
|
|
464
464
|
terms = get_terms(tag)
|
465
465
|
if terms.size > 0
|
466
466
|
terms.each do |term|
|
467
|
-
xml.term
|
467
|
+
xml.term do
|
468
468
|
xml.name term.name
|
469
469
|
xml.abbr term.abbr unless term.abbr.nil?
|
470
470
|
xml.description term.description unless term.description.nil?
|
@@ -472,13 +472,13 @@ module BCL
|
|
472
472
|
xml.allow_multiple term.allow_multiple unless term.allow_multiple.nil?
|
473
473
|
|
474
474
|
if !term.enums.nil? && term.enums != ''
|
475
|
-
xml.enumerations
|
475
|
+
xml.enumerations do
|
476
476
|
out = term.enums.split('|')
|
477
477
|
out.sort! if @sort_alphabetical
|
478
478
|
out.each do |enum|
|
479
479
|
xml.enumeration enum
|
480
480
|
end
|
481
|
-
|
481
|
+
end
|
482
482
|
end
|
483
483
|
xml.ip_written term.ip_written unless term.ip_written.nil?
|
484
484
|
xml.ip_symbol term.ip_symbol unless term.ip_symbol.nil?
|
@@ -503,7 +503,7 @@ module BCL
|
|
503
503
|
xml.tp_additional_data_user_info term.tp_additional_data_user_info unless term.tp_additional_data_user_info.nil?
|
504
504
|
xml.tp_additional_data_submitter_info term.tp_additional_data_submitter_info unless term.tp_additional_data_submitter_info.nil?
|
505
505
|
end
|
506
|
-
|
506
|
+
end
|
507
507
|
end
|
508
508
|
end
|
509
509
|
end
|
@@ -511,7 +511,7 @@ module BCL
|
|
511
511
|
# write a tag to xml
|
512
512
|
def write_tag_to_xml(tag, level, xml, output_type)
|
513
513
|
level_string = "level_#{level}"
|
514
|
-
xml.tag!(level_string)
|
514
|
+
xml.tag!(level_string) do
|
515
515
|
s_temp = tag.name
|
516
516
|
xml.name s_temp
|
517
517
|
xml.description tag.description
|
@@ -527,7 +527,7 @@ module BCL
|
|
527
527
|
write_tag_to_xml(child_tag, level, xml, output_type)
|
528
528
|
end
|
529
529
|
|
530
|
-
|
530
|
+
end
|
531
531
|
end
|
532
532
|
end
|
533
533
|
end # module BCL
|
data/lib/bcl/tar_ball.rb
CHANGED
data/lib/bcl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Macumber
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: uuid
|
@@ -173,14 +173,14 @@ dependencies:
|
|
173
173
|
requirements:
|
174
174
|
- - ~>
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
176
|
+
version: 10.3.2
|
177
177
|
type: :development
|
178
178
|
prerelease: false
|
179
179
|
version_requirements: !ruby/object:Gem::Requirement
|
180
180
|
requirements:
|
181
181
|
- - ~>
|
182
182
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
183
|
+
version: 10.3.2
|
184
184
|
- !ruby/object:Gem::Dependency
|
185
185
|
name: rspec
|
186
186
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,14 +201,14 @@ dependencies:
|
|
201
201
|
requirements:
|
202
202
|
- - ~>
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: 0.
|
204
|
+
version: 0.26.1
|
205
205
|
type: :development
|
206
206
|
prerelease: false
|
207
207
|
version_requirements: !ruby/object:Gem::Requirement
|
208
208
|
requirements:
|
209
209
|
- - ~>
|
210
210
|
- !ruby/object:Gem::Version
|
211
|
-
version: 0.
|
211
|
+
version: 0.26.1
|
212
212
|
- !ruby/object:Gem::Dependency
|
213
213
|
name: rubocop-checkstyle_formatter
|
214
214
|
requirement: !ruby/object:Gem::Requirement
|