tarchiver 0.0.1 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6180fe43dfd6909c32975d09b89a9a33a18d45d7
4
- data.tar.gz: f36f89ad4900c7632e497dd567b162e16413f2d8
3
+ metadata.gz: 8109fccb04d4cdff7ec97004738b9c24245fe020
4
+ data.tar.gz: 235d2278a48c5cc46229d82ed267bb69ca365b9d
5
5
  SHA512:
6
- metadata.gz: 43ad4c3a938a306da6ac64f1bfdc7ac896dbb1be8a43745f14ee5387a259e7b5e9094903369e60fe9f0cd1cd4a2c6b3f56c23e6f7c81b3fa5136ce1119d9983a
7
- data.tar.gz: 4da6a0c535365172ef2168676f8d648ed7467dc3301fc05c1a0b4a68a938b065a89e0c5e7efe005972c47721c5ed817aa4272b9901e0d333ab31290c3d8318a8
6
+ metadata.gz: 37acc7b6c3751f74824bb4b81436dab3d7654483ee0896b072ce4786a6130dea108816ee76d9c10baff5388469afd803c628ffd5415b692f05229409ee031285
7
+ data.tar.gz: ca7c8efae324d61e69df848adbccc249e5917156201d9df0298ae8ae7b7e58b46e7adbced2a689cccf37da7a54397a3e44b60eabb1550c708d0db8a6e294aca3
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'simplecov', :require => false, :group => :test
4
+ gem 'coveralls', :require => false, :group => :test
4
5
 
5
6
  # Specify your gem's dependencies in tarchiver.gemspec
6
7
  gemspec
@@ -6,11 +6,27 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ coveralls (0.8.2)
10
+ json (~> 1.8)
11
+ rest-client (>= 1.6.8, < 2)
12
+ simplecov (~> 0.10.0)
13
+ term-ansicolor (~> 1.3)
14
+ thor (~> 0.19.1)
9
15
  diff-lcs (1.2.5)
10
16
  docile (1.1.5)
17
+ domain_name (0.5.24)
18
+ unf (>= 0.0.5, < 1.0.0)
19
+ http-cookie (1.0.2)
20
+ domain_name (~> 0.5)
11
21
  json (1.8.3)
12
22
  json (1.8.3-java)
23
+ mime-types (2.6.2)
24
+ netrc (0.10.3)
13
25
  rake (10.4.2)
26
+ rest-client (1.8.0)
27
+ http-cookie (>= 1.0.2, < 2.0)
28
+ mime-types (>= 1.16, < 3.0)
29
+ netrc (~> 0.7)
14
30
  rspec (3.3.0)
15
31
  rspec-core (~> 3.3.0)
16
32
  rspec-expectations (~> 3.3.0)
@@ -29,6 +45,14 @@ GEM
29
45
  json (~> 1.8)
30
46
  simplecov-html (~> 0.10.0)
31
47
  simplecov-html (0.10.0)
48
+ term-ansicolor (1.3.2)
49
+ tins (~> 1.0)
50
+ thor (0.19.1)
51
+ tins (1.6.0)
52
+ unf (0.1.4)
53
+ unf_ext
54
+ unf (0.1.4-java)
55
+ unf_ext (0.0.7.1)
32
56
 
33
57
  PLATFORMS
34
58
  java
@@ -36,7 +60,11 @@ PLATFORMS
36
60
 
37
61
  DEPENDENCIES
38
62
  bundler (~> 1.7)
63
+ coveralls
39
64
  rake (~> 10.0)
40
65
  rspec
41
66
  simplecov
42
67
  tarchiver!
