libarchive-ruby-swig 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@ if find_executable('g++')
21
21
  end
22
22
 
23
23
  if swig = find_executable('swig')
24
- `#{swig} -c++ -ruby -features autodoc libarchive.i`
24
+ `#{swig} -c++ -ruby -features autodoc=0 libarchive.i`
25
25
  $distcleanfiles << 'libarchive_wrap.cxx'
26
26
  else
27
27
  $stderr.write "You need SWIG to compile this extension.\n"
@@ -0,0 +1,465 @@
1
+ #
2
+ # This file is part of "libarchive-ruby-swig", a simple SWIG wrapper around
3
+ # libarchive.
4
+ #
5
+ # Copyright 2011, Tobias Koch <tobias.koch@gmail.com>
6
+ #
7
+ # libarchive-ruby-swig is licensed under a simplified BSD License. A copy of the
8
+ # license text can be found in the file LICENSE.txt distributed with the source.
9
+ #
10
+
11
+ #
12
+ module Archive
13
+
14
+ ##
15
+ #
16
+ # Thrown on problems with opening or processing an archive.
17
+ #
18
+ class Error < StandardError
19
+ end
20
+
21
+ ##
22
+ #
23
+ # This class is not meant to be used directly. It exists for the sole purpose
24
+ # of initializing the <code>Archive::ENTRY_*</code> constants in a
25
+ # platform-independent way.
26
+ #
27
+ class Stat
28
+
29
+ private
30
+
31
+ def self.new()
32
+ end
33
+ end
34
+
35
+ class Entry
36
+
37
+ ##
38
+ #
39
+ # Is Entry a regular file?
40
+ #
41
+ def is_file
42
+ end
43
+
44
+ ##
45
+ #
46
+ # Is Entry a directory?
47
+ #
48
+ def is_directory
49
+ end
50
+
51
+ ##
52
+ #
53
+ # Is Entry a symbolic link?
54
+ #
55
+ def is_symbolic_link
56
+ end
57
+
58
+ ##
59
+ #
60
+ # Is Entry a block device?
61
+ #
62
+ def is_block_special
63
+ end
64
+
65
+ ##
66
+ #
67
+ # Is Entry a char device?
68
+ #
69
+ def is_character_special
70
+ end
71
+
72
+ ##
73
+ #
74
+ # Is Entry a fifo?
75
+ #
76
+ def is_fifo
77
+ end
78
+
79
+ ##
80
+ #
81
+ # Is Entry a socket?
82
+ #
83
+ def is_socket
84
+ end
85
+
86
+ ##
87
+ #
88
+ # Use one of the <code>Archive::ENTRY_*</code> to specify the filetype of
89
+ # the Entry.
90
+ #
91
+ def filetype=(filetype)
92
+ end
93
+
94
+ ##
95
+ #
96
+ # Device major number of device on which this Entry resided. This field
97
+ # will not be available in most cases and is, in any case,
98
+ # platform-specific.
99
+ #
100
+ def devmajor
101
+ return numeric_result
102
+ end
103
+
104
+ ##
105
+ #
106
+ # Sets the device major number of the device on which this Entry resides. This
107
+ # field will not be availabla in most cases and is, in any case,
108
+ # platform-specific.
109
+ #
110
+ def devmajor=(devmajor)
111
+ end
112
+
113
+ ##
114
+ #
115
+ # Device minor number of device on which this Entry resided. This field
116
+ # will not be available in most cases and is, in any case,
117
+ # platform-specific.
118
+ #
119
+ def devminor
120
+ return numeric_result
121
+ end
122
+
123
+ ##
124
+ #
125
+ # Sets the device minor number of the device on which this Entry resides. This
126
+ # field will not be availabla in most cases and is, in any case,
127
+ # platform-specific.
128
+ #
129
+ def devminor=(devminor)
130
+ end
131
+
132
+ ##
133
+ #
134
+ # Returns the atime of the saved Entry as a timestamp since epoch.
135
+ #
136
+ def atime
137
+ end
138
+
139
+ ##
140
+ #
141
+ # Sets the atime of the saved Entry from a timestamp.
142
+ #
143
+ def atime(atime)
144
+ end
145
+
146
+ ##
147
+ #
148
+ # Resets the Entry.
149
+ #
150
+ def clear
151
+ end
152
+
153
+ ##
154
+ #
155
+ # Returns an exact clone of Entry.
156
+ #
157
+ Entry *clone();
158
+
159
+ ##
160
+ #
161
+ # Device id of the device on which entry resided. This is usually unused
162
+ # and, in any case, platform-specific.
163
+ #
164
+ def dev
165
+ end
166
+
167
+ ##
168
+ #
169
+ # Sets the device id of the device on which entry resided. This is usually
170
+ # unused and, in any case, platform-specific.
171
+ #
172
+ def dev=(dev)
173
+ end
174
+
175
+ ##
176
+ #
177
+ # Group id of the Entry.
178
+ #
179
+ def gid
180
+ end
181
+
182
+ ##
183
+ #
184
+ # Sets the group id of the Entry.
185
+ #
186
+ def gid=(gid)
187
+ end
188
+
189
+ ##
190
+ #
191
+ # Group name of the Entry.
192
+ #
193
+ def gname
194
+ end
195
+
196
+ ##
197
+ #
198
+ # Sets the group name of the Entry.
199
+ #
200
+ def gname=(gname)
201
+ end
202
+
203
+ ##
204
+ #
205
+ # Path of file this entry was hardlinked to.
206
+ #
207
+ def hardlink
208
+ end
209
+
210
+ ##
211
+ #
212
+ # Sets the path to the file this entry is hard-linked to.
213
+ #
214
+ def hardlink=
215
+ end
216
+
217
+ ##
218
+ #
219
+ # Inode of Entry.
220
+ #
221
+ def ino
222
+ end
223
+
224
+ ##
225
+ #
226
+ # Sets the inode of Entry.
227
+ #
228
+ def ino=(ino)
229
+ end
230
+
231
+ ##
232
+ #
233
+ # Permission bits and filetype of entry
234
+ #
235
+ def mode
236
+ end
237
+
238
+ ##
239
+ #
240
+ # Sets the permission bits (and/or filetype) of Entry.
241
+ #
242
+ def mode=(mode)
243
+ end
244
+
245
+ ##
246
+ #
247
+ # Returns the mtime of the saved Entry as a timestamp since epoch.
248
+ #
249
+ def mtime
250
+ end
251
+
252
+ ##
253
+ #
254
+ # Sets the mtime of the saved Entry from a timestamp.
255
+ #
256
+ def mtime=(mtime)
257
+ end
258
+
259
+ ##
260
+ #
261
+ # Number of hard links to this Entry.
262
+ #
263
+ def nlink
264
+ end
265
+
266
+ ##
267
+ #
268
+ # Sets the number of hard links to this Entry.
269
+ #
270
+ def nlink=(num_links)
271
+ end
272
+
273
+ ##
274
+ #
275
+ # Returns the pathname of this Entry.
276
+ #
277
+ def pathname
278
+ end
279
+
280
+ ##
281
+ #
282
+ # Sets the pathname of this Entry.
283
+ #
284
+ def pathname=(pathname)
285
+ end
286
+
287
+ ##
288
+ #
289
+ # The dev major number of the device this Entry represents.
290
+ #
291
+ def rdevmajor
292
+ end
293
+
294
+ ##
295
+ #
296
+ # Sets the dev major number of the device this Entry represents.
297
+ #
298
+ def rdevmajor=(devmajor)
299
+ end
300
+
301
+ ##
302
+ #
303
+ # The dev minor number of the device this Entry represents.
304
+ #
305
+ def rdevminor
306
+ end
307
+
308
+ ##
309
+ #
310
+ # Sets the dev minor number of the device this Entry represents.
311
+ #
312
+ def rdevminor=(devminor)
313
+ end
314
+
315
+ ##
316
+ #
317
+ # Size of the Entry. In case Entry is a symlink, returns the size of
318
+ # symlink's target name.
319
+ #
320
+ def size
321
+ end
322
+
323
+ ##
324
+ #
325
+ # Sets the size of the Entry. In case Entry is a symlink, this should
326
+ # be the length of the string set with <code>symlink=</code>.
327
+ #
328
+ def size=()
329
+ end
330
+
331
+ ##
332
+ #
333
+ # Returns the rarget of a symlink Entry.
334
+ #
335
+ def symlink
336
+ end
337
+
338
+ ##
339
+ #
340
+ # Sets the target of a symlink Entry.
341
+ #
342
+ def symlink=(symlink)
343
+ end
344
+
345
+ ##
346
+ #
347
+ # The user id of this Entry.
348
+ #
349
+ def uid
350
+ end
351
+
352
+ ##
353
+ #
354
+ # Sets the user id of this Entry.
355
+ #
356
+ def uid=(uid)
357
+ end
358
+
359
+ ##
360
+ #
361
+ # The owner name of this entry.
362
+ #
363
+ def uname
364
+ end
365
+
366
+ ##
367
+ #
368
+ # Sets the owner name of this Entry.
369
+ #
370
+ def uname=(uname)
371
+ end
372
+
373
+ private
374
+
375
+ def self.new()
376
+ end
377
+ end
378
+
379
+ class Reader
380
+
381
+ ##
382
+ #
383
+ # Use <code>Archive::read_open_filename</code> instead.
384
+ #
385
+ def self.read_open_filename(filename, cmd = nil)
386
+ end
387
+
388
+ ##
389
+ #
390
+ # Use <code>Archive::read_open_memory</code> instead.
391
+ #
392
+ def self.read_open_memory(string, cmd = nil)
393
+ end
394
+
395
+ ##
396
+ #
397
+ # Releases all resources associated with the Reader object.
398
+ #
399
+ def close()
400
+ end
401
+
402
+ ##
403
+ #
404
+ # Returns the next Entry meta data object in the Archive.
405
+ #
406
+ def next_header()
407
+ end
408
+
409
+ private
410
+
411
+ def read_data_helper(len)
412
+ end
413
+
414
+ def self.new()
415
+ end
416
+
417
+ end
418
+
419
+ class Writer
420
+
421
+ ##
422
+ #
423
+ # Use Archive::write_open_filename instead.
424
+ #
425
+ #
426
+ def self.write_open_filename(filename, compression, format)
427
+ end
428
+
429
+ ##
430
+ #
431
+ # Releases all resources associated with the Writer object.
432
+ #
433
+ def close()
434
+ end
435
+
436
+ ##
437
+ #
438
+ # Creates a new Entry. An Entry holds the meta data for an item stored in
439
+ # an Archive, such as filetype, mode, owner, etc. It is typically populated
440
+ # by a call to <code>copy_stat</code>. It is written before the actual data.
441
+ #
442
+ def new_entry()
443
+ end
444
+
445
+ ##
446
+ #
447
+ # Write Entry meta data to Archive.
448
+ #
449
+ def write_header(entry)
450
+ end
451
+
452
+ private
453
+
454
+ def self.new()
455
+ end
456
+
457
+ def new_entry_helper()
458
+ end
459
+
460
+ def write_data_helper()
461
+ end
462
+
463
+ end
464
+
465
+ end
data/lib/libarchive_rs.rb CHANGED
@@ -20,9 +20,6 @@ module Archive
20
20
  ENTRY_BLOCK_SPECIAL = Stat.type_block_special
