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 +4 -4
- data/lib/obf/external.rb +4 -2
- data/lib/obf/obz.rb +2 -2
- data/lib/obf/pdf.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 773dcd3bad2bae05af92f6a172d41bebea6bdb81
|
4
|
+
data.tar.gz: a0ccff48eb6478df5123caa27d187dd61ad00296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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' =>
|
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(
|
7
|
-
OBF::External.to_obz(
|
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(
|
186
|
+
def self.from_external(content, dest_path)
|
187
187
|
tmp_path = OBF::Utils.temp_path("stash")
|
188
|
-
|
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
|