68
+
69
+ BUNDLED WITH
70
+ 1.10.6
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  [![Build Status](https://travis-ci.org/bartkamphorst/tarchiver.svg?branch=master)](https://travis-ci.org/bartkamphorst/tarchiver)
2
+ [![Coverage Status](https://coveralls.io/repos/bartkamphorst/tarchiver/badge.svg?branch=master&service=github)](https://coveralls.io/github/bartkamphorst/tarchiver?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/tarchiver.png)](http://badge.fury.io/rb/tarchiver)
2
4
 
3
5
  # Tarchiver
4
6
 
5
- A high-level tar and tgz archiver.
7
+ A high-level tar and tgz archiver. Designed for ease of use with acceptable memory footprint (reading and writing in blocks of configurable size).
6
8
 
7
9
  ## Installation
8
10
 
@@ -24,14 +26,40 @@ Or install it yourself as:
24
26
  ### Archiving
25
27
  ```ruby
26
28
  Tarchiver::Archiver.archive(archive_dir) # outputs archive to working directory
29
+ # Returns archive path on success and nil on failure, unless options[:raise_errors] is enabled
27
30
  Tarchiver::Archiver.archive(archive_dir, output_dir, options)
28
31
  ```
29
32
  ### Unarchiving
30
33
  ```ruby
31
- Tarchiver::Archiver.unarchive(archive_path) #outputs output to working directory
34
+ Tarchiver::Archiver.unarchive(archive_path) # outputs output to working directory
35
+ # Returns output path on success and nil on failure, unless options[:raise_errors] is enabled
32
36
  Tarchiver::Archiver.unarchive(archive_path, unpack_path, options)
33
37
  ```
34
38
 
39
+ ### Options
40
+ ```ruby
41
+ {
42
+ delete_input_on_success: false,
43
+ blocksize: 1024000,
44
+ verbose: false,
45
+ content_only: false,
46
+ relative_to_top_dir: true,
47
+ custom_archive_name: nil,
48
+ archive_type: :tgz,
49
+ compressor: Tarchiver::Gzipper,
50
+ add_timestamp: false,
51
+ raise_errors: false
52
+ }
53
+ ```
54
+ See Tarchiver::Constants.
55
+
56
+ ### Custom Compressor
57
+
58
+ 1. Subclass Tarchiver::Compressor (MyCompressor < Tarchiver::Compressor)
59
+ 2. Implement `compress` and `open` class methods
60
+ 3. Set options[:compressor] to MyCompressor
61
+ 4. Profit
62
+
35
63
  ## Contributing
36
64
 
37
65
  1. Fork it ( https://github.com/bartkamphorst/tarchiver/fork )
@@ -11,7 +11,7 @@ module Tarchiver
11
11
  archive_name, relative_to, to_archive = Tarchiver::Helpers.sanitize_input(archive_input, options)
12
12
 
13
13
  return Tarchiver::Helpers.terminate(nil, options) unless archive_name
14
- archive_path = File.join(output_directory, archive_name)
14
+ archive_path = ::File.join(output_directory, archive_name)
15
15
 
16
16
  # Prepare for tarballing
17
17
  puts messages[:start_archiving] if options[:verbose]
@@ -43,7 +43,7 @@ module Tarchiver
43
43
  puts messages[:completed_archiving] if options[:verbose]
44
44
 
45
45
  # Return
46
- File.exists?(compressed_archive_path) ? compressed_archive_path : Tarchiver::Helpers.terminate(nil, options)
46
+ ::File.exists?(compressed_archive_path) ? compressed_archive_path : Tarchiver::Helpers.terminate(nil, options)
47
47
  end # archive
48
48
 
49
49
  def self.unarchive(archive, output_directory='.', opts={})
@@ -52,22 +52,22 @@ module Tarchiver
52
52
  begin
53
53
  io = case archive_type
54
54
  when :tar
55
- File.open(archive)
55
+ ::File.open(archive)
56
56
  when :compressed
57
57
  options[:compressor].open(archive)
58
58
  end
59
59
 
60
60
  Gem::Package::TarReader.new(io) do |tar|
61
61
  tar.each do |entry|
62
- dir = File.join(output_directory, File.dirname(entry.full_name))
63
- path = File.join(output_directory, entry.full_name)
62
+ dir = ::File.join(output_directory, ::File.dirname(entry.full_name))
63
+ path = ::File.join(output_directory, entry.full_name)
64
64
  if entry.directory?
65
65
  FileUtils.mkdir_p(dir, mode: entry.header.mode, verbose: false)
66
66
  elsif entry.header.typeflag == '2' #Symlink!
67
- File.symlink(entry.header.linkname, path)
67
+ ::File.symlink(entry.header.linkname, path)
68
68
  elsif entry.file?
69
- FileUtils.mkdir_p(dir, verbose: false) unless File.directory?(dir)
70
- File.open(path, "wb") do |file|
69
+ FileUtils.mkdir_p(dir, verbose: false) unless ::File.directory?(dir)
70
+ ::File.open(path, "wb") do |file|
71
71
  while buffer = entry.read(options[:blocksize])
72
72
  file.write(buffer)
73
73
  end
@@ -76,7 +76,7 @@ module Tarchiver
76
76
  end
77
77
  end
78
78
  end
79
- File.delete(archive) if File.exists?(archive) && options[:delete_input_on_success]
79
+ ::File.delete(archive) if ::File.exists?(archive) && options[:delete_input_on_success]
80
80
  output_directory
81
81
  rescue => error
82
82
  puts "#{messages[:failed_archiving]}\n#{error.message}" if options[:verbose]
@@ -5,7 +5,7 @@ module Tarchiver
5
5
  tgz_path = "#{archive_path}.tgz"
6
6
  begin
7
7
  Zlib::GzipWriter.open(tgz_path) do |gz|
8
- File.open(tar_path, "rb") do |tar|
8
+ ::File.open(tar_path, "rb") do |tar|
9
9
  while buffer = tar.read(options[:blocksize])
10
10
  gz.write(buffer)
11
11
  end
@@ -25,6 +25,7 @@ module Tarchiver
25
25
  verbose: false,
26
26
  content_only: false,
27
27
  relative_to_top_dir: true,
28
+ create_sub_archives: false,
28
29
  custom_archive_name: nil,
29
30
  archive_type: :tgz,
30
31
  compressor: Tarchiver::Gzipper,
@@ -6,14 +6,14 @@ module Tarchiver
6
6
  archive_name = self.determine_archive_name(input, :enumerable, options)
7
7
  to_archive = input
8
8
  relative_to = nil
9
- elsif File.file?(input)
9
+ elsif ::File.file?(input)
10
10
  archive_name = self.determine_archive_name(input, :file, options)
11
11
  to_archive = [input]
12
- relative_to = File.basename(input)
13
- elsif File.directory?(input)
12
+ relative_to = ::File.basename(input)
13
+ elsif ::File.directory?(input)
14
14
  archive_name = self.determine_archive_name(input, :directory, options)
15
- to_archive = Dir.glob(File.join(input, '**', '*'), File::FNM_DOTMATCH)
16
- relative_to = File.basename(input)
15
+ to_archive = ::Dir.glob(File.join(input, '**', '*'), ::File::FNM_DOTMATCH)
16
+ relative_to = ::File.basename(input)
17
17
  else
18
18
  terminate(ArgumentError.new(Tarchiver::Constants::MESSAGES[:input_not_sane]), options)
19
19
  end
@@ -29,7 +29,7 @@ module Tarchiver
29
29
  end
30
30
 
31
31
  def self.prepare_for_tarchiving(archive_path)
32
- FileUtils.mkdir_p(File.dirname(archive_path), verbose: false) unless File.directory?(File.dirname(archive_path))
32
+ FileUtils.mkdir_p(File.dirname(archive_path), verbose: false) unless ::File.directory?(::File.dirname(archive_path))
33
33
  end
34
34
 
35
35
  def self.determine_archive_name(input, input_type, options)
@@ -39,7 +39,7 @@ module Tarchiver
39
39
  if input_type == :enumerable
40
40
  name = Tarchiver::Constants::DEFAULT_ARCHIVE_NAME
41
41
  else
42
- name = File.basename(input)
42
+ name = ::File.basename(input)
43
43
  end
44
44
  options[:add_timestamp] ? "#{name}-#{Time.now.to_i}" : name
45
45
  end
@@ -54,7 +54,7 @@ module Tarchiver
54
54
  end
55
55
 
56
56
  def self.cleanup(archive_input, tar_path, options)
57
- File.delete(tar_path) if tar_path && File.exists?(tar_path)
57
+ ::File.delete(tar_path) if tar_path && ::File.exists?(tar_path)
58
58
  FileUtils.rm_rf(archive_input) if options[:delete_input_on_success]
59
59
  end
60
60
 
@@ -2,25 +2,31 @@ module Tarchiver
2
2
  class Tarballer
3
3
 
4
4
  def self.tar(to_archive, archive_name, relative_to, output_directory='.', options)
5
- archive_path = File.join(output_directory, "#{archive_name}.tar")
5
+ archive_path = ::File.join(output_directory, "#{archive_name}.tar")
6
+ enumerable = relative_to.nil?
6
7
  begin
7
- File.open(archive_path, "wb") do |file|
8
+ ::File.open(archive_path, "wb") do |file|
8
9
  Gem::Package::TarWriter.new(file) do |tar|
9
10
  to_archive.each do |entry|
11
+ if enumerable
12
+ # Enumerable input, determine relative_to on the fly
13
+ relative_to = ::File.directory?(entry) ? ::File.basename(entry) : ::File.basename(::File.dirname(entry))
14
+ end
10
15
  next if entry.match(/\.+$/)
11
- if archive_name == Tarchiver::Constants::DEFAULT_ARCHIVE_NAME || options[:relative_to_top_dir] == false
16
+ # if archive_name == Tarchiver::Constants::DEFAULT_ARCHIVE_NAME || options[:relative_to_top_dir] == false
17
+ if options[:relative_to_top_dir] == false
12
18
  path = entry
13
19
  else
14
20
  path = entry.match(/#{relative_to}.*/).to_s
15
21
  path = path.match(/#{relative_to}\/(.*)$/)[1] if options[:contents_only]
16
22
  end
17
- mode = File.stat(entry).mode
18
- if File.directory?(entry)
23
+ mode = ::File.stat(entry).mode
24
+ if ::File.directory?(entry)
19
25
  tar.mkdir(path, mode)
20
26
  else
21
27
  tar.add_file(path, mode) do |io|
22
28
  # Read file and write in chunks
23
- File.open(entry, 'rb') do |file|
29
+ ::File.open(entry, 'rb') do |file|
24
30
  while buffer = file.read(options[:blocksize])
25
31
  io.write(buffer)
26
32
  end
@@ -1,3 +1,3 @@
1
1
  module Tarchiver
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -3,14 +3,14 @@ require 'spec_helper'
3
3
  describe Tarchiver::Archiver do
4
4
 
5
5
  before(:each) do
6
- @tmp_dir = Dir.mktmpdir("tarchiver-rspec")
7
- @unpack_path = File.join(@tmp_dir, 'unpacked')
6
+ @tmp_dir = ::Dir.mktmpdir("tarchiver-rspec")
7
+ @unpack_path = ::File.join(@tmp_dir, 'unpacked')
8
8
  FileUtils.mkdir_p(@unpack_path)
9
9
  end
10
10
 
11
- let(:test_dir_src) {File.join(File.dirname(__FILE__), 'fixtures', 'test_dir')}
12
- let(:archive_dir) {FileUtils.cp_r(test_dir_src, @tmp_dir); File.join(@tmp_dir, 'test_dir')}
13
- let(:file_path) {File.join(archive_dir, 'deconstructions.txt') }
11
+ let(:test_dir_src) {::File.join(::File.dirname(__FILE__), 'fixtures', 'test_dir')}
12
+ let(:archive_dir) {FileUtils.cp_r(test_dir_src, @tmp_dir); ::File.join(@tmp_dir, 'test_dir')}
13
+ let(:file_path) {::File.join(archive_dir, 'deconstructions.txt') }
14
14
 
15
15
  context "archiving" do
16
16
 
@@ -63,7 +63,7 @@ describe Tarchiver::Archiver do
63
63
 
64
64
  it 'returns filepath on success' do
65
65
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, options)
66
- expect(archive_path).to eq(File.join(@tmp_dir, 'test_dir.tar'))
66
+ expect(archive_path).to eq(::File.join(@tmp_dir, 'test_dir.tar'))
67
67
  end
68
68
 
69
69
  it 'only includes the top directory of absolute paths' do
@@ -77,6 +77,19 @@ describe Tarchiver::Archiver do
77
77
  expect(inspect_archive(archive_path)).to include(/^.*homer-excited.png$/)
78
78
  end
79
79
 
80
+ it 'only includes the top directory of absolute paths when input is Enumerable' do
81
+ enum = Dir.glob(File.join(archive_dir, '*')).delete_if{|entry| ! entry.match(/txt$/)}
82
+ archive_path = Tarchiver::Archiver.archive(enum, @tmp_dir, options)
83
+ expect(inspect_archive(archive_path)).to include(/^test_dir.+postpatriarchialist.txt$/)
84
+ end
85
+
86
+ it 'includes absolute paths when input is Enumerable' do
87
+ opts = options.merge({relative_to_top_dir: false})
88
+ enum = Dir.glob(File.join(archive_dir, '*')).delete_if{|entry| ! entry.match(/txt$/)}
89
+ archive_path = Tarchiver::Archiver.archive(enum, @tmp_dir, opts)
90
+ expect(inspect_archive(archive_path)).to include(/#{@tmp_dir}.+postpatriarchialist.txt$/)
91
+ end
92
+
80
93
  it 'only includes the contents of a directory' do
81
94
  opts = options.merge({contents_only: true, add_timestamp: true})
82
95
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, opts)
@@ -84,21 +97,21 @@ describe Tarchiver::Archiver do
84
97
  end
85
98
 
86
99
  it 'includes symlinks' do
87
- FileUtils.ln_s(File.join(archive_dir, 'materialist.txt'), File.join(archive_dir, 'symlink_to_materialist.txt'))
100
+ FileUtils.ln_s(::File.join(archive_dir, 'materialist.txt'), File.join(archive_dir, 'symlink_to_materialist.txt'))
88
101
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, options)
89
102
  expect(inspect_archive(archive_path)).to include(/symlink_to_materialist.txt$/)
90
- File.unlink(File.join(archive_dir, 'symlink_to_materialist.txt'))
103
+ ::File.unlink(::File.join(archive_dir, 'symlink_to_materialist.txt'))
91
104
  end
92
105
 
93
106
  it 'returns nil on failure' do
94
- archive_path = Tarchiver::Archiver.archive(File.join(archive_dir, 'nonexistent'), @tmp_dir, options)
107
+ archive_path = Tarchiver::Archiver.archive(::File.join(archive_dir, 'nonexistent'), @tmp_dir, options)
95
108
  expect(archive_path).to be_nil
96
109
  end
97
110
 
98
111
  it 'raises errors if raising is enabled' do
99
112
  opts = options.merge({raise_errors: true})
100
- expect{ Tarchiver::Archiver.archive(File.join(archive_dir, 'nonexistent'), @tmp_dir, opts) }.to raise_error(ArgumentError)
101
- unwritable_dir = File.join(@tmp_dir, 'unwritable')
113
+ expect{ Tarchiver::Archiver.archive(::File.join(archive_dir, 'nonexistent'), @tmp_dir, opts) }.to raise_error(ArgumentError)
114
+ unwritable_dir = ::File.join(@tmp_dir, 'unwritable')
102
115
  FileUtils.mkdir_p(unwritable_dir, mode: 0600)
103
116
  expect{ Tarchiver::Archiver.archive(archive_dir, unwritable_dir, opts) }.to raise_error(Errno::EACCES)
104
117
  end
@@ -106,14 +119,14 @@ describe Tarchiver::Archiver do
106
119
  it 'has a custom archive name' do
107
120
  opts = options.merge({custom_archive_name: 'rspec-archive'})
108
121
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, opts)
109
- expect(archive_path).to eq(File.join(@tmp_dir, 'rspec-archive.tar'))
122
+ expect(archive_path).to eq(::File.join(@tmp_dir, 'rspec-archive.tar'))
110
123
  end
111
124
 
112
125
  it 'cleans up the input' do
113
126
  opts = options.merge({delete_input_on_success: true})
114
127
  dir = archive_dir
115
128
  archive_path = Tarchiver::Archiver.archive(dir, @tmp_dir, opts)
116
- expect(File.exists?(dir)).to be false
129
+ expect(::File.exists?(dir)).to be false
117
130
  end
118
131
 
119
132
  end
@@ -124,13 +137,13 @@ describe Tarchiver::Archiver do
124
137
 
125
138
  it 'creates a tgz file' do
126
139
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
127
- expect(archive_path).to eq(File.join(@tmp_dir, 'test_dir.tgz'))
140
+ expect(archive_path).to eq(::File.join(@tmp_dir, 'test_dir.tgz'))
128
141
  end
129
142
 
130
143
  it 'terminates in a controlled way on errors' do
131
- expect(default_options[:compressor].send(:compress, File.join(@tmp_dir, 'fake_path'), File.join(@tmp_dir, 'fake_path'), default_options)).to be_nil
144
+ expect(default_options[:compressor].send(:compress, ::File.join(@tmp_dir, 'fake_path'), ::File.join(@tmp_dir, 'fake_path'), default_options)).to be_nil
132
145
  opts = default_options.merge({raise_errors: true})
133
- expect{ opts[:compressor].send(:compress, File.join(@tmp_dir, 'fake_path'), File.join(@tmp_dir, 'fake_path'), opts)}.to raise_error(Errno::ENOENT)
146
+ expect{ opts[:compressor].send(:compress, ::File.join(@tmp_dir, 'fake_path'), ::File.join(@tmp_dir, 'fake_path'), opts)}.to raise_error(Errno::ENOENT)
134
147
  end
135
148
 
136
149
  it 'must use a subclass of Compressor' do
@@ -141,17 +154,17 @@ describe Tarchiver::Archiver do
141
154
 
142
155
  it 'cleans up the tarball' do
143
156
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
144
- tar_path = File.join(File.dirname(archive_path), 'test_dir.tar')
145
- expect(File.exists?(tar_path)).to be false
157
+ tar_path = ::File.join(::File.dirname(archive_path), 'test_dir.tar')
158
+ expect(::File.exists?(tar_path)).to be false
146
159
  end
147
160
 
148
161
  it 'cleans up everything' do
149
162
  opts = default_options.merge({delete_input_on_success: true})
150
163
  dir = archive_dir
151
164
  archive_path = Tarchiver::Archiver.archive(dir, @tmp_dir, opts)
152
- tar_path = File.join(File.dirname(archive_path), 'test_dir.tar')
153
- expect(File.exists?(dir)).to be false
154
- expect(File.exists?(tar_path)).to be false
165
+ tar_path = ::File.join(File.dirname(archive_path), 'test_dir.tar')
166
+ expect(::File.exists?(dir)).to be false
167
+ expect(::File.exists?(tar_path)).to be false
155
168
  end
156
169
 
157
170
  end
@@ -164,39 +177,38 @@ describe Tarchiver::Archiver do
164
177
 
165
178
  it 'reads a tgz' do
166
179
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
167
- # FileUtils.mkdir_p(unpack_path)
168
180
  output = Tarchiver::Archiver.unarchive(archive_path, @unpack_path)
169
- expect(Dir.glob(File.join(output, '**', '*')).size).to be(8)
181
+ expect(Dir.glob(::File.join(output, '**', '*')).size).to be(8)
170
182
  end
171
183
 
172
184
  it 'reads a tar.gz' do
173
185
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
174
- tar_gz_path = File.join(File.dirname(archive_path), 'test_dir.tar.gz')
186
+ tar_gz_path = ::File.join(::File.dirname(archive_path), 'test_dir.tar.gz')
175
187
  FileUtils.mv(archive_path, tar_gz_path)
176
188
  output = Tarchiver::Archiver.unarchive(tar_gz_path, @unpack_path)
177
- expect(Dir.glob(File.join(output, '**', '*')).size).to be(8)
189
+ expect(Dir.glob(::File.join(output, '**', '*')).size).to be(8)
178
190
  end
179
191
 
180
192
  it 'reads a tar' do
181
193
  opts = default_options.merge({archive_type: :tar})
182
194
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, opts)
183
195
  output = Tarchiver::Archiver.unarchive(archive_path, @unpack_path)
184
- expect(Dir.glob(File.join(output, '**', '*')).size).to be(8)
196
+ expect(Dir.glob(::File.join(output, '**', '*')).size).to be(8)
185
197
  end
186
198
 
187
199
  it 'writes symlinks' do
188
- FileUtils.ln_s(File.join(archive_dir, 'materialist.txt'), File.join(archive_dir, 'symlink_to_materialist.txt'))
200
+ FileUtils.ln_s(::File.join(archive_dir, 'materialist.txt'), ::File.join(archive_dir, 'symlink_to_materialist.txt'))
189
201
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
190
202
  output = Tarchiver::Archiver.unarchive(archive_path, @unpack_path)
191
203
  skip "TarWriter does not support symlinks. They are included as regular files."
192
- expect(File.symlink?(File.join(output, 'symlink_to_materialist.txt'))).to be true
204
+ expect(::File.symlink?(::File.join(output, 'symlink_to_materialist.txt'))).to be true
193
205
  end
194
206
 
195
207
  it 'cleans up the input' do
196
208
  opts = default_options.merge({delete_input_on_success: true})
197
209
  archive_path = Tarchiver::Archiver.archive(archive_dir, @tmp_dir, default_options)
198
210
  output = Tarchiver::Archiver.unarchive(archive_path, @unpack_path, opts)
199
- expect(File.exist?(archive_path)).to be false
211
+ expect(::File.exist?(archive_path)).to be false
200
212
  end
201
213
 
202
214
  it 'terminates in a controlled way on errors' do
@@ -1,6 +1,9 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+
4
7
  require 'tarchiver'
5
8
  require 'tmpdir'
6
9
 
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = ::File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'tarchiver/version'
5
5
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| ::File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarchiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Kamphorst
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: A high-level tar and tgz archiver.
@@ -59,8 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
64
  - Gemfile
65
65
  - Gemfile.lock
66
66
  - LICENSE
@@ -94,17 +94,17 @@ require_paths:
94
94
  - lib
95
95
  required_ruby_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.6
107
+ rubygems_version: 2.5.1
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: A high-level tar and tgz archiver.