Module: Archive
- Defined in:
- lib/ffi-libarchive.rb,
lib/ffi-libarchive/stat.rb,
lib/ffi-libarchive/entry.rb,
lib/ffi-libarchive/reader.rb,
lib/ffi-libarchive/writer.rb,
lib/ffi-libarchive/archive.rb,
lib/ffi-libarchive/version.rb
Defined Under Namespace
Modules: C, Stat
Classes: BaseArchive, Entry, Error, Reader, Writer
Constant Summary
collapse
- COMPRESSION_NONE =
0
- COMPRESSION_GZIP =
1
- COMPRESSION_BZIP2 =
2
- COMPRESSION_COMPRESS =
3
- COMPRESSION_PROGRAM =
4
- COMPRESSION_LZMA =
5
- COMPRESSION_XZ =
6
- COMPRESSION_UU =
7
- COMPRESSION_RPM =
8
- COMPRESSION_LZIP =
9
- COMPRESSION_LRZIP =
10
- COMPRESSION_LZOP =
11
- COMPRESSION_GRZIP =
12
- COMPRESSION_LZ4 =
13
- FORMAT_BASE_MASK =
0xff0000
- FORMAT_CPIO =
0x10000
- FORMAT_CPIO_POSIX =
(FORMAT_CPIO | 1)
- FORMAT_CPIO_BIN_LE =
(FORMAT_CPIO | 2)
- FORMAT_CPIO_BIN_BE =
(FORMAT_CPIO | 3)
- FORMAT_CPIO_SVR4_NOCRC =
(FORMAT_CPIO | 4)
- FORMAT_CPIO_SVR4_CRC =
(FORMAT_CPIO | 5)
- FORMAT_SHAR =
0x20000
- FORMAT_SHAR_BASE =
(FORMAT_SHAR | 1)
- FORMAT_SHAR_DUMP =
(FORMAT_SHAR | 2)
- FORMAT_TAR =
0x30000
- FORMAT_TAR_USTAR =
(FORMAT_TAR | 1)
- FORMAT_TAR_PAX_INTERCHANGE =
(FORMAT_TAR | 2)
- FORMAT_TAR_PAX_RESTRICTED =
(FORMAT_TAR | 3)
- FORMAT_TAR_GNUTAR =
(FORMAT_TAR | 4)
- FORMAT_ISO9660 =
0x40000
- FORMAT_ISO9660_ROCKRIDGE =
(FORMAT_ISO9660 | 1)
- FORMAT_ZIP =
0x50000
- FORMAT_EMPTY =
0x60000
- FORMAT_AR =
0x70000
- FORMAT_AR_GNU =
(FORMAT_AR | 1)
- FORMAT_AR_BSD =
(FORMAT_AR | 2)
- FORMAT_MTREE =
0x80000
- FORMAT_RAW =
0x90000
- FORMAT_XAR =
0xA0000
- FORMAT_LHA =
0xB0000
- FORMAT_CAB =
0xC0000
- FORMAT_RAR =
0xD0000
- FORMAT_7ZIP =
0xE0000
- FORMAT_WARC =
0xF0000
0x0001
0x0002
0x0004
0x0008
0x0010
0x0020
0x0040
0x0080
0x0100
0x0200
0x0400
0x0800
0x1000
0x2000
0x4000
0x8000
0x10000
0x20000
- VERSION =
"1.0.4".freeze
Class Method Summary
collapse
-
.libpath(*args) ⇒ Object
Returns the library path for the module.
-
.path(*args) ⇒ Object
Returns the lpath for the module.
-
.read_open_filename(file_name, command = nil, &block) ⇒ Object
-
.read_open_memory(string, command = nil, &block) ⇒ Object
-
.read_open_stream(reader, &block) ⇒ Object
-
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in.
-
.version_number ⇒ Object
-
.version_string ⇒ Object
-
.write_open_filename(file_name, compression, format, &block) ⇒ Object
-
.write_open_memory(string, compression, format, &block) ⇒ Object
Class Method Details
.libpath(*args) ⇒ Object
Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/ffi-libarchive.rb', line 11
def self.libpath(*args)
rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
if block_given?
begin
$LOAD_PATH.unshift LIBPATH
rv = yield
ensure
$LOAD_PATH.shift
end
end
rv
end
|
.path(*args) ⇒ Object
Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/ffi-libarchive.rb', line 28
def self.path(*args)
rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
if block_given?
begin
$LOAD_PATH.unshift PATH
rv = yield
ensure
$LOAD_PATH.shift
end
end
rv
end
|
.read_open_filename(file_name, command = nil, &block) ⇒ Object
283
284
285
|
# File 'lib/ffi-libarchive/archive.rb', line 283
def self.read_open_filename(file_name, command = nil, &block)
Reader.open_filename file_name, command, &block
end
|
.read_open_memory(string, command = nil, &block) ⇒ Object
287
288
289
|
# File 'lib/ffi-libarchive/archive.rb', line 287
def self.read_open_memory(string, command = nil, &block)
Reader.open_memory string, command, &block
end
|
.read_open_stream(reader, &block) ⇒ Object
291
292
293
|
# File 'lib/ffi-libarchive/archive.rb', line 291
def self.read_open_stream(reader, &block)
Reader.open_stream reader, &block
end
|
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.
46
47
48
49
50
51
52
53
|
# File 'lib/ffi-libarchive.rb', line 46
def self.require_all_libs_relative_to(fname, dir = nil)
dir ||= ::File.basename(fname, ".*")
search_me = ::File.expand_path(
::File.join(::File.dirname(fname), dir, "**", "*.rb")
)
Dir.glob(search_me).sort.each { |rb| require rb }
end
|
.version_number ⇒ Object
303
304
305
|
# File 'lib/ffi-libarchive/archive.rb', line 303
def self.version_number
C.archive_version_number
end
|
.version_string ⇒ Object
307
308
309
|
# File 'lib/ffi-libarchive/archive.rb', line 307
def self.version_string
C.archive_version_string
end
|
.write_open_filename(file_name, compression, format, &block) ⇒ Object
295
296
297
|
# File 'lib/ffi-libarchive/archive.rb', line 295
def self.write_open_filename(file_name, compression, format, &block)
Writer.open_filename file_name, compression, format, &block
end
|
.write_open_memory(string, compression, format, &block) ⇒ Object
299
300
301
|
# File 'lib/ffi-libarchive/archive.rb', line 299
def self.write_open_memory(string, compression, format, &block)
Writer.open_memory string, compression, format, &block
end
|