zip-container 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Changes.rdoc +4 -0
- data/lib/zip-container/entries/directory.rb +1 -1
- data/test/tc_managed_entries.rb +53 -6
- data/version.yml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTBkMWFlOWRkMDIxOGJmZGZkYzhkNjI4YjJhZjBmOWUwNGU5Nzk4MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTYxOWZhZmIxNzFiZjM4Zjg4NDAyZWU2MzJhNGJkODBmMjI5OTA2NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTkwN2NkZGY1NDliMWUwNzM3NzQ1M2FiYjc0NDU3NDUxOTQ2YzY2YzQ5ZDI0
|
10
|
+
OTU0MmU1OTNiYTRjNDk1NDhiNWJkNWVlODEzOGFkMjg5NGRhZGZhM2IwZWZm
|
11
|
+
NThhMzJhZTU4ZjMxNWYyYWUxZWExMDhiYzEzMmU5NDc3NzkyODg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGQ2MGZkNDkyNzFhNTdmNDMzMDAwYjcxOTI4MjMzZTE1MmY3ZTU5MTY0Mzll
|
14
|
+
OTk2OWJjMmI2ZGJjZGFjMjMxNjRiYzE3MmIxOTQ0Yjk1M2VkYmViZDc0MDQz
|
15
|
+
YzQ4YWUzZTE2YTcxN2RhMzZiZDAwZTJkMmVlMTg2NGYxZmZjODA=
|
data/Changes.rdoc
CHANGED
data/test/tc_managed_entries.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013
|
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
|
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
|
data/version.yml
CHANGED
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.
|
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
|
11
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|