bcl 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,8 +77,13 @@ if $have_win32ole
77
77
  end
78
78
  end
79
79
 
80
- xlsx.saved = true
81
- xlsx.Save
80
+ #save spreadsheet if changes have been made
81
+ if xlsx.saved == true
82
+ #puts "[ComponentSpreadsheet] Spreadsheet unchanged; not saving"
83
+ else
84
+ xlsx.Save
85
+ puts "[ComponentSpreadsheet] Spreadsheet changes saved"
86
+ end
82
87
 
83
88
  ensure
84
89
 
@@ -277,12 +282,17 @@ end # if $have_win32ole
277
282
  component.uid = xlsx_worksheet.Range("B#{i}").value
278
283
  if component.uid.nil? or component.uid.empty?
279
284
  component.uid = UUID.new.generate
285
+ puts "#{component.name} uid missing; creating new one"
280
286
  xlsx_worksheet.Range("B#{i}").value = component.uid
281
287
  end
282
288
 
283
- # always write new version id
284
- component.version_id = UUID.new.generate
285
- xlsx_worksheet.Range("C#{i}").value = component.version_id
289
+ # get version_id, if empty set it
290
+ component.version_id = xlsx_worksheet.Range("C#{i}").value
291
+ if component.version_id.nil? or component.version_id.empty?
292
+ component.version_id = UUID.new.generate
293
+ puts "#{component.name} version id missing; creating new one"
294
+ xlsx_worksheet.Range("C#{i}").value = component.version_id
295
+ end
286
296
 
287
297
  component.headers = headers
288
298
  component.values = xlsx_worksheet.Range("A#{i}:#{max_col}#{i}").value
@@ -261,10 +261,21 @@ module BCL
261
261
 
262
262
  def save_component_xml(dir_path = resolve_path)
263
263
  FileUtils.mkpath(dir_path) if !File.exists?(dir_path)
264
-
265
- generate_uuid() if @uuid.nil?
266
- generate_vuid() if @vuid.nil?
267
-
264
+
265
+ #make sure the uid and vid are pulled in from the Component
266
+ @uuid = @uid
267
+ @vuid = @comp_version_id
268
+
269
+ if @uuid.nil?
270
+ puts "uid was missing; creating a new one"
271
+ generate_uuid()
272
+ end
273
+
274
+ if @vuid.nil?
275
+ puts "vid was missing; creating a new one"
276
+ generate_vuid()
277
+ end
278
+
268
279
  xmlfile = File.new(dir_path + '/component.xml', 'w')
269
280
  comp_xml = Builder::XmlMarkup.new(:target => xmlfile, :indent=>2)
270
281
 
data/lib/bcl/version.rb CHANGED
@@ -18,5 +18,5 @@
18
18
  ######################################################################
19
19
 
20
20
  module BCL
21
- VERSION = "0.3.2"
21
+ VERSION = "0.3.3"
22
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Macumber
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-09-27 00:00:00 Z
21
+ date: 2013-10-01 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: uuid