ucf 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -0
- data/Changes.rdoc +7 -0
- data/Licence.rdoc +1 -1
- data/ReadMe.rdoc +23 -4
- data/examples/create-ucf +3 -3
- data/examples/ucfinfo +3 -3
- data/examples/verify-ucf +3 -3
- data/test/tc_create_file.rb +4 -4
- data/test/tc_managed_entries.rb +8 -8
- data/test/tc_read_dir.rb +3 -3
- data/test/tc_read_file.rb +12 -10
- data/test/tc_reserved_names.rb +2 -2
- data/ucf.gemspec +2 -2
- data/version.yml +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDM5YTE4OGEzZTkwYTZjZGQ0ODNlZmRmYzI1ZjFhYzdmYmNjMDBiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTNiMmFkYWM3NmMxODY1MGQ2OTVlODNmZGIyYjFhNDk1YzRhYTI4Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDU2YTJlZDk0MGZjYjZiNDU5OTBjOWUyOThiYWZjMjZiYTUwYTI1MjZkOTYx
|
10
|
+
NjJlZGNhNDZjOTU3YjRjY2M2NjI2NDIzZDlmZDM0ZjM3MDI1NDJkODI4NWY1
|
11
|
+
N2M0NmIyZmE3MDIxOTc5ZDY1ZTBjMWMzMTBhM2ViNTZjMjY5NmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDY0NjYzNTc2MzQyM2YxNTVkOGJhMDAzYzcwODIzYTg5M2VlNWM1OTM3Mjcy
|
14
|
+
MmQwNjUwYWE3Y2NlMmI3ODY4MjBiODQxZWIwODUzMmM4ZjJiNWM1NzAwZTg2
|
15
|
+
NGUyNTVmYTVlNGUwMjliODcwMTA4ODJkZmMyYTdmOWMwYmRlZmQ=
|
data/.travis.yml
CHANGED
data/Changes.rdoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= Changes log for the UCF Ruby Gem
|
2
2
|
|
3
|
+
== Version 2.0.0
|
4
|
+
|
5
|
+
* Add ruby 2.2.0 to the Travis test matrix.
|
6
|
+
* Update examples and tests to use the latest API.
|
7
|
+
* Add some usage information to the ReadMe.
|
8
|
+
* Update to version 3.0.1 of zip-container.
|
9
|
+
|
3
10
|
== Version 1.1.0
|
4
11
|
|
5
12
|
* Tidy up gemspec and update dependency versions.
|
data/Licence.rdoc
CHANGED
data/ReadMe.rdoc
CHANGED
@@ -5,12 +5,12 @@ Contact:: mailto:support@mygrid.org.uk
|
|
5
5
|
Homepage:: http://mygrid.github.io/ruby-ucf
|
6
6
|
Source code:: https://github.com/myGrid/ruby-ucf
|
7
7
|
Licence:: BSD (See Licence file or http://www.opensource.org/licenses/bsd-license.php)
|
8
|
-
Copyright:: (c) 2013
|
8
|
+
Copyright:: (c) 2013-2015 The University of Manchester, UK
|
9
9
|
|
10
|
-
{<img src="https://badge.fury.io/rb/ucf.
|
11
|
-
{<img src="https://codeclimate.com/github/myGrid/ruby-ucf.
|
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
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.
|
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
14
|
|
15
15
|
== Synopsis
|
16
16
|
|
@@ -51,6 +51,25 @@ this API into closer alignment with the underlying
|
|
51
51
|
|
52
52
|
UCF::Container is not available from version 1.0.0 onwards.
|
53
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
|
+
|
54
73
|
== What this library can not do yet
|
55
74
|
|
56
75
|
The basic requirements of a UCF document are all implemented but there are a
|
data/examples/create-ucf
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
2
|
+
# Copyright (c) 2013-2015 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
@@ -50,7 +50,7 @@ if File.exists?(ucffile)
|
|
50
50
|
end
|
51
51
|
|
52
52
|
begin
|
53
|
-
UCF::
|
53
|
+
UCF::File.create(ucffile) do |c|
|
54
54
|
|
55
55
|
# Add a cheery greeting file from a string.
|
56
56
|
c.file.open("greeting.txt", "w") do |f|
|
@@ -66,7 +66,7 @@ begin
|
|
66
66
|
# Add a explanation of this file.
|
67
67
|
c.comment = "This is an example UCF file!"
|
68
68
|
end
|
69
|
-
rescue ZipContainer::MalformedContainerError,
|
69
|
+
rescue ZipContainer::MalformedContainerError, ZipContainer::Error => err
|
70
70
|
puts err.to_s
|
71
71
|
exit 1
|
72
72
|
end
|
data/examples/ucfinfo
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
2
|
+
# Copyright (c) 2013-2015 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
@@ -45,8 +45,8 @@ usage unless ARGV.length == 1
|
|
45
45
|
ucffile = ARGV[0]
|
46
46
|
|
47
47
|
begin
|
48
|
-
ucf = UCF::
|
49
|
-
rescue ZipContainer::MalformedContainerError,
|
48
|
+
ucf = UCF::File.open(ucffile)
|
49
|
+
rescue ZipContainer::MalformedContainerError, ZipContainer::Error => err
|
50
50
|
puts err.to_s
|
51
51
|
exit 1
|
52
52
|
end
|
data/examples/verify-ucf
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
2
|
+
# Copyright (c) 2013-2015 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
@@ -45,8 +45,8 @@ usage unless ARGV.length == 1
|
|
45
45
|
ucffile = ARGV[0]
|
46
46
|
|
47
47
|
begin
|
48
|
-
UCF::
|
49
|
-
rescue ZipContainer::MalformedContainerError,
|
48
|
+
UCF::File.verify!(ucffile)
|
49
|
+
rescue ZipContainer::MalformedContainerError, ZipContainer::Error => err
|
50
50
|
puts err.to_s
|
51
51
|
exit 1
|
52
52
|
end
|
data/test/tc_create_file.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
|
#
|
@@ -50,7 +50,7 @@ class TestCreateFile < Test::Unit::TestCase
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
53
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
54
54
|
UCF::File.verify!(filename)
|
55
55
|
end
|
56
56
|
end
|
@@ -74,7 +74,7 @@ class TestCreateFile < Test::Unit::TestCase
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
77
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
78
78
|
UCF::File.verify!(filename)
|
79
79
|
end
|
80
80
|
end
|
@@ -117,7 +117,7 @@ class TestCreateFile < Test::Unit::TestCase
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
120
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
121
121
|
UCF::File.open(filename) do |ucf|
|
122
122
|
assert(ucf.on_disk?)
|
123
123
|
refute(ucf.in_memory?)
|
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
|
#
|
@@ -98,7 +98,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
98
98
|
|
99
99
|
# Check that the example UCF document does not validate as a ManagedUCF.
|
100
100
|
def test_fail_verification
|
101
|
-
refute(ManagedUCF.verify($ucf_example))
|
101
|
+
refute(ManagedUCF.verify?($ucf_example))
|
102
102
|
|
103
103
|
assert_raises(ZipContainer::MalformedContainerError) do
|
104
104
|
ManagedUCF.verify!($ucf_example)
|
@@ -107,7 +107,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
107
107
|
|
108
108
|
# Check that the example UCF document does validate as an ExampleUCF.
|
109
109
|
def test_pass_verification
|
110
|
-
assert(ExampleUCF.verify($ucf_example))
|
110
|
+
assert(ExampleUCF.verify?($ucf_example))
|
111
111
|
|
112
112
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
113
113
|
ExampleUCF.verify!($ucf_example)
|
@@ -116,7 +116,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
116
116
|
|
117
117
|
# Check that the example UCF document does validate as an ExampleUCF2.
|
118
118
|
def test_pass_verification_2
|
119
|
-
assert(ExampleUCF2.verify($ucf_example))
|
119
|
+
assert(ExampleUCF2.verify?($ucf_example))
|
120
120
|
|
121
121
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
122
122
|
ExampleUCF2.verify!($ucf_example)
|
@@ -125,7 +125,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
125
125
|
|
126
126
|
# Check that the example UCF directory validates.
|
127
127
|
def test_pass_verification_dir
|
128
|
-
assert(ExampleUCFDir.verify($dir_mngd))
|
128
|
+
assert(ExampleUCFDir.verify?($dir_mngd))
|
129
129
|
|
130
130
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
131
131
|
ExampleUCFDir.verify!($dir_mngd)
|
@@ -170,7 +170,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
refute(ManagedUCF.verify(filename))
|
173
|
+
refute(ManagedUCF.verify?(filename))
|
174
174
|
assert_raises(ZipContainer::MalformedContainerError) do
|
175
175
|
ManagedUCF.verify!(filename)
|
176
176
|
end
|
@@ -191,7 +191,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
|
-
assert(ManagedUCF.verify(filename))
|
194
|
+
assert(ManagedUCF.verify?(filename))
|
195
195
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
196
196
|
ManagedUCF.verify!(filename)
|
197
197
|
end
|
@@ -228,7 +228,7 @@ class TestManagedEntries < Test::Unit::TestCase
|
|
228
228
|
end
|
229
229
|
#end
|
230
230
|
|
231
|
-
assert(ExampleUCF2.verify(filename))
|
231
|
+
assert(ExampleUCF2.verify?(filename))
|
232
232
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
233
233
|
ExampleUCF2.verify!(filename)
|
234
234
|
end
|
data/test/tc_read_dir.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2014 The University of Manchester, UK.
|
1
|
+
# Copyright (c) 2014, 2015 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -41,7 +41,7 @@ class TestReadDir < Test::Unit::TestCase
|
|
41
41
|
UCF::Dir.verify!($dir_null)
|
42
42
|
end
|
43
43
|
|
44
|
-
refute(UCF::Dir.verify($dir_null))
|
44
|
+
refute(UCF::Dir.verify?($dir_null))
|
45
45
|
end
|
46
46
|
|
47
47
|
# Check that the empty container directory does verify.
|
@@ -50,7 +50,7 @@ class TestReadDir < Test::Unit::TestCase
|
|
50
50
|
UCF::Dir.verify!($dir_empty)
|
51
51
|
end
|
52
52
|
|
53
|
-
assert(UCF::Dir.verify($dir_empty))
|
53
|
+
assert(UCF::Dir.verify?($dir_empty))
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
data/test/tc_read_file.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
|
#
|
@@ -37,29 +37,31 @@ class TestReadFile < Test::Unit::TestCase
|
|
37
37
|
|
38
38
|
# Check that the null file does not verify.
|
39
39
|
def test_verify_null_file
|
40
|
-
assert_raise(
|
40
|
+
assert_raise(ZipContainer::Error) do
|
41
41
|
UCF::File.verify!($file_null)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
assert_raise(ZipContainer::Error) do
|
45
|
+
UCF::File.verify?($file_null)
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
# Check that the empty ucf file does verify.
|
48
50
|
def test_verify_empty_ucf
|
49
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
51
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
50
52
|
UCF::File.verify!($ucf_empty)
|
51
53
|
end
|
52
54
|
|
53
|
-
assert(UCF::File.verify($ucf_empty))
|
55
|
+
assert(UCF::File.verify?($ucf_empty))
|
54
56
|
end
|
55
57
|
|
56
58
|
# Check that the example ucf file does verify.
|
57
59
|
def test_verify_example_ucf
|
58
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
60
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
59
61
|
UCF::File.verify!($ucf_example)
|
60
62
|
end
|
61
63
|
|
62
|
-
assert(UCF::File.verify($ucf_example))
|
64
|
+
assert(UCF::File.verify?($ucf_example))
|
63
65
|
end
|
64
66
|
|
65
67
|
# Check that the empty zip file does not verify.
|
@@ -68,7 +70,7 @@ class TestReadFile < Test::Unit::TestCase
|
|
68
70
|
UCF::File.verify!($zip_empty)
|
69
71
|
end
|
70
72
|
|
71
|
-
refute(UCF::File.verify($zip_empty))
|
73
|
+
refute(UCF::File.verify?($zip_empty))
|
72
74
|
end
|
73
75
|
|
74
76
|
# Check that a compressed mimetype file is detected.
|
@@ -77,7 +79,7 @@ class TestReadFile < Test::Unit::TestCase
|
|
77
79
|
UCF::File.verify!($ucf_compressed_mimetype)
|
78
80
|
end
|
79
81
|
|
80
|
-
refute(UCF::File.verify($ucf_compressed_mimetype))
|
82
|
+
refute(UCF::File.verify?($ucf_compressed_mimetype))
|
81
83
|
end
|
82
84
|
|
83
85
|
# Check the raw mimetype bytes
|
@@ -91,7 +93,7 @@ class TestReadFile < Test::Unit::TestCase
|
|
91
93
|
|
92
94
|
# Check reading files out of a ucf file and make sure we don't change it.
|
93
95
|
def test_read_files_from_ucf
|
94
|
-
assert_nothing_raised(ZipContainer::MalformedContainerError,
|
96
|
+
assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
|
95
97
|
UCF::File.open($ucf_example) do |ucf|
|
96
98
|
assert(ucf.on_disk?)
|
97
99
|
refute(ucf.in_memory?)
|
data/test/tc_reserved_names.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
1
|
+
# Copyright (c) 2013-2015 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -54,7 +54,7 @@ class TestReservedNames < Test::Unit::TestCase
|
|
54
54
|
|
55
55
|
# Check that the reserved names verify correctly.
|
56
56
|
def test_verify_reserved_name
|
57
|
-
assert(NewUCF.verify($ucf_example))
|
57
|
+
assert(NewUCF.verify?($ucf_example))
|
58
58
|
|
59
59
|
assert_nothing_raised(ZipContainer::MalformedContainerError) do
|
60
60
|
NewUCF.verify!($ucf_example)
|
data/ucf.gemspec
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
|
#
|
@@ -62,5 +62,5 @@ Gem::Specification.new do |s|
|
|
62
62
|
s.add_development_dependency "test-unit", "~> 3.0"
|
63
63
|
s.add_development_dependency "coveralls"
|
64
64
|
s.add_development_dependency "nokogiri", "~> 1.6"
|
65
|
-
s.add_runtime_dependency "zip-container", "~>
|
65
|
+
s.add_runtime_dependency "zip-container", "~> 3.0.1"
|
66
66
|
end
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Haines
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.0.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 3.0.1
|
111
111
|
description: A Ruby library for working with Universal Container Format files - a
|
112
112
|
type of EPUB document. See the UCF specification (https://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format)
|
113
113
|
for details. They are very similar, although not as restrictive, as the EPUB Open
|