21
21
  ENTRY_CHARACTER_SPECIAL = Stat.type_character_special
22
22
 
23
- class Error < StandardError
24
- end
25
-
26
23
  class Entry
27
24
  alias :file? :is_file
28
25
  alias :directory? :is_directory
@@ -52,6 +49,11 @@ module Archive
52
49
  alias :uid= :set_uid
53
50
  alias :uname= :set_uname
54
51
 
52
+ ##
53
+ #
54
+ # Populates an Entry by doing a stat on given path and copying all
55
+ # attributes.
56
+ #
55
57
  def copy_stat(path)
56
58
  copy_stat_helper(path)
57
59
  self.set_symlink(File.readlink(path)) if self.symbolic_link?
@@ -61,7 +63,13 @@ module Archive
61
63
  end
62
64
 
63
65
  class Reader
64
-
66
+
67
+ ##
68
+ #
69
+ # Reads size bytes from the Archive. If a block is given, chunks of size
70
+ # bytes are repeatedly passed to the block until the complete data stored
71
+ # for the Entry has been read.
72
+ #
65
73
  def read_data(size)
66
74
  if block_given?
67
75
  while result = self.read_data_helper(size)
@@ -77,6 +85,12 @@ module Archive
77
85
 
78
86
  class Writer
79
87
 
88
+ ##
89
+ #
90
+ # Returns a new Entry instance. An Entry holds the meta data for an item
91
+ # stored in an Archive, such as filetype, mode, owner, etc. It is written
92
+ # before the actual data.
93
+ #
80
94
  def new_entry()
81
95
  entry = self.new_entry_helper
82
96
  if block_given?
@@ -86,6 +100,11 @@ module Archive
86
100
  end
87
101
  end
88
102
 
103
+ ##
104
+ #
105
+ # Write data to Archive. If a block is given, data returned from the block
106
+ # is stored until the block returns nil.
107
+ #
89
108
  def write_data(data = nil)
90
109
  if block_given?
91
110
  while result = yield
@@ -99,6 +118,14 @@ module Archive
99
118
  private_class_method :new
100
119
  end
101
120
 
121
+ ##
122
+ #
123
+ # Open filename for reading. Libarchive automatically determines archive
124
+ # format and compression scheme. Optionally, you can specify an auxiliary
125
+ # command to be used for decompression.
126
+ #
127
+ # Returns a Reader instance.
128
+ #
102
129
  def self.read_open_filename(filename, cmd = nil)
103
130
  unless cmd.nil?
104
131
  cmd = locate_cmd(cmd)
@@ -114,6 +141,14 @@ module Archive
114
141
  end
115
142
  end
116
143
 
144
+ ##
145
+ #
146
+ # Read archive from string. Libarchive automatically determines archive
147
+ # format and compression scheme. Optionally, you can specify an auxiliary
148
+ # command to be used for decompression.
149
+ #
150
+ # Returns a Reader instance.
151
+ #
117
152
  def self.read_open_memory(string, cmd = nil)
118
153
  unless cmd.nil?
119
154
  cmd = locate_cmd(cmd)
@@ -129,6 +164,15 @@ module Archive
129
164
  end
130
165
  end
131
166
 
167
+ ##
168
+ #
169
+ # Open filename for writing. Specify the compression format by passing one
170
+ # of the <code>Archive::COMPRESSION_*</code> constants or optionally specify
171
+ # an auxiliary program to use for compression. Use one of the
172
+ # <code>Archive::FORMAT_*</code> constants to specify the archive format.
173
+ #
174
+ # Returns a Writer instance.
175
+ #
132
176
  def self.write_open_filename(filename, compression, format)
133
177
  if compression.is_a? String
134
178
  compresion = locate_cmd(compression)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libarchive-ruby-swig
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Koch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 +02:00
18
+ date: 2011-02-12 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,6 +29,7 @@ extra_rdoc_files: []
29
29
 
30
30
  files:
31
31
  - lib/libarchive_rs.rb
32
+ - lib/libarchive_doc.rb
32
33
  - ext/libarchive-ruby-swig/stat.cpp
33
34
  - ext/libarchive-ruby-swig/stat.h
34
35
  - ext/libarchive-ruby-swig/entry.cpp
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
71
  requirements: []
71
72
 
72
73
  rubyforge_project: Libarchive/Ruby/SWIG
73
- rubygems_version: 1.3.7
74
+ rubygems_version: 1.5.2
74
75
  signing_key:
75
76
  specification_version: 3
76
77
  summary: Ruby bindings to libarchive