zip-container 3.0.0 → 3.0.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmQ3NGUzNmM1NmRlMDE4ZmRjY2NlODQyYTc4Zjc5NDRjYWI3NGJmOA==
4
+ ZTBkMWFlOWRkMDIxOGJmZGZkYzhkNjI4YjJhZjBmOWUwNGU5Nzk4MQ==
5
5
  data.tar.gz: !binary |-
6
- MTAwMjhkMjZhOTRhZjAwNThhMDg5OTM0ZjE4MmQyNGNjNjJlYzdmYQ==
6
+ OTYxOWZhZmIxNzFiZjM4Zjg4NDAyZWU2MzJhNGJkODBmMjI5OTA2NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NThkZjFkYzkyMThkYjg3OGY5YThiYzBjNmU4YTRkYjY0M2MwYzg0NmEwYjdj
10
- MTEzMDY0NTY1YmYyNmY3Nzk2YmUwNzcyNDAxMWUyMjUzZDZlMDQ0ZmFlNDVm
11
- MDI0Zjc1ZTAxMWUzZTE5NWI0Y2YwNjc2MDBlYjljNjExZDllZTk=
9
+ NTkwN2NkZGY1NDliMWUwNzM3NzQ1M2FiYjc0NDU3NDUxOTQ2YzY2YzQ5ZDI0
10
+ OTU0MmU1OTNiYTRjNDk1NDhiNWJkNWVlODEzOGFkMjg5NGRhZGZhM2IwZWZm
11
+ NThhMzJhZTU4ZjMxNWYyYWUxZWExMDhiYzEzMmU5NDc3NzkyODg=
12
12
  data.tar.gz: !binary |-
13
- Yzk0OTM5NDY2NzViYjJjZjlhNDk1NGRjNDE2OGU5MzM5ZjMzMTM0NDY1ZDFj
14
- M2FmNmQ5ZmI2MWZhODM2ZGYwMTFkOGQzNTdjNzNiYjU3YjY4NDlmYjBiMmUx
15
- YWZkZDI4ZjYzZmRiNTk0M2M5NTA1N2U4NGQ4NjBhODcxZTQ0NTE=
13
+ NGQ2MGZkNDkyNzFhNTdmNDMzMDAwYjcxOTI4MjMzZTE1MmY3ZTU5MTY0Mzll
14
+ OTk2OWJjMmI2ZGJjZGFjMjMxNjRiYzE3MmIxOTQ0Yjk1M2VkYmViZDc0MDQz
15
+ YzQ4YWUzZTE2YTcxN2RhMzZiZDAwZTJkMmVlMTg2NGYxZmZjODA=
@@ -1,5 +1,9 @@
1
1
  = Changes log for the ZIP Container Ruby Gem
2
2
 
3
+ == Version 3.0.1
4
+
5
+ * Fix deep content verification bug.
6
+
3
7
  == Version 3.0.0
4
8
 
5
9
  * Refactor the malformed container error constructor.
@@ -76,7 +76,7 @@ module ZipContainer
76
76
  def verify
77
77
  messages = super
78
78
 
79
- @files.values.each { |f| messages + f.verify }
79
+ @files.values.each { |f| messages += f.verify }
80
80
 
81
81
  messages
82
82
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013, 2014 The University of Manchester, UK.
1
+ # Copyright (c) 2013-2015 The University of Manchester, UK.
2
2
  #
3
3
  # All rights reserved.
4
4
  #
@@ -77,6 +77,11 @@ class ExampleZipContainer2 < ZipContainer::File
77
77
  valid = Proc.new { |contents| contents.match(/[Hh]ello/) }
78
78
  register_managed_entry(ZipContainer::ManagedFile.new("greeting.txt",
79
79
  :required => true, :validation_proc => valid))
80
+
81
+ deep_greet = ZipContainer::ManagedFile.new("greet.txt",
82
+ :validation_proc => valid)
83
+ register_managed_entry(ZipContainer::ManagedDirectory.new("dir",
84
+ :entries => [deep_greet]))
80
85
  end
81
86
 
82
87
  def ExampleZipContainer2.create(filename, &block)
@@ -101,10 +106,6 @@ class ExampleDirContainer < ZipContainer::Dir
101
106
  :required => true, :validation_proc => valid))
102
107
  end
103
108
 
104
- #def ExampleDirContainer.create(filename, &block)
105
- # super(filename, "application/example+zip", &block)
106
- #end
107
-
108
109
  end
109
110
 
110
111
  class TestManagedEntries < Test::Unit::TestCase
@@ -359,7 +360,7 @@ class TestManagedEntries < Test::Unit::TestCase
359
360
  end
360
361
  end
361
362
 
362
- # Check that a ExampleZipContainer2 will only verify when required objects
363
+ # Check that an ExampleZipContainer2 will only verify when required objects
363
364
  # are added with the correct contents.
364
365
  def test_create_subclassed_container_with_content_verification
365
366
  Dir.mktmpdir do |dir|
@@ -396,4 +397,50 @@ class TestManagedEntries < Test::Unit::TestCase
396
397
  end
397
398
  end
398
399
 
400
+ # Check that an ExampleZipContainer2 will verify when deep objects are added
401
+ # with the correct contents.
402
+ def test_create_subclassed_container_with_deep_content_verification
403
+ Dir.mktmpdir do |dir|
404
+ filename = File.join(dir, "test.container")
405
+
406
+ assert_nothing_raised do
407
+ ExampleZipContainer2.create(filename) do |c|
408
+ assert_raises(ZipContainer::MalformedContainerError) do
409
+ c.verify!
410
+ end
411
+
412
+ c.file.open("greeting.txt", "w") do |f|
413
+ f.puts "Hello, Y'All!"
414
+ end
415
+
416
+ assert_nothing_raised(ZipContainer::MalformedContainerError) do
417
+ c.verify!
418
+ end
419
+
420
+ c.mkdir("dir")
421
+ c.file.open("dir/greet.txt", "w") do |f|
422
+ f.puts "Goodbye!"
423
+ end
424
+
425
+ assert_raises(ZipContainer::MalformedContainerError) do
426
+ c.verify!
427
+ end
428
+
429
+ c.file.open("dir/greet.txt", "w") do |f|
430
+ f.puts "hello everyone."
431
+ end
432
+
433
+ assert_nothing_raised(ZipContainer::MalformedContainerError) do
434
+ c.verify!
435
+ end
436
+ end
437
+ end
438
+
439
+ assert(ExampleZipContainer2.verify?(filename))
440
+ assert_nothing_raised(ZipContainer::MalformedContainerError) do
441
+ ExampleZipContainer2.verify!(filename)
442
+ end
443
+ end
444
+ end
445
+
399
446
  end
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 3
3
3
  :minor: 0
4
- :patch: 0
4
+ :patch: 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler