archive-ar 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.travis.yml +5 -0
- data/README.md +7 -1
- data/Rakefile +5 -0
- data/archive-ar.gemspec +1 -0
- data/lib/archive/ar/format.rb +16 -4
- data/lib/archive/ar/version.rb +1 -1
- data/spec/fixtures/test-long.ar +4 -0
- data/spec/lib/archive/ar/format_spec.rb +1 -1
- data/spec/lib/archive/ar/reader_spec.rb +8 -8
- data/spec/spec_helper.rb +3 -0
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjE2YTE3NjI5ZDg5YTRkYmI1ZWM0YTdmZGNlMGI1YmU3MTEwZmIyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWE1ZmQ0MmVjZmM4M2ZmZmIzYzFlZDgxNDcyZDI1NzY4ZDI5YzkxMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzRmODk0Njg4NzJmMzU3NGViMDAwYTg2NTQxOTllMThjMDQxNDIwZTdmMDA1
|
10
|
+
ZGUwNTk4YTFjNjQxZGRiZjc1ZDRkMzJjNTQ5ZGExZmI2Y2FlYjViYTY0MDdi
|
11
|
+
YzZjYzA0Y2ZhYjVkYzhjOWU1MDA1NjJkYTcxY2ExM2M5ODA2YmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjgzMDczYTJmMWY4NDFmMjU1MDgzMGMxNGFlMmYyMDgyYzk0NzQ5YzVmY2Rh
|
14
|
+
ZjE1MmEzNjVhYzUyYzFkMWZhNzYzZWEwNmZjZjJlNGUyYTM4NjQ0MTRkZDBi
|
15
|
+
MmMzY2YyOTZkZWExZTdkZDQxZmQxM2ZlZDdjY2NiZDBkNmRhMjc=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Archive::Ar
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/archive-ar)
|
4
|
+
[](https://travis-ci.org/jbussdieker/ruby-archive-ar)
|
5
|
+
[](https://codeclimate.com/github/jbussdieker/ruby-archive-ar)
|
6
|
+
[](https://coveralls.io/r/jbussdieker/ruby-archive-ar)
|
7
|
+
[](https://gemnasium.com/jbussdieker/ruby-archive-ar)
|
8
|
+
|
9
|
+
Simple AR file functions
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
data/Rakefile
CHANGED
data/archive-ar.gemspec
CHANGED
data/lib/archive/ar/format.rb
CHANGED
@@ -8,21 +8,33 @@ module Archive
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
h = block.unpack("A16 Z12 a6 a6 A8 Z10 Z2")
|
11
|
+
def parse_header(data)
|
12
|
+
h = data.unpack("A16 Z12 a6 a6 A8 Z10 Z2")
|
14
13
|
{
|
15
14
|
:name => h.shift,
|
16
15
|
:modified => Time.at(h.shift.to_i),
|
17
16
|
:owner => h.shift.to_i,
|
18
17
|
:group => h.shift.to_i,
|
19
18
|
:mode => h.shift.to_i(8),
|
20
|
-
:start => io.tell,
|
21
19
|
:size => h.shift.to_i,
|
22
20
|
:magic => h.shift,
|
23
21
|
}
|
24
22
|
end
|
25
23
|
|
24
|
+
def read_header(io)
|
25
|
+
block = io.read(60)
|
26
|
+
header = parse_header(block)
|
27
|
+
header.merge! :start => io.tell
|
28
|
+
|
29
|
+
if header[:name].start_with? "#1/"
|
30
|
+
long_size = header[:name][3..-1].to_i
|
31
|
+
header[:start] += long_size
|
32
|
+
header[:name] = io.read(long_size).strip
|
33
|
+
end
|
34
|
+
|
35
|
+
header
|
36
|
+
end
|
37
|
+
|
26
38
|
def extract_file(dest_dir, header, data, options = {})
|
27
39
|
file = File.join(dest_dir, header[:name])
|
28
40
|
|
data/lib/archive/ar/version.rb
CHANGED
@@ -26,14 +26,14 @@ describe Archive::Ar::Reader do
|
|
26
26
|
let(:io) { StringIO.new("!<arch>\nGemfile 1399095295 501 20 100644 95 `\nASDF") }
|
27
27
|
it {
|
28
28
|
should == { "Gemfile" => [{
|
29
|
-
name
|
30
|
-
modified
|
31
|
-
owner
|
32
|
-
group
|
33
|
-
mode
|
34
|
-
start
|
35
|
-
size
|
36
|
-
magic
|
29
|
+
:name => "Gemfile",
|
30
|
+
:modified => Time.at(1399095295),
|
31
|
+
:owner => 501,
|
32
|
+
:group => 20,
|
33
|
+
:mode => "100644".to_i(8),
|
34
|
+
:start => 68,
|
35
|
+
:size => 95,
|
36
|
+
:magic => "`\n",
|
37
37
|
}, "ASDF"]}
|
38
38
|
}
|
39
39
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archive-ar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua B. Bussdieker
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
- jbussdieker@gmail.com
|
@@ -62,6 +76,7 @@ extra_rdoc_files: []
|
|
62
76
|
files:
|
63
77
|
- .gitignore
|
64
78
|
- .rspec
|
79
|
+
- .travis.yml
|
65
80
|
- Gemfile
|
66
81
|
- LICENSE.txt
|
67
82
|
- README.md
|
@@ -73,6 +88,7 @@ files:
|
|
73
88
|
- lib/archive/ar/reader.rb
|
74
89
|
- lib/archive/ar/version.rb
|
75
90
|
- lib/archive/ar/writer.rb
|
91
|
+
- spec/fixtures/test-long.ar
|
76
92
|
- spec/fixtures/test.ar
|
77
93
|
- spec/lib/archive/ar/format_spec.rb
|
78
94
|
- spec/lib/archive/ar/reader_spec.rb
|
@@ -103,6 +119,7 @@ signing_key:
|
|
103
119
|
specification_version: 4
|
104
120
|
summary: Simple AR file functions
|
105
121
|
test_files:
|
122
|
+
- spec/fixtures/test-long.ar
|
106
123
|
- spec/fixtures/test.ar
|
107
124
|
- spec/lib/archive/ar/format_spec.rb
|
108
125
|
- spec/lib/archive/ar/reader_spec.rb
|