zip-container 2.2.0 → 4.0.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.
Files changed (49) hide show
  1. checksums.yaml +5 -13
  2. data/Changes.rdoc +22 -0
  3. data/Gemfile +1 -1
  4. data/Licence.rdoc +1 -1
  5. data/Rakefile +15 -12
  6. data/ReadMe.rdoc +20 -8
  7. data/examples/create-zip-container +7 -8
  8. data/examples/zip-container-info +4 -4
  9. data/lib/zip-container/container.rb +49 -23
  10. data/lib/zip-container/dir.rb +8 -11
  11. data/lib/zip-container/entries/directory.rb +15 -11
  12. data/lib/zip-container/entries/entry.rb +38 -29
  13. data/lib/zip-container/entries/file.rb +19 -15
  14. data/lib/zip-container/entries/managed.rb +28 -16
  15. data/lib/zip-container/entries/reserved.rb +2 -2
  16. data/lib/zip-container/exceptions.rb +20 -13
  17. data/lib/zip-container/file.rb +16 -16
  18. data/lib/zip-container/util.rb +3 -3
  19. data/lib/zip-container/version.rb +4 -3
  20. data/version.yml +3 -3
  21. data/zip-container.gemspec +31 -28
  22. metadata +54 -95
  23. data/.gitignore +0 -9
  24. data/.ruby-env +0 -1
  25. data/.ruby-gemset +0 -2
  26. data/.ruby-version +0 -2
  27. data/.travis.yml +0 -17
  28. data/test/data/compressed_mimetype.container +0 -0
  29. data/test/data/dirs/dir-mimetype/mimetype/.gitkeep +0 -1
  30. data/test/data/dirs/empty/mimetype +0 -1
  31. data/test/data/dirs/managed/dir/.gitkeep +0 -0
  32. data/test/data/dirs/managed/greeting.txt +0 -1
  33. data/test/data/dirs/managed/mimetype +0 -1
  34. data/test/data/dirs/null/.gitkeep +0 -1
  35. data/test/data/empty.container +0 -0
  36. data/test/data/empty.zip +0 -0
  37. data/test/data/example.container +0 -0
  38. data/test/data/null.file +0 -0
  39. data/test/data/subclassed.container +0 -0
  40. data/test/helpers/entry_lists.rb +0 -35
  41. data/test/tc_create_dir.rb +0 -56
  42. data/test/tc_create_file.rb +0 -140
  43. data/test/tc_exceptions.rb +0 -56
  44. data/test/tc_managed_entries.rb +0 -399
  45. data/test/tc_read_dir.rb +0 -86
  46. data/test/tc_read_file.rb +0 -109
  47. data/test/tc_reserved_names.rb +0 -334
  48. data/test/tc_util.rb +0 -67
  49. data/test/ts_container.rb +0 -59
@@ -30,7 +30,7 @@
30
30
  #
31
31
  # Author: Robert Haines
32
32
 
33
- #
33
+ ##
34
34
  module ZipContainer
35
35
 
36
36
  # Utility methods useful throughout the rest of the ZipContainer library.
@@ -46,10 +46,10 @@ module ZipContainer
46
46
  # In common with rubyzip this method also removes a trailing slash (/)
47
47
  # from a name if it can.
48
48
  def entry_name(entry)
49
- name = entry.kind_of?(::Zip::Entry) ? entry.name : entry
49
+ name = entry.is_a?(::Zip::Entry) ? entry.name : entry
50
50
 
51
51
  if name.respond_to?(:end_with?) && name.respond_to?(:chop!)
52
- name.chop! if name.end_with?("/")
52
+ name.chop! if name.end_with?('/')
53
53
  end
54
54
 
55
55
  name
@@ -37,10 +37,11 @@ module ZipContainer
37
37
  # Library version information.
38
38
  module Version
39
39
  # Version information in a Hash
40
- INFO = YAML.load_file(File.join(File.dirname(__FILE__), "..", "..",
41
- "version.yml"))
40
+ INFO = YAML.load_file(
41
+ File.join(File.dirname(__FILE__), '..', '..', 'version.yml')
42
+ )
42
43
 
43
44
  # Version number as a String
44
- STRING = [:major, :minor, :patch].map {|d| INFO[d]}.compact.join('.')
45
+ STRING = %i[major minor patch].map { |d| INFO[d] }.compact.join('.')
45
46
  end
46
47
  end
