ucf 2.0.2 → 3.0.0
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 +4 -4
- data/.github/workflows/latest-docs.yml +29 -0
- data/.github/workflows/lint.yml +19 -0
- data/.github/workflows/tests.yml +89 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +63 -0
- data/{test/tc_read_dir.rb → .simplecov} +19 -21
- data/{Changes.rdoc → CHANGES.md} +41 -14
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +67 -0
- data/Gemfile +4 -2
- data/{Licence.rdoc → LICENCE} +1 -1
- data/README.md +57 -0
- data/Rakefile +21 -18
- data/bin/console +15 -0
- data/bin/setup +6 -0
- data/examples/create-ucf +11 -10
- data/examples/ucfinfo +11 -7
- data/examples/verify-ucf +5 -3
- data/lib/ucf/dir.rb +7 -8
- data/lib/ucf/file.rb +7 -8
- data/lib/ucf/{meta-inf.rb → meta_inf.rb} +24 -23
- data/lib/ucf/version.rb +6 -13
- data/lib/ucf.rb +4 -2
- data/ucf.gemspec +46 -31
- metadata +108 -83
- data/.ruby-env +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -19
- data/ReadMe.rdoc +0 -90
- data/test/data/META-INF/container.xml +0 -13
- data/test/data/META-INF/manifest.xml +0 -26
- data/test/data/compressed_mimetype.ucf +0 -0
- data/test/data/dirs/empty/mimetype +0 -1
- data/test/data/dirs/managed/greeting.txt +0 -1
- data/test/data/dirs/managed/mimetype +0 -1
- data/test/data/dirs/null/.gitkeep +0 -1
- data/test/data/empty.ucf +0 -0
- data/test/data/empty.zip +0 -0
- data/test/data/example.ucf +0 -0
- data/test/data/null.file +0 -0
- data/test/tc_create_file.rb +0 -142
- data/test/tc_managed_entries.rb +0 -238
- data/test/tc_read_file.rb +0 -119
- data/test/tc_reserved_names.rb +0 -357
- data/test/ts_ucf.rb +0 -52
- data/version.yml +0 -4
metadata
CHANGED
@@ -1,207 +1,232 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Haines
|
8
8
|
- Finn Bacall
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: minitest
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '5.25'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '5.25'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: nokogiri
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
17
31
|
requirements:
|
18
32
|
- - "~>"
|
19
33
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
34
|
+
version: 1.18.9
|
21
35
|
type: :development
|
22
36
|
prerelease: false
|
23
37
|
version_requirements: !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
39
|
- - "~>"
|
26
40
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
41
|
+
version: 1.18.9
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
43
|
+
name: rake
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
46
|
- - "~>"
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
48
|
+
version: '13.2'
|
35
49
|
type: :development
|
36
50
|
prerelease: false
|
37
51
|
version_requirements: !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - "~>"
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
55
|
+
version: '13.2'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rdoc
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - "~>"
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
62
|
+
version: '6.11'
|
49
63
|
type: :development
|
50
64
|
prerelease: false
|
51
65
|
version_requirements: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
67
|
- - "~>"
|
54
68
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
69
|
+
version: '6.11'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
71
|
+
name: rubocop
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
76
|
+
version: 1.50.0
|
63
77
|
type: :development
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
83
|
+
version: 1.50.0
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
85
|
+
name: rubocop-minitest
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
|
-
- - "
|
88
|
+
- - "~>"
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
90
|
+
version: 0.30.0
|
77
91
|
type: :development
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
|
-
- - "
|
95
|
+
- - "~>"
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
97
|
+
version: 0.30.0
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
99
|
+
name: rubocop-performance
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.17.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.17.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop-rake
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.6.0
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.6.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.22.0
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.22.0
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: simplecov-lcov
|
86
142
|
requirement: !ruby/object:Gem::Requirement
|
87
143
|
requirements:
|
88
144
|
- - "~>"
|
89
145
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
146
|
+
version: 0.8.0
|
91
147
|
type: :development
|
92
148
|
prerelease: false
|
93
149
|
version_requirements: !ruby/object:Gem::Requirement
|
94
150
|
requirements:
|
95
151
|
- - "~>"
|
96
152
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
153
|
+
version: 0.8.0
|
98
154
|
- !ruby/object:Gem::Dependency
|
99
155
|
name: zip-container
|
100
156
|
requirement: !ruby/object:Gem::Requirement
|
101
157
|
requirements:
|
102
158
|
- - "~>"
|
103
159
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
160
|
+
version: '6.0'
|
105
161
|
type: :runtime
|
106
162
|
prerelease: false
|
107
163
|
version_requirements: !ruby/object:Gem::Requirement
|
108
164
|
requirements:
|
109
165
|
- - "~>"
|
110
166
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
167
|
+
version: '6.0'
|
112
168
|
description: A Ruby library for working with Universal Container Format files - a
|
113
169
|
type of EPUB document. See the UCF specification (https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format)
|
114
170
|
for details. They are very similar, although not as restrictive, as the EPUB Open
|
115
171
|
Container Format (OCF) (http://www.idpf.org/epub/30/spec/epub30-ocf.html).
|
116
172
|
email:
|
117
|
-
-
|
173
|
+
- robert.haines@manchester.ac.uk
|
118
174
|
executables: []
|
119
175
|
extensions: []
|
120
|
-
extra_rdoc_files:
|
121
|
-
- Changes.rdoc
|
122
|
-
- Licence.rdoc
|
123
|
-
- ReadMe.rdoc
|
176
|
+
extra_rdoc_files: []
|
124
177
|
files:
|
178
|
+
- ".github/workflows/latest-docs.yml"
|
179
|
+
- ".github/workflows/lint.yml"
|
180
|
+
- ".github/workflows/tests.yml"
|
125
181
|
- ".gitignore"
|
126
|
-
- ".
|
127
|
-
- ".
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
182
|
+
- ".rubocop.yml"
|
183
|
+
- ".simplecov"
|
184
|
+
- CHANGES.md
|
185
|
+
- CODE_OF_CONDUCT.md
|
186
|
+
- CONTRIBUTING.md
|
131
187
|
- Gemfile
|
132
|
-
-
|
188
|
+
- LICENCE
|
189
|
+
- README.md
|
133
190
|
- Rakefile
|
134
|
-
-
|
191
|
+
- bin/console
|
192
|
+
- bin/setup
|
135
193
|
- examples/create-ucf
|
136
194
|
- examples/ucfinfo
|
137
195
|
- examples/verify-ucf
|
138
196
|
- lib/ucf.rb
|
139
197
|
- lib/ucf/dir.rb
|
140
198
|
- lib/ucf/file.rb
|
141
|
-
- lib/ucf/
|
199
|
+
- lib/ucf/meta_inf.rb
|
142
200
|
- lib/ucf/schema/OpenDocument-manifest-schema-v1.0-os.rng
|
143
201
|
- lib/ucf/schema/container.rng
|
144
202
|
- lib/ucf/version.rb
|
145
|
-
- test/data/META-INF/container.xml
|
146
|
-
- test/data/META-INF/manifest.xml
|
147
|
-
- test/data/compressed_mimetype.ucf
|
148
|
-
- test/data/dirs/empty/mimetype
|
149
|
-
- test/data/dirs/managed/greeting.txt
|
150
|
-
- test/data/dirs/managed/mimetype
|
151
|
-
- test/data/dirs/null/.gitkeep
|
152
|
-
- test/data/empty.ucf
|
153
|
-
- test/data/empty.zip
|
154
|
-
- test/data/example.ucf
|
155
|
-
- test/data/null.file
|
156
|
-
- test/tc_create_file.rb
|
157
|
-
- test/tc_managed_entries.rb
|
158
|
-
- test/tc_read_dir.rb
|
159
|
-
- test/tc_read_file.rb
|
160
|
-
- test/tc_reserved_names.rb
|
161
|
-
- test/ts_ucf.rb
|
162
203
|
- ucf.gemspec
|
163
|
-
|
164
|
-
homepage: http://mygrid.github.io/ruby-ucf/
|
204
|
+
homepage: https://github.com/hainesr/ruby-ucf
|
165
205
|
licenses:
|
166
206
|
- BSD
|
167
|
-
metadata:
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
207
|
+
metadata:
|
208
|
+
bug_tracker_uri: https://github.com/hainesr/ruby-ucf/issues
|
209
|
+
changelog_uri: https://github.com/hainesr/ruby-ucf/blob/v3.0.0/Changelog.md
|
210
|
+
documentation_uri: https://hainesr.github.io/ruby-ucf
|
211
|
+
source_code_uri: https://github.com/hainesr/ruby-ucf/tree/v3.0.0
|
212
|
+
rubygems_mfa_required: 'true'
|
213
|
+
post_install_message:
|
214
|
+
rdoc_options: []
|
173
215
|
require_paths:
|
174
216
|
- lib
|
175
217
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
218
|
requirements:
|
177
219
|
- - ">="
|
178
220
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
221
|
+
version: '3.0'
|
180
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
223
|
requirements:
|
182
224
|
- - ">="
|
183
225
|
- !ruby/object:Gem::Version
|
184
226
|
version: '0'
|
185
227
|
requirements: []
|
186
|
-
rubygems_version: 3.
|
187
|
-
signing_key:
|
228
|
+
rubygems_version: 3.4.1
|
229
|
+
signing_key:
|
188
230
|
specification_version: 4
|
189
231
|
summary: Universal Container Format (UCF) Ruby Library
|
190
|
-
test_files:
|
191
|
-
- test/data/META-INF/container.xml
|
192
|
-
- test/data/META-INF/manifest.xml
|
193
|
-
- test/data/compressed_mimetype.ucf
|
194
|
-
- test/data/dirs/empty/mimetype
|
195
|
-
- test/data/dirs/managed/greeting.txt
|
196
|
-
- test/data/dirs/managed/mimetype
|
197
|
-
- test/data/dirs/null/.gitkeep
|
198
|
-
- test/data/empty.ucf
|
199
|
-
- test/data/empty.zip
|
200
|
-
- test/data/example.ucf
|
201
|
-
- test/data/null.file
|
202
|
-
- test/tc_create_file.rb
|
203
|
-
- test/tc_managed_entries.rb
|
204
|
-
- test/tc_read_dir.rb
|
205
|
-
- test/tc_read_file.rb
|
206
|
-
- test/tc_reserved_names.rb
|
207
|
-
- test/ts_ucf.rb
|
232
|
+
test_files: []
|
data/.ruby-env
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
RUBYLIB=./lib:../lib
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ucf
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.2.1
|
data/.travis.yml
DELETED
data/ReadMe.rdoc
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
= Universal Container Format (UCF) Ruby Library
|
2
|
-
|
3
|
-
Authors:: Robert Haines
|
4
|
-
Contact:: mailto:support@mygrid.org.uk
|
5
|
-
Homepage:: http://mygrid.github.io/ruby-ucf
|
6
|
-
Source code:: https://github.com/myGrid/ruby-ucf
|
7
|
-
Licence:: BSD (See Licence file or http://www.opensource.org/licenses/bsd-license.php)
|
8
|
-
Copyright:: (c) 2013-2015 The University of Manchester, UK
|
9
|
-
|
10
|
-
{<img src="https://badge.fury.io/rb/ucf.svg" alt="Gem Version" />}[http://badge.fury.io/rb/ucf]
|
11
|
-
{<img src="https://codeclimate.com/github/myGrid/ruby-ucf.svg" />}[https://codeclimate.com/github/myGrid/ruby-ucf]
|
12
|
-
{<img src="https://travis-ci.org/myGrid/ruby-ucf.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/myGrid/ruby-ucf]
|
13
|
-
{<img src="https://coveralls.io/repos/myGrid/ruby-ucf/badge.svg?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/myGrid/ruby-ucf?branch=master]
|
14
|
-
|
15
|
-
== Synopsis
|
16
|
-
|
17
|
-
This is a Ruby library for working with UCF documents. See
|
18
|
-
{the specification}[https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format]
|
19
|
-
for more details. UCF is a type of EPUB and very similar to the
|
20
|
-
{EPUB Open Container Format (OCF)}[http://www.idpf.org/epub/30/spec/epub30-ocf.html].
|
21
|
-
|
22
|
-
Most of this library's API is provided by the underlying
|
23
|
-
{zip-container gem}[https://rubygems.org/gems/zip-container] so you will need
|
24
|
-
to consult
|
25
|
-
{that documentation as well}[http://mygrid.github.io/ruby-zip-container/] in
|
26
|
-
addition to this.
|
27
|
-
|
28
|
-
There are some examples of how to use the library provided in the examples
|
29
|
-
directory. See the contents of the tests directory for even more.
|
30
|
-
|
31
|
-
We follow the principles of {Semantic Versioning}[http://semver.org/] for our
|
32
|
-
releases.
|
33
|
-
|
34
|
-
== Files in the META-INF directory
|
35
|
-
|
36
|
-
The UCF specification requires that files in the META-INF directory are
|
37
|
-
validated against a schema if they are present. If the
|
38
|
-
{nokogiri gem}[https://rubygems.org/gems/nokogiri] is available then this
|
39
|
-
library will use it to validate the contents of the <tt>container.xml</tt> and
|
40
|
-
<tt>manifest.xml</tt> files. This functionality is not enforced on the user in
|
41
|
-
case they are not using the META-INF directory and so would not need the extra
|
42
|
-
dependency on nokogiri.
|
43
|
-
|
44
|
-
== Backwards incompatibility warning!
|
45
|
-
|
46
|
-
The UCF::Container class is deprecated in favour of UCF::File. These classes
|
47
|
-
are functionally identical; it is just a change of name. The new name brings
|
48
|
-
this API into closer alignment with the underlying
|
49
|
-
{zip-container API}[http://mygrid.github.io/ruby-zip-container/]
|
50
|
-
(ZipContainer::File).
|
51
|
-
|
52
|
-
UCF::Container is not available from version 1.0.0 onwards.
|
53
|
-
|
54
|
-
== Usage
|
55
|
-
|
56
|
-
This library has two entry points.
|
57
|
-
|
58
|
-
The main UCF::File class is a specialization of
|
59
|
-
{ZipContainer::File}[http://mygrid.github.io/ruby-zip-container/3.0.0/ZipContainer/File.html]
|
60
|
-
which largely mimics the rubyzip
|
61
|
-
{Zip::File}[http://www.rubydoc.info/gems/rubyzip/1.1.6/Zip/File] and
|
62
|
-
{Zip::FileSystem}[http://www.rubydoc.info/gems/rubyzip/1.1.6/Zip/FileSystem]
|
63
|
-
APIs.
|
64
|
-
|
65
|
-
The UCF::Dir class is a based upon the
|
66
|
-
{ZipContainer::Dir}[http://mygrid.github.io/ruby-zip-container/3.0.0/ZipContainer/Dir.html]
|
67
|
-
class which mimics, where possible, the core ruby
|
68
|
-
{Dir API}[http://ruby-doc.org/core-1.9.3/Dir.html].
|
69
|
-
|
70
|
-
There are some examples of how to use the library provided in the examples
|
71
|
-
directory. See the contents of the tests directory for even more.
|
72
|
-
|
73
|
-
== What this library can not do yet
|
74
|
-
|
75
|
-
The basic requirements of a UCF document are all implemented but there are a
|
76
|
-
number of optional features that are not yet provided.
|
77
|
-
|
78
|
-
* Memory resident UCF documents. Presently all operations are performed on
|
79
|
-
documents that are resident on disk as the underlying
|
80
|
-
{rubyzip library}[https://github.com/aussiegeek/rubyzip] currently
|
81
|
-
{cannot do anything else}[https://github.com/aussiegeek/rubyzip/issues/74].
|
82
|
-
* Validation of all file contents in the META-INF directory. The
|
83
|
-
<tt>container.xml</tt> and <tt>manifest.xml</tt> files are validated but
|
84
|
-
others are not yet.
|
85
|
-
* Digital signatures (this feature has been deferred until a future revision
|
86
|
-
of the UCF specification. It will be supported by this gem when it is added
|
87
|
-
to the specification).
|
88
|
-
* Encryption (this feature has been deferred until a future revision of the
|
89
|
-
UCF specification. It will be supported by this gem when it is added to the
|
90
|
-
specification).
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
|
3
|
-
<rootfiles>
|
4
|
-
<rootfile full-path="OEBPS/As You Like It.opf"
|
5
|
-
media-type="application/oebps-package+xml" />
|
6
|
-
<rootfile full-path="OEBPS/As You Like It.pdf"
|
7
|
-
media-type="application/pdf" />
|
8
|
-
</rootfiles>
|
9
|
-
<relationships xmlns:pdf="http://ns.adobe.com/pdf/2006">
|
10
|
-
<relationship type="metadata" target="$path.xmp"/>
|
11
|
-
<relationship type="pdf:annotation" target="$path.ann"/>
|
12
|
-
</relationships>
|
13
|
-
</container>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
|
3
|
-
<manifest:manifest
|
4
|
-
xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
|
5
|
-
<manifest:file-entry
|
6
|
-
manifest:media-type="application/vnd.oasis.opendocument.text"
|
7
|
-
manifest:full-path="/"/>
|
8
|
-
<manifest:file-entry
|
9
|
-
manifest:media-type="application/vnd.sun.xml.ui.configuration"
|
10
|
-
manifest:full-path="Configurations2/"/>
|
11
|
-
<manifest:file-entry
|
12
|
-
manifest:media-type="" manifest:full-path="Pictures/"/>
|
13
|
-
<manifest:file-entry
|
14
|
-
manifest:media-type="text/xml" manifest:full-path="content.xml"/>
|
15
|
-
<manifest:file-entry
|
16
|
-
manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
|
17
|
-
<manifest:file-entry
|
18
|
-
manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
|
19
|
-
<manifest:file-entry
|
20
|
-
manifest:media-type=""
|
21
|
-
manifest:full-path="Thumbnails/thumbnail.png"/>
|
22
|
-
<manifest:file-entry
|
23
|
-
manifest:media-type="" manifest:full-path="Thumbnails/"/>
|
24
|
-
<manifest:file-entry
|
25
|
-
manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
|
26
|
-
</manifest:manifest>
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
application/epub+zip
|
@@ -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.
|
data/test/data/empty.ucf
DELETED
Binary file
|
data/test/data/empty.zip
DELETED
Binary file
|
data/test/data/example.ucf
DELETED
Binary file
|
data/test/data/null.file
DELETED
File without changes
|
data/test/tc_create_file.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
# Copyright (c) 2013-2015 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 'tmpdir'
|
35
|
-
require 'ucf'
|
36
|
-
|
37
|
-
class TestCreateFile < Test::Unit::TestCase
|
38
|
-
|
39
|
-
# Check creation of standard empty ucf files.
|
40
|
-
def test_create_standard_file
|
41
|
-
Dir.mktmpdir do |dir|
|
42
|
-
filename = File.join(dir, "test.ucf")
|
43
|
-
|
44
|
-
assert_nothing_raised do
|
45
|
-
UCF::File.create(filename) do |c|
|
46
|
-
assert(c.on_disk?)
|
47
|
-
refute(c.in_memory?)
|
48
|
-
|
49
|
-
assert(c.find_entry("mimetype").local_header_offset == 0)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
54
|
-
UCF::File.verify!(filename)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Check creation of empty ucf files with a different mimetype.
|
60
|
-
def test_create_mimetype_file
|
61
|
-
mimetype = "application/x-something-really-odd"
|
62
|
-
|
63
|
-
Dir.mktmpdir do |dir|
|
64
|
-
filename = File.join(dir, "test.ucf")
|
65
|
-
|
66
|
-
assert_nothing_raised do
|
67
|
-
UCF::File.create(filename, mimetype) do |c|
|
68
|
-
assert(c.on_disk?)
|
69
|
-
refute(c.in_memory?)
|
70
|
-
|
71
|
-
assert(c.find_entry("mimetype").local_header_offset == 0)
|
72
|
-
|
73
|
-
assert_equal mimetype, c.read("mimetype")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
78
|
-
UCF::File.verify!(filename)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# Check creation of stuff in ucf files. Check the commit status a few times
|
84
|
-
# to ensure that what we expect to happen, happens.
|
85
|
-
def test_create_contents_file
|
86
|
-
Dir.mktmpdir do |dir|
|
87
|
-
filename = File.join(dir, "test.ucf")
|
88
|
-
|
89
|
-
assert_nothing_raised do
|
90
|
-
UCF::File.create(filename) do |ucf|
|
91
|
-
assert(ucf.on_disk?)
|
92
|
-
refute(ucf.in_memory?)
|
93
|
-
|
94
|
-
ucf.file.open("test.txt", "w") do |f|
|
95
|
-
f.print "testing"
|
96
|
-
end
|
97
|
-
|
98
|
-
assert(ucf.commit_required?)
|
99
|
-
assert(ucf.commit)
|
100
|
-
refute(ucf.commit_required?)
|
101
|
-
refute(ucf.commit)
|
102
|
-
|
103
|
-
ucf.dir.mkdir("dir1")
|
104
|
-
ucf.mkdir("dir2")
|
105
|
-
|
106
|
-
assert(ucf.commit_required?)
|
107
|
-
assert(ucf.commit)
|
108
|
-
refute(ucf.commit_required?)
|
109
|
-
refute(ucf.commit)
|
110
|
-
|
111
|
-
ucf.comment = "A comment!"
|
112
|
-
|
113
|
-
assert(ucf.commit_required?)
|
114
|
-
assert(ucf.commit)
|
115
|
-
refute(ucf.commit_required?)
|
116
|
-
refute(ucf.commit)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
121
|
-
UCF::File.open(filename) do |ucf|
|
122
|
-
assert(ucf.on_disk?)
|
123
|
-
refute(ucf.in_memory?)
|
124
|
-
|
125
|
-
assert(ucf.file.exists?("test.txt"))
|
126
|
-
assert(ucf.file.exists?("dir1"))
|
127
|
-
assert(ucf.file.exists?("dir2"))
|
128
|
-
refute(ucf.file.exists?("dir3"))
|
129
|
-
|
130
|
-
text = ucf.file.read("test.txt")
|
131
|
-
assert_equal("testing", text)
|
132
|
-
|
133
|
-
assert_equal("A comment!", ucf.comment)
|
134
|
-
|
135
|
-
refute(ucf.commit_required?)
|
136
|
-
refute(ucf.commit)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|