archive-ar 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmEwMzBjZGVmZTJmOTJlN2VmMjc5ZDI5ZDA1ODQ4MTE2YTA5MzdmYg==
4
+ YjE2YTE3NjI5ZDg5YTRkYmI1ZWM0YTdmZGNlMGI1YmU3MTEwZmIyNw==
5
5
  data.tar.gz: !binary |-
6
- M2VhYmEzNWRhYTFjMWEyNTFhMzQyZjljNzEzOTljNTE1MDQwZmVjNg==
6
+ OWE1ZmQ0MmVjZmM4M2ZmZmIzYzFlZDgxNDcyZDI1NzY4ZDI5YzkxMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2YyNTk2NTU3OTlhMzliMWRhNjYxMGU3NTJiYjYwZmIxNmE5ZTg4OTUxN2Zj
10
- ZWFkMTBmZmJlYzBhNzlhZjg4NjRhMjE4NWVlNWY3Y2FhODhmYTdlOGQ4MmMz
11
- MDgwNGMyNjkyM2M5MTAyZjg3NTNlYTkzZGJiODQ1NDBiMDA4ZWU=
9
+ YzRmODk0Njg4NzJmMzU3NGViMDAwYTg2NTQxOTllMThjMDQxNDIwZTdmMDA1
10
+ ZGUwNTk4YTFjNjQxZGRiZjc1ZDRkMzJjNTQ5ZGExZmI2Y2FlYjViYTY0MDdi
11
+ YzZjYzA0Y2ZhYjVkYzhjOWU1MDA1NjJkYTcxY2ExM2M5ODA2YmU=
12
12
  data.tar.gz: !binary |-
13
- MTVhMmU2YTQ5ZmIxNTBhM2MxYWViZjI3MjNjMDU1ZTIyNDY4MjBmZDk5YWMy
14
- OTQ4MTc1YjI5ODRkZjA3ZDM2OTQ1ZDJmYmY4NDFkYmQ4MzMyMDZkNTc1MTQ2
15
- NjYzY2FkZDY2ZTc2NDRiNDNhMjVkNjQxMjg1ZjE0MTM4YjUxYTc=
13
+ ZjgzMDczYTJmMWY4NDFmMjU1MDgzMGMxNGFlMmYyMDgyYzk0NzQ5YzVmY2Rh
14
+ ZjE1MmEzNjVhYzUyYzFkMWZhNzYzZWEwNmZjZjJlNGUyYTM4NjQ0MTRkZDBi
15
+ MmMzY2YyOTZkZWExZTdkZDQxZmQxM2ZlZDdjY2NiZDBkNmRhMjc=
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.3
5
+ - 2.1.1
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Archive::Ar
2
2
 
3
- TODO: Write a gem description
3
+ [![Gem Version](https://badge.fury.io/rb/archive-ar.svg)](http://badge.fury.io/rb/archive-ar)
4
+ [![Build Status](https://travis-ci.org/jbussdieker/ruby-archive-ar.svg)](https://travis-ci.org/jbussdieker/ruby-archive-ar)
5
+ [![Code Climate](https://codeclimate.com/github/jbussdieker/ruby-archive-ar.png)](https://codeclimate.com/github/jbussdieker/ruby-archive-ar)
6
+ [![Coverage Status](https://coveralls.io/repos/jbussdieker/ruby-archive-ar/badge.png)](https://coveralls.io/r/jbussdieker/ruby-archive-ar)
7
+ [![Dependency Status](https://gemnasium.com/jbussdieker/ruby-archive-ar.svg)](https://gemnasium.com/jbussdieker/ruby-archive-ar)
8
+
9
+ Simple AR file functions
4
10
 
5
11
  ## Installation
6
12
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "bundler", "~> 1.5"
21
21
  spec.add_development_dependency "rake"
22
22
  spec.add_development_dependency "rspec"
23
+ spec.add_development_dependency "coveralls"
23
24
  end
@@ -8,21 +8,33 @@ module Archive
8
8
  end
9
9
  end
10
10
 
11
- def read_header(io)
12
- block = io.read(60)
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
 
@@ -1,5 +1,5 @@
1
1
  module Archive
2
2
  module Ar
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,4 @@
1
+ !<arch>
2
+ #1/32 1399147683 501 20 100644 43 `
3
+ aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbtestin1234
4
+
@@ -31,7 +31,7 @@ describe Archive::Ar::Format do
31
31
  :modified=>Time.parse("2014-05-02 22:34:55 -0700"),
32
32
  :owner=>1234,
33
33
  :group=>5678,
34
- :mode=>"100644",
34
+ :mode=>"100644".to_i(8),
35
35
  :start=>60,
36
36
  :size=>95,
37
37
  :magic=>"`\n"
@@ -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: "Gemfile",
30
- modified: Time.at(1399095295),
31
- owner: 501,
32
- group: 20,
33
- mode: "100644",
34
- start: 68,
35
- size: 95,
36
- magic: "`\n",
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
@@ -1 +1,4 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'archive/ar'
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.2
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