data/version.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :major: 2
3
- :minor: 2
4
- :patch: 0
2
+ :major: 4
3
+ :minor: 0
4
+ :patch: 2
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013, 2014 The University of Manchester, UK.
1
+ # Copyright (c) 2013, 2014, 2018 The University of Manchester, UK.
2
2
  #
3
3
  # All rights reserved.
4
4
  #
@@ -30,35 +30,38 @@
30
30
  #
31
31
  # Author: Robert Haines
32
32
 
33
- lib = File.expand_path('../lib', __FILE__)
33
+ lib = File.expand_path('lib', __dir__)
34
34
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
35
- require "zip-container/version"
35
+ require 'zip-container/version'
36
36
 
37
37
  Gem::Specification.new do |s|
38
- s.name = "zip-container"
38
+ s.name = 'zip-container'
39
39
  s.version = ZipContainer::Version::STRING
40
- s.authors = ["Robert Haines"]
41
- s.email = ["support@mygrid.org.uk"]
42
- s.homepage = "http://mygrid.github.io/ruby-zip-container/"
43
- s.platform = Gem::Platform::RUBY
44
- s.summary = "A ZIP Container for use by OCF and UCF implementations"
45
- s.description = "A Ruby library for working with ZIP Container "\
46
- "Format files. See http://www.idpf.org/epub/30/spec/epub30-ocf.html for "\
47
- "the OCF specification and "\
48
- "https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format "\
49
- "for the UCF specification."
50
- s.license = "BSD"
51
- s.require_path = "lib"
52
- s.files = `git ls-files`.split($/)
53
- s.test_files = `git ls-files -- test/*`.split($/)
54
- s.has_rdoc = true
55
- s.extra_rdoc_files = [ "Changes.rdoc", "Licence.rdoc", "ReadMe.rdoc" ]
56
- s.rdoc_options = [ "-N", "--tab-width=2", "--main=ReadMe.rdoc" ]
57
- s.required_ruby_version = ">= 1.9.3"
58
- s.add_development_dependency "bundler", "~> 1.5"
59
- s.add_development_dependency "rake", "~> 10.1"
60
- s.add_development_dependency "rdoc", "~> 4.1"
61
- s.add_development_dependency "test-unit", "~> 3.0"
62
- s.add_development_dependency "coveralls"
63
- s.add_runtime_dependency "rubyzip", "~> 1.1.6"
40
+ s.authors = ['Robert Haines', 'Finn Bacall']
41
+ s.email = ['support@mygrid.org.uk']
42
+
43
+ s.homepage = 'http://mygrid.github.io/ruby-zip-container/'
44
+ s.summary = 'A ZIP Container for use by OCF and UCF implementations'
45
+ s.description = 'A Ruby library for working with ZIP Container '\
46
+ 'Format files. See http://www.idpf.org/epub/30/spec/epub30-ocf.html for '\
47
+ 'the OCF specification and '\
48
+ 'https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format '\
49
+ 'for the UCF specification.'
50
+ s.license = 'BSD'
51
+
52
+ s.require_path = 'lib'
53
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
54
+ f.match(%r{^((test|spec|features)/|\.)})
55
+ end
56
+
57
+ s.required_ruby_version = '>= 2.2.0'
58
+
59
+ s.add_runtime_dependency 'rubyzip', '~> 2.0.0'
60
+
61
+ s.add_development_dependency 'bundler'
62
+ s.add_development_dependency 'coveralls', '~> 0.8'
63
+ s.add_development_dependency 'rake', '~> 10.1'
64
+ s.add_development_dependency 'rdoc', '~> 4.1'
65
+ s.add_development_dependency 'rubocop', '~> 0.59'
66
+ s.add_development_dependency 'test-unit', '~> 3.0'
64
67
  end
metadata CHANGED
@@ -1,99 +1,114 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
+ - Finn Bacall
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
12
+ date: 2021-02-19 00:00:00.000000000 Z
12
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubyzip
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 2.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 2.0.0
13
28
  - !ruby/object:Gem::Dependency
14
29
  name: bundler
15
30
  requirement: !ruby/object:Gem::Requirement
16
31
  requirements:
17
- - - ~>
32
+ - - ">="
18
33
  - !ruby/object:Gem::Version
19
- version: '1.5'
34
+ version: '0'
20
35
  type: :development
21
36
  prerelease: false
22
37
  version_requirements: !ruby/object:Gem::Requirement
23
38
  requirements:
24
- - - ~>
39
+ - - ">="
25
40
  - !ruby/object:Gem::Version
26
- version: '1.5'
41
+ version: '0'
27
42
  - !ruby/object:Gem::Dependency
28
- name: rake
43
+ name: coveralls
29
44
  requirement: !ruby/object:Gem::Requirement
30
45
  requirements:
31
- - - ~>
46
+ - - "~>"
32
47
  - !ruby/object:Gem::Version
33
- version: '10.1'
48
+ version: '0.8'
34
49
  type: :development
35
50
  prerelease: false
36
51
  version_requirements: !ruby/object:Gem::Requirement
37
52
  requirements:
38
- - - ~>
53
+ - - "~>"
39
54
  - !ruby/object:Gem::Version
40
- version: '10.1'
55
+ version: '0.8'
41
56
  - !ruby/object:Gem::Dependency
42
- name: rdoc
57
+ name: rake
43
58
  requirement: !ruby/object:Gem::Requirement
44
59
  requirements:
45
- - - ~>
60
+ - - "~>"
46
61
  - !ruby/object:Gem::Version
47
- version: '4.1'
62
+ version: '10.1'
48
63
  type: :development
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
- - - ~>
67
+ - - "~>"
53
68
  - !ruby/object:Gem::Version
54
- version: '4.1'
69
+ version: '10.1'
55
70
  - !ruby/object:Gem::Dependency
56
- name: test-unit
71
+ name: rdoc
57
72
  requirement: !ruby/object:Gem::Requirement
58
73
  requirements:
59
- - - ~>
74
+ - - "~>"
60
75
  - !ruby/object:Gem::Version
61
- version: '3.0'
76
+ version: '4.1'
62
77
  type: :development
63
78
  prerelease: false
64
79
  version_requirements: !ruby/object:Gem::Requirement
65
80
  requirements:
66
- - - ~>
81
+ - - "~>"
67
82
  - !ruby/object:Gem::Version
68
- version: '3.0'
83
+ version: '4.1'
69
84
  - !ruby/object:Gem::Dependency
70
- name: coveralls
85
+ name: rubocop
71
86
  requirement: !ruby/object:Gem::Requirement
72
87
  requirements:
73
- - - ! '>='
88
+ - - "~>"
74
89
  - !ruby/object:Gem::Version
75
- version: '0'
90
+ version: '0.59'
76
91
  type: :development
77
92
  prerelease: false
78
93
  version_requirements: !ruby/object:Gem::Requirement
79
94
  requirements:
80
- - - ! '>='
95
+ - - "~>"
81
96
  - !ruby/object:Gem::Version
82
- version: '0'
97
+ version: '0.59'
83
98
  - !ruby/object:Gem::Dependency
84
- name: rubyzip
99
+ name: test-unit
85
100
  requirement: !ruby/object:Gem::Requirement
86
101
  requirements:
87
- - - ~>
102
+ - - "~>"
88
103
  - !ruby/object:Gem::Version
89
- version: 1.1.6
90
- type: :runtime
104
+ version: '3.0'
105
+ type: :development
91
106
  prerelease: false
92
107
  version_requirements: !ruby/object:Gem::Requirement
93
108
  requirements:
94
- - - ~>
109
+ - - "~>"
95
110
  - !ruby/object:Gem::Version
96
- version: 1.1.6
111
+ version: '3.0'
97
112
  description: A Ruby library for working with ZIP Container Format files. See http://www.idpf.org/epub/30/spec/epub30-ocf.html
98
113
  for the OCF specification and https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format
99
114
  for the UCF specification.
@@ -101,16 +116,8 @@ email:
101
116
  - support@mygrid.org.uk
102
117
  executables: []
103
118
  extensions: []
104
- extra_rdoc_files:
105
- - Changes.rdoc
106
- - Licence.rdoc
107
- - ReadMe.rdoc
119
+ extra_rdoc_files: []
108
120
  files:
109
- - .gitignore
110
- - .ruby-env
111
- - .ruby-gemset
112
- - .ruby-version
113
- - .travis.yml
114
121
  - Changes.rdoc
115
122
  - Gemfile
116
123
  - Licence.rdoc
@@ -131,28 +138,6 @@ files:
131
138
  - lib/zip-container/file.rb
132
139
  - lib/zip-container/util.rb
133
140
  - lib/zip-container/version.rb
