zipruby 0.1.1-mswin32 → 0.1.2-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of zipruby might be problematic. Click here for more details.
- data/README.txt +131 -0
- data/lib/i386-mswin32/zipruby.so +0 -0
- metadata +4 -2
data/README.txt
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
= Zip/Ruby
|
2
|
+
|
3
|
+
Copyright (c) 2008 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Ruby bindings for libzip.
|
8
|
+
|
9
|
+
libzip is a C library for reading, creating, and modifying zip archives.
|
10
|
+
|
11
|
+
== Project Page
|
12
|
+
|
13
|
+
http://rubyforge.org/projects/zipruby
|
14
|
+
|
15
|
+
== Install
|
16
|
+
|
17
|
+
gem install zipruby
|
18
|
+
|
19
|
+
== Download
|
20
|
+
|
21
|
+
https://rubyforge.org/frs/?group_id=6124
|
22
|
+
|
23
|
+
== Example
|
24
|
+
=== reading zip archives
|
25
|
+
|
26
|
+
require 'zipruby'
|
27
|
+
|
28
|
+
Zip::Archive.open('filename.zip') do |ar|
|
29
|
+
n = ar.num_files # number of entries
|
30
|
+
|
31
|
+
n.times do |i|
|
32
|
+
entry_name = ar.get_name(i) # get entry name from archive
|
33
|
+
|
34
|
+
# open entry
|
35
|
+
ar.fopen(entry_name) do |f| # or ar.fopen(i) do |f|
|
36
|
+
name = f.name # name of the file
|
37
|
+
size = f.size # size of file (uncompressed)
|
38
|
+
comp_size = f.comp_size # size of file (compressed)
|
39
|
+
|
40
|
+
content = f.read # read entry content
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Zip::Archive includes Enumerable
|
45
|
+
entry_names = ar.map do |f|
|
46
|
+
f.naem
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
=== creating zip archives
|
51
|
+
|
52
|
+
require 'zipruby'
|
53
|
+
|
54
|
+
Zip::Archive.open('filename.zip', Zip::CREATE) do |ar|
|
55
|
+
ar.add_file('foo.txt') # add file to zip archive
|
56
|
+
|
57
|
+
# add file to zip archive from File object
|
58
|
+
open('bar.txt') do |f|
|
59
|
+
ar << f # or ar.add_filep(f)
|
60
|
+
end
|
61
|
+
|
62
|
+
# add file to zip archive from buffer
|
63
|
+
ar.add_buffer('zoo.txt', 'Hello, world!')
|
64
|
+
end
|
65
|
+
|
66
|
+
=== modifying zip archives
|
67
|
+
|
68
|
+
require 'zipruby'
|
69
|
+
|
70
|
+
Zip::Archive.open('filename.zip') do |ar|
|
71
|
+
# replace file in zip archive
|
72
|
+
ar.replace_file(0, 'foo.txt')
|
73
|
+
|
74
|
+
# replace file in zip archive with File object
|
75
|
+
open('bar.txt') do |f|
|
76
|
+
ar.replace_filep(1, f)
|
77
|
+
end
|
78
|
+
|
79
|
+
# replace file in zip archive with buffer
|
80
|
+
ar.replace_buffer(2, 'Hello, world!')
|
81
|
+
|
82
|
+
# add or replace file in zip archive
|
83
|
+
ar.add_or_replace_file(3, 'foo.txt')
|
84
|
+
end
|
85
|
+
|
86
|
+
# ar1 imports ar2 entries
|
87
|
+
Zip::Archive.open('ar1.zip') do |ar1|
|
88
|
+
Zip::Archive.open('ar2.zip') do |ar2|
|
89
|
+
ar1.update(ar2)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
== License
|
94
|
+
Copyright (c) 2008 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
|
95
|
+
All rights reserved.
|
96
|
+
|
97
|
+
Redistribution and use in source and binary forms, with or without modification,
|
98
|
+
are permitted provided that the following conditions are met:
|
99
|
+
|
100
|
+
* Redistributions of source code must retain the above copyright notice,
|
101
|
+
this list of conditions and the following disclaimer.
|
102
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
103
|
+
this list of conditions and the following disclaimer in the documentation
|
104
|
+
and/or other materials provided with the distribution.
|
105
|
+
* The names of its contributors may be used to endorse or promote products
|
106
|
+
derived from this software without specific prior written permission.
|
107
|
+
|
108
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
109
|
+
ANY EXPRESS OR IMPLIED WARRANTIES,
|
110
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
111
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
112
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
113
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
114
|
+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
115
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
116
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
117
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
118
|
+
DAMAGE.
|
119
|
+
|
120
|
+
=== libzip
|
121
|
+
Zip/Ruby contains libzip.
|
122
|
+
|
123
|
+
libzip is a C library for reading, creating, and modifying zip archives.
|
124
|
+
|
125
|
+
* distribution site:
|
126
|
+
* http://www.nih.at/libzip/
|
127
|
+
* ftp.nih.at /pub/nih/libzip
|
128
|
+
|
129
|
+
* authors:
|
130
|
+
* Dieter Baron <dillo@giga.or.at>
|
131
|
+
* Thomas Klausner <tk@giga.or.at>
|
data/lib/i386-mswin32/zipruby.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: mswin32
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-26 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -20,9 +20,11 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
+
- README.txt
|
23
24
|
- zipruby.c
|
24
25
|
files:
|
25
26
|
- lib/i386-mswin32/zipruby.so
|
27
|
+
- README.txt
|
26
28
|
- zipruby.c
|
27
29
|
has_rdoc: true
|
28
30
|
homepage: http://zipruby.rubyforge.org
|