Works, but needs test to verify
This commit is contained in:
parent
33429e3f0b
commit
be21697f7c
|
@ -226,7 +226,6 @@ module Pigeon
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
full_path = File.join(dir, file_name)
|
full_path = File.join(dir, file_name)
|
||||||
raise "HERE!" if dir.include?(".")
|
|
||||||
unless File.file?(full_path)
|
unless File.file?(full_path)
|
||||||
FileUtils.makedirs(dir)
|
FileUtils.makedirs(dir)
|
||||||
File.write(full_path, data)
|
File.write(full_path, data)
|
||||||
|
|
|
@ -136,14 +136,8 @@ module Pigeon
|
||||||
.flatten
|
.flatten
|
||||||
.uniq
|
.uniq
|
||||||
.map do |mhash|
|
.map do |mhash|
|
||||||
hash2filepath = Helpers.hash2file_path(mhash)
|
|
||||||
blob_path = File.join(file_path, hash2filepath)
|
|
||||||
blob = get_blob(mhash)
|
blob = get_blob(mhash)
|
||||||
puts "=== EXPORT"
|
Helpers.write_to_disk(file_path, mhash, blob)
|
||||||
puts " blob_path: #{blob_path}"
|
|
||||||
puts " mhash: #{mhash}"
|
|
||||||
puts " blob: #{blob.length} bytes"
|
|
||||||
Helpers.write_to_disk(blob_path, mhash, blob)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render messages for all peers.
|
# Render messages for all peers.
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
c.gif
|
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
|
@ -1 +0,0 @@
|
||||||
a.gif
|
|
|
@ -1 +0,0 @@
|
||||||
b.gif
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -47,13 +47,8 @@ RSpec.describe Pigeon::Message do
|
||||||
|
|
||||||
it "ingests a bundle's blobs" do
|
it "ingests a bundle's blobs" do
|
||||||
db.reset_database
|
db.reset_database
|
||||||
db.add_message(db.add_blob(File.read("a.gif")), {
|
|
||||||
db.add_blob(File.read("b.gif")) => db.add_blob(File.read("c.gif")),
|
|
||||||
})
|
|
||||||
db.export_bundle("./spec/fixtures/has_blobs")
|
|
||||||
warn("The directory structure is not correct.")
|
|
||||||
exit(1)
|
|
||||||
db.import_bundle("./spec/fixtures/has_blobs")
|
db.import_bundle("./spec/fixtures/has_blobs")
|
||||||
expect(db.all_messages.count).to eq(0)
|
expect(db.all_messages.count).to eq(1)
|
||||||
|
warn("TODO: Write better tests")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue