archive 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +13 -3
- data/lib/archive.rb +14 -10
- data/lib/archive/extract.rb +3 -3
- data/lib/archive/libarchive.rb +22 -1
- data/lib/archive/version.rb +1 -1
- metadata +3 -3
- data/test.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8573b5dc0a8783ecd5519bef313fab1a86ce6920
|
4
|
+
data.tar.gz: 59a004ca0682e4601c730cd4a753b5a1e0bd33fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ac13f3f8b58920f3e99e4996634cfe3321610a8063e1aff7913f1c374a975f0c3659da773edfe522e1e16e540d435d5749d60c55abf7f537f9bedff8a724f84
|
7
|
+
data.tar.gz: 1efd78f10a7c0eba26889a04bc4b3fd40d5b573499a96c8e62d66f458b3380c368654e584f482f8ded6d3cdcd2e98a1d9cfaa2efa96bbb415e0c86052db4aa51
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -67,6 +67,7 @@ We have verified that archive works as intended on these platforms:
|
|
67
67
|
|
68
68
|
* Mac OS X 10.8
|
69
69
|
* Ubuntu Linux 12.04 LTS
|
70
|
+
* FreeBSD 9
|
70
71
|
|
71
72
|
And these Rubies:
|
72
73
|
|
@@ -74,10 +75,19 @@ And these Rubies:
|
|
74
75
|
* 2.0.0
|
75
76
|
* JRuby 1.7 with Java 7
|
76
77
|
|
78
|
+
It does not work on these platforms:
|
79
|
+
|
80
|
+
* SmartOS "base64 1.9.1". The version of libarchive they distribute via pkgsrc
|
81
|
+
is broken, see this URL:
|
82
|
+
|
83
|
+
http://freebsd.1045724.n5.nabble.com/Extracting-tgz-file-Attempt-to-write-to-an-empty-file-td3910927.html
|
84
|
+
|
85
|
+
Regardless, installing a newer libarchive by hand will likely fix this issue.
|
86
|
+
|
77
87
|
Please let us know if your operating system isn't working! It'll likely
|
78
|
-
complain about a
|
79
|
-
systems. We just need to know what platform you're on
|
80
|
-
ourselves to move forward. Thanks!
|
88
|
+
complain about a part of a structure in a syscall called `stat` which varies
|
89
|
+
wildly on different POSIX systems. We just need to know what platform you're on
|
90
|
+
and how we can install it ourselves to move forward. Thanks!
|
81
91
|
|
82
92
|
## Contributing
|
83
93
|
|
data/lib/archive.rb
CHANGED
@@ -60,20 +60,24 @@ module Archive
|
|
60
60
|
Archive::Compress.new(filename, args).compress(get_files(dir), true)
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
class << self
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
protected
|
66
|
+
|
67
|
+
#
|
68
|
+
# Finds the files for the dir passed to ::compress.
|
69
|
+
#
|
70
|
+
def get_files(dir)
|
71
|
+
require 'find'
|
72
|
+
|
73
|
+
files = []
|
70
74
|
|
71
|
-
|
75
|
+
Find.find(dir) do |path|
|
76
|
+
files.push(path) if File.file?(path)
|
77
|
+
end
|
72
78
|
|
73
|
-
|
74
|
-
files.push(path) if File.file?(path)
|
79
|
+
return files
|
75
80
|
end
|
76
81
|
|
77
|
-
return files
|
78
82
|
end
|
79
83
|
end
|
data/lib/archive/extract.rb
CHANGED
@@ -93,8 +93,8 @@ module Archive # :nodoc:
|
|
93
93
|
def unpack_loop # :nodoc:
|
94
94
|
loop do
|
95
95
|
buffer = FFI::MemoryPointer.new :pointer, 1
|
96
|
-
size = FFI::MemoryPointer.new :
|
97
|
-
offset = FFI::MemoryPointer.new :long_long
|
96
|
+
size = FFI::MemoryPointer.new :ulong_long, 1
|
97
|
+
offset = FFI::MemoryPointer.new :long_long, 1
|
98
98
|
|
99
99
|
result = LibArchive.archive_read_data_block(@in, buffer, size, offset)
|
100
100
|
|
@@ -104,7 +104,7 @@ module Archive # :nodoc:
|
|
104
104
|
raise LibArchive.archive_error_string(@in)
|
105
105
|
end
|
106
106
|
|
107
|
-
result = LibArchive.archive_write_data_block(@out, buffer.
|
107
|
+
result = LibArchive.archive_write_data_block(@out, buffer.read_pointer, size.read_ulong_long, offset.read_long_long);
|
108
108
|
|
109
109
|
if result != LibArchive::ARCHIVE_OK
|
110
110
|
raise LibArchive.archive_error_string(@out)
|
data/lib/archive/libarchive.rb
CHANGED
@@ -33,6 +33,27 @@ module Archive # :nodoc:
|
|
33
33
|
:st_lspare, :long,
|
34
34
|
:st_qspare, :long_long
|
35
35
|
)
|
36
|
+
elsif ::FFI::Platform.bsd?
|
37
|
+
layout(
|
38
|
+
:st_dev, :dev_t,
|
39
|
+
:st_ino, :ino_t,
|
40
|
+
:st_mode, :mode_t,
|
41
|
+
:st_nlink, :nlink_t,
|
42
|
+
:st_uid, :uid_t,
|
43
|
+
:st_gid, :gid_t,
|
44
|
+
:st_rdev, :dev_t,
|
45
|
+
:st_atimespec, Timespec,
|
46
|
+
:st_mtimespec, Timespec,
|
47
|
+
:st_ctimespec, Timespec,
|
48
|
+
:st_size, :off_t,
|
49
|
+
:st_blocks, :long_long,
|
50
|
+
:st_blksize, :ulong_long,
|
51
|
+
:st_flags, :ulong,
|
52
|
+
:st_gen, :ulong,
|
53
|
+
:st_lspare, :long,
|
54
|
+
:st_birthtimespec, Timespec,
|
55
|
+
:st_qspare, :long_long
|
56
|
+
)
|
36
57
|
else
|
37
58
|
layout(
|
38
59
|
:st_dev, :dev_t,
|
@@ -46,7 +67,7 @@ module Archive # :nodoc:
|
|
46
67
|
:st_mtimespec, Timespec,
|
47
68
|
:st_ctimespec, Timespec,
|
48
69
|
:st_size, :off_t,
|
49
|
-
:st_blocks, :
|
70
|
+
:st_blocks, :blkcnt_t,
|
50
71
|
:st_blksize, :ulong,
|
51
72
|
:st_flags, :ulong,
|
52
73
|
:st_gen, :ulong
|
data/lib/archive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Hollensbe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -144,6 +144,7 @@ extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
146
|
- .gitignore
|
147
|
+
- CHANGELOG.md
|
147
148
|
- Gemfile
|
148
149
|
- Guardfile
|
149
150
|
- LICENSE.txt
|
@@ -155,7 +156,6 @@ files:
|
|
155
156
|
- lib/archive/extract.rb
|
156
157
|
- lib/archive/libarchive.rb
|
157
158
|
- lib/archive/version.rb
|
158
|
-
- test.rb
|
159
159
|
homepage: https://github.com/erikh/archive
|
160
160
|
licenses:
|
161
161
|
- MIT
|
data/test.rb
DELETED