134
- - test/data/compressed_mimetype.container
135
- - test/data/dirs/dir-mimetype/mimetype/.gitkeep
136
- - test/data/dirs/empty/mimetype
137
- - test/data/dirs/managed/dir/.gitkeep
138
- - test/data/dirs/managed/greeting.txt
139
- - test/data/dirs/managed/mimetype
140
- - test/data/dirs/null/.gitkeep
141
- - test/data/empty.container
142
- - test/data/empty.zip
143
- - test/data/example.container
144
- - test/data/null.file
145
- - test/data/subclassed.container
146
- - test/helpers/entry_lists.rb
147
- - test/tc_create_dir.rb
148
- - test/tc_create_file.rb
149
- - test/tc_exceptions.rb
150
- - test/tc_managed_entries.rb
151
- - test/tc_read_dir.rb
152
- - test/tc_read_file.rb
153
- - test/tc_reserved_names.rb
154
- - test/tc_util.rb
155
- - test/ts_container.rb
156
141
  - version.yml
157
142
  - zip-container.gemspec
158
143
  homepage: http://mygrid.github.io/ruby-zip-container/
@@ -160,48 +145,22 @@ licenses:
160
145
  - BSD
161
146
  metadata: {}
162
147
  post_install_message:
163
- rdoc_options:
164
- - -N
165
- - --tab-width=2
166
- - --main=ReadMe.rdoc
148
+ rdoc_options: []
167
149
  require_paths:
168
150
  - lib
169
151
  required_ruby_version: !ruby/object:Gem::Requirement
170
152
  requirements:
171
- - - ! '>='
153
+ - - ">="
172
154
  - !ruby/object:Gem::Version
173
- version: 1.9.3
155
+ version: 2.2.0
174
156
  required_rubygems_version: !ruby/object:Gem::Requirement
175
157
  requirements:
176
- - - ! '>='
158
+ - - ">="
177
159
  - !ruby/object:Gem::Version
178
160
  version: '0'
179
161
  requirements: []
180
- rubyforge_project:
181
- rubygems_version: 2.2.2
162
+ rubygems_version: 3.0.8
182
163
  signing_key:
183
164
  specification_version: 4
184
165
  summary: A ZIP Container for use by OCF and UCF implementations
185
- test_files:
186
- - test/data/compressed_mimetype.container
187
- - test/data/dirs/dir-mimetype/mimetype/.gitkeep
188
- - test/data/dirs/empty/mimetype
189
- - test/data/dirs/managed/dir/.gitkeep
190
- - test/data/dirs/managed/greeting.txt
191
- - test/data/dirs/managed/mimetype
192
- - test/data/dirs/null/.gitkeep
193
- - test/data/empty.container
194
- - test/data/empty.zip
195
- - test/data/example.container
196
- - test/data/null.file
197
- - test/data/subclassed.container
198
- - test/helpers/entry_lists.rb
199
- - test/tc_create_dir.rb
200
- - test/tc_create_file.rb
201
- - test/tc_exceptions.rb
202
- - test/tc_managed_entries.rb
203
- - test/tc_read_dir.rb
204
- - test/tc_read_file.rb
205
- - test/tc_reserved_names.rb
206
- - test/tc_util.rb
207
- - test/ts_container.rb
166
+ test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- pkg/
2
- html/
3
- coverage/
4
- .buildpath
5
- .project
6
- .idea
7
- .rvmrc
8
- Gemfile.lock
9
- example.zip
data/.ruby-env DELETED
@@ -1 +0,0 @@
1
- RUBYLIB=./lib:../lib
data/.ruby-gemset DELETED
@@ -1,2 +0,0 @@
1
- zip-container
2
-
data/.ruby-version DELETED
@@ -1,2 +0,0 @@
1
- ruby-1.9.3
2
-
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.5
7
- - ruby-head
8
- - rbx-2
9
-
10
- sudo: false
11
-
12
- cache: bundler
13
-
14
- matrix:
15
- allow_failures:
16
- - rvm: ruby-head
17
- - rvm: rbx-2
@@ -1 +0,0 @@
1
- This "mimetype" directory needs to be preserved by git.
@@ -1 +0,0 @@
1
- application/epub+zip
File without changes
@@ -1 +0,0 @@
1
- Hello, World!
@@ -1 +0,0 @@
1
- application/epub+zip
@@ -1 +0,0 @@
1
- This dir should be "empty", which in this case just means no "mimetype" file.
Binary file
data/test/data/empty.zip DELETED
Binary file
Binary file
data/test/data/null.file DELETED
File without changes
Binary file
@@ -1,35 +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
- def entry_list_names(entries)
34
- entries.map { |entry| entry.name }
35
- end