obf 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8a99d902b0dc9ed0a272dc723729cb754cf94ca
4
- data.tar.gz: 0b5daf60c141328401c47b0fc57e940ee4da743b
3
+ metadata.gz: 773dcd3bad2bae05af92f6a172d41bebea6bdb81
4
+ data.tar.gz: a0ccff48eb6478df5123caa27d187dd61ad00296
5
5
  SHA512:
6
- metadata.gz: a87fc4b8e6632f2ed4921c9824a8feae1d59f40c749080293d122e09941edd7a53c007e185f0205bd149cdf21a0c00a01c71e30602af55b3c94d956a4ba48d80
7
- data.tar.gz: 70f62b9f1c68d0377c445bdb875ec45309b5cb3e2136e5d75de1553969f002591805503ba4b47ce5f515097b94246a86650f5ebd04c1e0fd036cecf26b43f12f
6
+ metadata.gz: 1d998d66615468c0f56b5f6f4f7e40c539023d9e5c27cf8fd018a8e304557a874a8e2d605d74141811031de9fd0e0c8333a4755545c6ea2fa337df48189fb4ea
7
+ data.tar.gz: 0ca7cd8428debc173961460a10979e5f252e1c4dd173e2c6db4168ab612710d4d723fa33726042c6c6b76a6ac8c161664c323d3f2480c81a4a70eba9fe539f4a
data/lib/obf/external.rb CHANGED
@@ -280,6 +280,8 @@ module OBF::External
280
280
  def self.to_obz(content, dest_path, opts)
281
281
  paths = {}
282
282
  boards = content['boards']
283
+ content['images'] ||= boards.map{|b| b['images'] }.flatten.uniq
284
+ content['sounds'] ||= boards.map{|b| b['sounds'] }.flatten.uniq
283
285
  root_board = boards[0]
284
286
  OBF::Utils.build_zip(dest_path) do |zipper|
285
287
  paths['zip'] = zipper
@@ -315,8 +317,8 @@ module OBF::External
315
317
  boards = []
316
318
  images = []
317
319
  sounds = []
318
- obf_opts = {'zipper' => zipper, 'images' => {}, 'sounds' => {}, 'boards' => {}}
319
320
  OBF::Utils.load_zip(obz_path) do |zipper|
321
+ obf_opts = {'zipper' => zipper, 'images' => {}, 'sounds' => {}, 'boards' => {}}
320
322
  manifest = JSON.parse(zipper.read('manifest.json'))
321
323
  root = manifest['root']
322
324
  board = OBF::Utils.parse_obf(zipper.read(root))
@@ -354,7 +356,7 @@ module OBF::External
354
356
  # TODO: try to fix the problem where multiple images or sounds have the same id --
355
357
  # this involves reaching in and updating image and sound references on generated boards..
356
358
  return {
357
- 'boards' => result,
359
+ 'boards' => boards,
358
360
  'images' => images,
359
361
  'sounds' => sounds
360
362
  }
data/lib/obf/obz.rb CHANGED
@@ -3,8 +3,8 @@ module OBF::OBZ
3
3
  OBF::External.from_obz(obz, opts)
4
4
  end
5
5
 
6
- def self.from_external(board, dest_path, opts)
7
- OBF::External.to_obz(board, dest_path, opts)
6
+ def self.from_external(content, dest_path, opts)
7
+ OBF::External.to_obz(content, dest_path, opts)
8
8
  end
9
9
 
10
10
  def self.to_pdf(obz, dest_path)
data/lib/obf/pdf.rb CHANGED
@@ -183,9 +183,13 @@ module OBF::PDF
183
183
  return dest_path
184
184
  end
185
185
 
186
- def self.from_external(board, dest_path, full_set=false)
186
+ def self.from_external(content, dest_path)
187
187
  tmp_path = OBF::Utils.temp_path("stash")
188
- from_obz(OBF::OBZ.from_external(board, full_set, tmp_path), dest_path)
188
+ if content['boards']
189
+ from_obz(OBF::OBZ.from_external(content, tmp_path), dest_path)
190
+ else
191
+ from_obf(OBF::OBF.from_external(content, tmp_path), dest_path)
192
+ end
189
193
  File.unlink(tmp_path) if File.exist?(tmp_path)
190
194
  dest_path
191
195
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer