zip-container 3.0.2 → 4.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.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +1 -1
  3. data/Licence.rdoc +1 -1
  4. data/Rakefile +15 -12
  5. data/examples/create-zip-container +7 -8
  6. data/examples/zip-container-info +4 -4
  7. data/lib/zip-container/container.rb +5 -7
  8. data/lib/zip-container/dir.rb +8 -11
  9. data/lib/zip-container/entries/directory.rb +5 -5
  10. data/lib/zip-container/entries/entry.rb +19 -15
  11. data/lib/zip-container/entries/file.rb +10 -9
  12. data/lib/zip-container/entries/managed.rb +11 -11
  13. data/lib/zip-container/entries/reserved.rb +2 -2
  14. data/lib/zip-container/exceptions.rb +4 -2
  15. data/lib/zip-container/file.rb +16 -16
  16. data/lib/zip-container/util.rb +3 -3
  17. data/lib/zip-container/version.rb +4 -3
  18. data/version.yml +2 -2
  19. data/zip-container.gemspec +30 -27
  20. metadata +41 -83
  21. data/.gitignore +0 -9
  22. data/.ruby-env +0 -1
  23. data/.ruby-gemset +0 -1
  24. data/.ruby-version +0 -1
  25. data/.travis.yml +0 -19
  26. data/test/data/compressed_mimetype.container +0 -0
  27. data/test/data/dirs/dir-mimetype/mimetype/.gitkeep +0 -1
  28. data/test/data/dirs/empty/mimetype +0 -1
  29. data/test/data/dirs/managed/dir/.gitkeep +0 -0
  30. data/test/data/dirs/managed/greeting.txt +0 -1
  31. data/test/data/dirs/managed/mimetype +0 -1
  32. data/test/data/dirs/null/.gitkeep +0 -1
  33. data/test/data/empty.container +0 -0
  34. data/test/data/empty.zip +0 -0
  35. data/test/data/example.container +0 -0
  36. data/test/data/null.file +0 -0
  37. data/test/data/subclassed.container +0 -0
  38. data/test/helpers/entry_lists.rb +0 -35
  39. data/test/tc_create_dir.rb +0 -56
  40. data/test/tc_create_file.rb +0 -140
  41. data/test/tc_exceptions.rb +0 -105
  42. data/test/tc_managed_entries.rb +0 -446
  43. data/test/tc_read_dir.rb +0 -90
  44. data/test/tc_read_file.rb +0 -118
  45. data/test/tc_reserved_names.rb +0 -334
  46. data/test/tc_util.rb +0 -67
  47. data/test/ts_container.rb +0 -59
@@ -1,67 +0,0 @@
1
- # Copyright (c) 2014 The University of Manchester, UK.
2
- #
3
- # All rights reserved.
4
- #
5
- # Redistribution and use in source and binary forms, with or without
6
- # modification, are permitted provided that the following conditions are met:
7
- #
8
- # * Redistributions of source code must retain the above copyright notice,
9
- # this list of conditions and the following disclaimer.
10
- #
11
- # * Redistributions in binary form must reproduce the above copyright notice,
12
- # this list of conditions and the following disclaimer in the documentation
13
- # and/or other materials provided with the distribution.
14
- #
15
- # * Neither the names of The University of Manchester nor the names of its
16
- # contributors may be used to endorse or promote products derived from this
17
- # software without specific prior written permission.
18
- #
19
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- # POSSIBILITY OF SUCH DAMAGE.
30
- #
31
- # Author: Robert Haines
32
-
33
- require 'test/unit'
34
- require 'zip-container'
35
-
36
- class Util
37
- include ZipContainer::Util
38
- end
39
-
40
- class TestUtil < Test::Unit::TestCase
41
-
42
- def setup
43
- @util = Util.new
44
- end
45
-
46
- def test_entry_name_strings
47
- assert_equal("test", @util.entry_name("test"))
48
- assert_equal("test", @util.entry_name("test/"))
49
- assert_equal("test/test", @util.entry_name("test/test"))
50
- assert_equal("test/test", @util.entry_name("test/test/"))
51
- end
52
-
53
- def test_entry_name_entries
54
- assert_equal("test", @util.entry_name(Zip::Entry.new("fake.zip", "test")))
55
- assert_equal("test", @util.entry_name(Zip::Entry.new("fake.zip", "test/")))
56
- assert_equal("test/test",
57
- @util.entry_name(Zip::Entry.new("fake.zip", "test/test")))
58
- assert_equal("test/test",
59
- @util.entry_name(Zip::Entry.new("fake.zip", "test/test/")))
60
- end
61
-
62
- def test_entry_name_odd_things
63
- uri = URI.parse("http://www.example.com/path")
64
- assert_equal(uri, @util.entry_name(uri))
65
- end
66
-
67
- end
@@ -1,59 +0,0 @@
1
- # Copyright (c) 2013, 2014 The University of Manchester, UK.
2
- #
3
- # All rights reserved.
4
- #
5
- # Redistribution and use in source and binary forms, with or without
6
- # modification, are permitted provided that the following conditions are met:
7
- #
8
- # * Redistributions of source code must retain the above copyright notice,
9
- # this list of conditions and the following disclaimer.
10
- #
11
- # * Redistributions in binary form must reproduce the above copyright notice,
12
- # this list of conditions and the following disclaimer in the documentation
13
- # and/or other materials provided with the distribution.
14
- #
15
- # * Neither the names of The University of Manchester nor the names of its
16
- # contributors may be used to endorse or promote products derived from this
17
- # software without specific prior written permission.
18
- #
19
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- # POSSIBILITY OF SUCH DAMAGE.
30
- #
31
- # Author: Robert Haines
32
-
33
- require 'coveralls'
34
- Coveralls.wear!
35
-
36
- # Example default mimetype
37
- $mimetype = "application/epub+zip"
38
-
39
- # Example data files
40
- $dir_null = "test/data/dirs/null"
41
- $dir_empty = "test/data/dirs/empty"
42
- $dir_dir_mimetype = "test/data/dirs/dir-mimetype"
43
- $dir_managed = "test/data/dirs/managed"
44
- $file_null = "test/data/null.file"
45
- $empty = "test/data/empty.container"
46
- $empty_zip = "test/data/empty.zip"
47
- $compressed_mimetype = "test/data/compressed_mimetype.container"
48
- $example = "test/data/example.container"
49
- $subclass = "test/data/subclassed.container"
50
-
51
- # Run test cases.
52
- require 'tc_util'
53
- require 'tc_exceptions'
54
- require 'tc_create_dir'
55
- require 'tc_create_file'
56
- require 'tc_read_dir'
57
- require 'tc_read_file'
58
- require 'tc_reserved_names'
59
- require 'tc_managed_entries'