archive-tar-external 1.4.1 → 1.4.2

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
  SHA256:
3
- metadata.gz: 8262389cae7e15791e59508564874601c91d9693d1151aaac72a3a52403ce666
4
- data.tar.gz: 26c49206d0cc4bbc653353c900425331b9b59ba0a448c6acd4283b43001db9f9
3
+ metadata.gz: 9b20d6fa4e2827a0326f31b43997f3191a1c35ac268d5de485689bb0b0ab59c0
4
+ data.tar.gz: 4a4938677d58c08044547d5fb3bc7a71e669d1ffe11db0c1ba47cff35aecd70a
5
5
  SHA512:
6
- metadata.gz: 2ecea7018db1ab2621966fa41d514c94d92d1b0b98fb1b60b9be337b3f4c650e1c310f4c4874167cc1a0d243c3cd5be858c99699a35e9d0f15df4246e8902e8c
7
- data.tar.gz: b2ca702a9caeb6a6f76c5a32bb85615ce04b3587eb75675593612f439eeb43f74a4d29746ff8fc74c76423cd341e8867ed4c8d882bf45aef0ac457a108dbe58c
6
+ metadata.gz: 703b000865ccddd8a1c54cbbebf47a4e2a6790964c1b9ef68663b5779dd286e8923b2dfe98d2b89a9161af457aadd588e1372a4ce9d49b7f7fa44110f094ec8e
7
+ data.tar.gz: 0f72ea731fd952a4474eb553a789a4a78a8d79a41f6ad6c597a2328f948981251295dab4abb6bdabeac9770a85aa1fab6466f174c311e7c330fd3391bcb73aaa
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.4.2 - 1-May-2021
2
+ * Switched from test-unit to rspec.
3
+ * Added tighter versioning for the development dependencies.
4
+ * Tests will now try to use gtar by default, if found.
5
+ * A fair number of rubocop suggestions were implemented, including
6
+ the frozen string literal pragma.
7
+
1
8
  ## 1.4.1 - 19-Feb-2021
2
9
  * Switched from rdoc to markdown.
3
10
 
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org' do
2
+ gemspec
3
+ end
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
data/MANIFEST.md CHANGED
@@ -1,10 +1,13 @@
1
1
  * CHANGES.md
2
+ * LICENSE
2
3
  * MANIFEST.md
3
4
  * README.md
5
+ * Gemfile
4
6
  * Rakefile
5
7
  * archive-tar-external.gemspec
6
8
  * certs/djberg96_pub.pem
7
9
  * doc/tar_external.md
8
10
  * lib/archive-tar-external.rb
9
11
  * lib/archive/tar_external.rb
10
- * test/test_archive_tar_external.rb
12
+ * spec/archive_tar_external_spec.rb
13
+ * spec/spec_helper.rb
data/README.md CHANGED
@@ -22,9 +22,16 @@ t = Archive::Tar::External.new('test.tar', '*.rb', 'gzip')
22
22
  * At least one compression program, e.g. gzip, bzip2, zip, etc.
23
23
 
24
24
  ## Known Issues
25
+
26
+ ### Solaris
25
27
  The tar program that comes with Solaris will not raise an error if you
26
28
  try to expand a file from an archive that does not contain that file.
27
29
 
30
+ ### OSX
31
+ It appears that the BSD tar that ships on Mac does not implement the -u
32
+ option properly, and will add a file to the archive even if the timestamp
33
+ of the file hasn't changed.
34
+
28
35
  If you come across any other issues, please report them on the project
29
36
  page at https://github.com/djberg96/archive-tar-external.
30
37
 
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
4
 
5
- CLEAN.include("**/*.gem", "**/*.rbc")
5
+ CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
6
6
 
7
7
  namespace :gem do
8
8
  desc 'Build the archive-tar-external gem'
@@ -10,7 +10,7 @@ namespace :gem do
10
10
  require 'rubygems/package'
11
11
  spec = eval(IO.read('archive-tar-external.gemspec'))
12
12
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
- Gem::Package.build(spec, true)
13
+ Gem::Package.build(spec)
14
14
  end
15
15
 
16
16
  desc 'Install the archive-tar-external library as a gem'
@@ -20,9 +20,7 @@ namespace :gem do
20
20
  end
21
21
  end
22
22
 
23
- Rake::TestTask.new do |t|
24
- t.warning = true
25
- t.verbose = true
26
- end
23
+ desc "Run the test suite"
24
+ RSpec::Core::RakeTask.new(:spec)
27
25
 
28
- task :default => :test
26
+ task :default => :spec
@@ -3,28 +3,28 @@ require 'rbconfig'
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'archive-tar-external'
6
- spec.version = '1.4.1'
6
+ spec.version = '1.4.2'
7
7
  spec.summary = 'A simple way to create tar archives using external calls'
8
8
  spec.license = 'Apache-2.0'
9
9
  spec.author = 'Daniel Berger'
10
10
  spec.email = 'djberg96@gmail.com'
11
11
  spec.homepage = 'http://github.com/djberg96/archive-tar-external'
12
- spec.test_file = 'test/test_archive_tar_external.rb'
12
+ spec.test_files = Dir['spec/*.rb']
13
13
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
14
14
  spec.cert_chain = Dir['certs/*']
15
15
 
16
16
  spec.metadata = {
17
17
  'homepage_uri' => 'https://github.com/djberg96/archive-tar-external',
18
18
  'bug_tracker_uri' => 'https://github.com/djberg96/archive-tar-external/issues',
19
- 'changelog_uri' => 'https://github.com/djberg96/archive-tar-external/blob/master/CHANGES',
19
+ 'changelog_uri' => 'https://github.com/djberg96/archive-tar-external/blob/main/CHANGES',
20
20
  'documentation_uri' => 'https://github.com/djberg96/archive-tar-external/wiki',
21
21
  'source_code_uri' => 'https://github.com/djberg96/archive-tar-external',
22
22
  'wiki_uri' => 'https://github.com/djberg96/archive-tar-external/wiki'
23
23
  }
24
24
 
25
- spec.add_development_dependency('test-unit')
26
- spec.add_development_dependency('ptools')
27
25
  spec.add_development_dependency('rake')
26
+ spec.add_development_dependency('rspec', '~> 3.9')
27
+ spec.add_development_dependency('ptools', '~> 1.4')
28
28
 
29
29
  spec.description = <<-EOF
30
30
  The archive-tar-external is a simple wrapper interface for creating
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'archive/tar/external'
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
 
3
5
  # The Archive module serves as a namespace only.
4
6
  module Archive
5
-
6
7
  # The Tar class serves as a toplevel class namespace only.
7
8
  class Tar
8
-
9
9
  # Raised if something goes wrong during the execution of any methods
10
10
  # which use the tar command internally.
11
11
  class Error < StandardError; end
@@ -17,7 +17,7 @@ module Archive
17
17
  # This class encapsulates tar & zip operations.
18
18
  class Tar::External
19
19
  # The version of the archive-tar-external library.
20
- VERSION = '1.4.1'.freeze
20
+ VERSION = '1.4.2'
21
21
 
22
22
  # The name of the archive file to be used, e.g. "test.tar"
23
23
  attr_accessor :archive_name
@@ -39,18 +39,13 @@ module Archive
39
39
  # If +program+ is provided, then it compresses the archive as well by
40
40
  # calling Archive::Tar::External#compress_archive internally.
41
41
  #
42
- def initialize(archive_name, file_pattern=nil, program=nil)
42
+ def initialize(archive_name, file_pattern = nil, program = nil)
43
43
  @archive_name = archive_name.to_s
44
44
  @compressed_archive_name = nil
45
45
  @tar_program = 'tar'
46
46
 
47
- if file_pattern
48
- create_archive(file_pattern)
49
- end
50
-
51
- if program
52
- compress_archive(program)
53
- end
47
+ create_archive(file_pattern) if file_pattern
48
+ compress_archive(program) if program
54
49
  end
55
50
 
56
51
  # Assign a compressed archive name. This autogenerates the archive_name
@@ -62,9 +57,9 @@ module Archive
62
57
  # that you want to uncompress, and want to have a Tar::External object
63
58
  # around. Otherwise, use the class method Tar::External.uncompress.
64
59
  #
65
- def compressed_archive_name=(name, ext=File.extname(name))
60
+ def compressed_archive_name=(name, ext = File.extname(name))
66
61
  if ext.downcase == '.tgz'
67
- @archive_name = File.basename(name, ext.downcase) + '.tar'
62
+ @archive_name = File.basename(name, ext.downcase) << '.tar'
68
63
  else
69
64
  @archive_name = File.basename(name, ext)
70
65
  end
@@ -79,15 +74,15 @@ module Archive
79
74
  def create_archive(file_pattern, options = 'cf')
80
75
  cmd = "#{@tar_program} #{options} #{@archive_name} #{file_pattern}"
81
76
 
82
- Open3.popen3(cmd){ |tar_in, tar_out, tar_err|
77
+ Open3.popen3(cmd) do |_tar_in, _tar_out, tar_err|
83
78
  err = tar_err.gets
84
79
  raise Error, err.chomp if err
85
- }
80
+ end
86
81
 
87
82
  self
88
83
  end
89
84
 
90
- alias :create :create_archive
85
+ alias create create_archive
91
86
 
92
87
  # Compresses the archive with +program+, or gzip if no program is
93
88
  # provided. If you want to pass arguments to +program+, merely include
@@ -95,10 +90,10 @@ module Archive
95
90
  #
96
91
  # Any errors that occur here will raise a Tar::CompressError.
97
92
  #
98
- def compress_archive(program='gzip')
93
+ def compress_archive(program = 'gzip')
99
94
  cmd = "#{program} #{@archive_name}"
100
95
 
101
- Open3.popen3(cmd){ |prog_in, prog_out, prog_err|
96
+ Open3.popen3(cmd) do |_prog_in, _prog_out, prog_err|
102
97
  err = prog_err.gets
103
98
  raise CompressError, err.chomp if err
104
99
 
@@ -106,12 +101,12 @@ module Archive
106
101
  # reliable way to do this, but this should work 99% of the time.
107
102
  name = Dir["#{@archive_name}.{gz,bz2,cpio,zip}"].first
108
103
  @compressed_archive_name = name
109
- }
104
+ end
110
105
 
111
106
  self
112
107
  end
113
108
 
114
- alias :compress :compress_archive
109
+ alias compress compress_archive
115
110
 
116
111
  # Uncompresses the tarball using the program you pass to this method. The
117
112
  # default is "gunzip". Just as for +compress_archive+, you can pass
@@ -123,33 +118,31 @@ module Archive
123
118
  #
124
119
  # Any errors that occur here will raise a Tar::CompressError.
125
120
  #
126
- def uncompress_archive(program="gunzip")
127
- unless @compressed_archive_name
128
- raise CompressError, "no compressed file found"
129
- end
121
+ def uncompress_archive(program = 'gunzip')
122
+ raise CompressError, 'no compressed file found' unless @compressed_archive_name
130
123
 
131
124
  cmd = "#{program} #{@compressed_archive_name}"
132
125
 
133
- Open3.popen3(cmd){ |prog_in, prog_out, prog_err|
126
+ Open3.popen3(cmd) do |_prog_in, _prog_out, prog_err|
134
127
  err = prog_err.gets
135
128
  raise CompressError, err.chomp if err
136
129
  @compressed_archive_name = nil
137
- }
130
+ end
138
131
  self
139
132
  end
140
133
 
141
- alias :uncompress :uncompress_archive
134
+ alias uncompress uncompress_archive
142
135
 
143
136
  # Uncompress an existing archive, using +program+ to uncompress it.
144
137
  # The default decompression program is gunzip.
145
138
  #
146
- def self.uncompress_archive(archive, program='gunzip')
139
+ def self.uncompress_archive(archive, program = 'gunzip')
147
140
  cmd = "#{program} #{archive}"
148
141
 
149
- Open3.popen3(cmd){ |prog_in, prog_out, prog_err|
142
+ Open3.popen3(cmd) do |_prog_in, _prog_out, prog_err|
150
143
  err = prog_err.gets
151
144
  raise CompressError, err.chomp if err
152
- }
145
+ end
153
146
  end
154
147
 
155
148
  class << self
@@ -162,56 +155,54 @@ module Archive
162
155
  def archive_info
163
156
  result = []
164
157
  cmd = "#{@tar_program} tf #{@archive_name}"
165
- Open3.popen3(cmd){ |ain, aout, aerr|
158
+
159
+ Open3.popen3(cmd) do |_ain, aout, aerr|
166
160
  err = aerr.gets
167
161
  raise Error, err.chomp if err
168
162
 
169
- while output = aout.gets
163
+ while (output = aout.gets)
170
164
  result << output.chomp
171
165
  end
172
- }
166
+ end
167
+
173
168
  result
174
169
  end
175
170
 
176
- alias :info :archive_info
171
+ alias info archive_info
177
172
 
178
173
  # Adds +files+ to an already existing archive.
179
174
  #
180
175
  def add_to_archive(*files)
181
- if files.empty?
182
- raise Error, "there must be at least one file specified"
183
- end
176
+ raise Error, 'there must be at least one file specified' if files.empty?
184
177
 
185
- cmd = "#{@tar_program} rf #{@archive_name} #{files.join(" ")}"
178
+ cmd = "#{@tar_program} rf #{@archive_name} #{files.join(' ')}"
186
179
 
187
- Open3.popen3(cmd){ |ain, aout, aerr|
180
+ Open3.popen3(cmd) do |_ain, _aout, aerr|
188
181
  err = aerr.gets
189
182
  raise Error, err.chomp if err
190
- }
183
+ end
191
184
  self
192
185
  end
193
186
 
194
- alias :add :add_to_archive
187
+ alias add add_to_archive
195
188
 
196
189
  # Updates the given +files+ in the archive, i.e. they are added if they
197
190
  # are not already in the archive or have been modified.
198
191
  #
199
192
  def update_archive(*files)
200
- if files.empty?
201
- raise Error, "there must be at least one file specified"
202
- end
193
+ raise Error, 'there must be at least one file specified' if files.empty?
203
194
 
204
- cmd = "#{@tar_program} uf #{@archive_name} #{files.join(" ")}"
195
+ cmd = "#{@tar_program} uf #{@archive_name} #{files.join(' ')}"
205
196
 
206
- Open3.popen3(cmd){ |ain, aout, aerr|
197
+ Open3.popen3(cmd) do |_ain, _aout, aerr|
207
198
  err = aerr.gets
208
199
  raise Error, err.chomp if err
209
- }
200
+ end
210
201
 
211
202
  self
212
203
  end
213
204
 
214
- alias :update :update_archive
205
+ alias update update_archive
215
206
 
216
207
  # Expands the contents of the tarball. It does NOT delete the tarball.
217
208
  # If +files+ are provided, then only those files are extracted.
@@ -223,22 +214,19 @@ module Archive
223
214
  #
224
215
  def extract_archive(*files)
225
216
  cmd = "#{@tar_program} xf #{@archive_name}"
217
+ cmd = "#{cmd} #{files.join(' ')}" unless files.empty?
226
218
 
227
- unless files.empty?
228
- cmd << " " << files.join(" ")
229
- end
230
-
231
- Open3.popen3(cmd){ |ain, aout, aerr|
219
+ Open3.popen3(cmd) do |_ain, _aout, aerr|
232
220
  err = aerr.gets
233
221
  raise Error, err.chomp if err
234
- }
222
+ end
235
223
 
236
224
  self
237
225
  end
238
226
 
239
- alias :expand_archive :extract_archive
240
- alias :extract :extract_archive
241
- alias :expand :extract_archive
227
+ alias expand_archive extract_archive
228
+ alias extract extract_archive
229
+ alias expand extract_archive
242
230
 
243
231
  # A class method that behaves identically to the equivalent instance
244
232
  # method, except that you must specifiy that tarball as the first
@@ -246,15 +234,12 @@ module Archive
246
234
  #
247
235
  def self.extract_archive(archive, *files)
248
236
  cmd = "tar xf #{archive}"
237
+ cmd = "#{cmd} #{files.join(' ')}" unless files.empty?
249
238
 
250
- unless files.empty?
251
- cmd << " " << files.join(" ")
252
- end
253
-
254
- Open3.popen3(cmd){ |ain, aout, aerr|
239
+ Open3.popen3(cmd) do |_ain, _aout, aerr|
255
240
  err = aerr.gets
256
241
  raise Error, err.chomp if err
257
- }
242
+ end
258
243
 
259
244
  self
260
245
  end
@@ -0,0 +1,231 @@
1
+ ###############################################################################
2
+ # archive_tar_external_spec.rb
3
+ #
4
+ # Tests for the archive-tar-external library. This test case should be
5
+ # run via the 'rake spec' Rake task.
6
+ ###############################################################################
7
+ require 'archive/tar/external'
8
+ require 'spec_helper'
9
+
10
+ RSpec.describe Archive::Tar::External do
11
+ let(:tmp_file1) { 'temp1.txt' }
12
+ let(:tmp_file2) { 'temp2.txt' }
13
+ let(:tmp_file3) { 'temp3.txt' }
14
+
15
+ let(:tar_name) { 'test.tar' }
16
+ let(:tar_obj) { Archive::Tar::External.new(tar_name) }
17
+ let(:pattern) { '*.txt' }
18
+ let(:gtar) { File.basename(File.which('gtar')) }
19
+
20
+ let(:archive_name) { 'test.tar.gz' }
21
+ let(:tar_program) { gtar || 'tar' }
22
+
23
+ before do
24
+ tar_obj.tar_program = 'gtar' if File.which('gtar')
25
+ File.open(tmp_file1, 'w'){ |f| f.puts 'This is a temporary text file' }
26
+ File.open(tmp_file2, 'w'){ |f| f.puts 'This is a temporary text file' }
27
+ File.open(tmp_file3, 'w'){ |f| f.puts 'This is a temporary text file' }
28
+ end
29
+
30
+ example "version" do
31
+ expect(Archive::Tar::External::VERSION).to eq('1.4.2')
32
+ expect(Archive::Tar::External::VERSION).to be_frozen
33
+ end
34
+
35
+ context "constructor" do
36
+ example "with name" do
37
+ expect{ Archive::Tar::External.new(tar_name) }.not_to raise_error
38
+ end
39
+
40
+ example "with name and extension" do
41
+ expect{ Archive::Tar::External.new(tar_name, pattern) }.not_to raise_error
42
+ end
43
+
44
+ example "with compression program", :gzip => true do
45
+ expect{ Archive::Tar::External.new(tar_name, pattern, 'gzip') }.not_to raise_error
46
+ end
47
+
48
+ example "raises an error if name is not provided" do
49
+ expect{ Archive::Tar::External.new }.to raise_error(ArgumentError)
50
+ end
51
+ end
52
+
53
+ context "instance methods" do
54
+ example "tar_program getter" do
55
+ expect(tar_obj).to respond_to(:tar_program)
56
+ expect(tar_obj.tar_program).to eq(tar_program)
57
+ end
58
+
59
+ example "archive_name getter" do
60
+ expect(tar_obj).to respond_to(:archive_name)
61
+ expect(tar_obj.archive_name).to eq(tar_name)
62
+ end
63
+
64
+ example "archive_name setter" do
65
+ expect(tar_obj).to respond_to(:archive_name=)
66
+ expect{ tar_obj.archive_name = 'foo' }.not_to raise_error
67
+ expect(tar_obj.archive_name).to eq('foo')
68
+ end
69
+
70
+ example "compressed_archive_name getter" do
71
+ expect(tar_obj).to respond_to(:compressed_archive_name)
72
+ expect(tar_obj.compressed_archive_name).to be_nil
73
+ end
74
+
75
+ example "compressed_archive_name setter basic functionality" do
76
+ expect(tar_obj).to respond_to(:compressed_archive_name=)
77
+ expect{ tar_obj.compressed_archive_name = archive_name }.not_to raise_error
78
+ end
79
+
80
+ example "setting the compressed_archive_name also sets the archive name to the expected value" do
81
+ tar_obj.compressed_archive_name = archive_name
82
+ expect(tar_obj.compressed_archive_name).to eq(archive_name)
83
+ expect(tar_obj.archive_name).to eq(tar_name)
84
+
85
+ tar_obj.compressed_archive_name = 'test.tgz'
86
+ expect(tar_obj.compressed_archive_name).to eq('test.tgz')
87
+ expect(tar_obj.archive_name).to eq(tar_name)
88
+ end
89
+
90
+ example "create_archive basic functionality" do
91
+ expect(tar_obj).to respond_to(:create_archive)
92
+ expect{ tar_obj.create_archive(pattern) }.not_to raise_error
93
+ expect(File.exist?(tar_name)).to be true
94
+ end
95
+
96
+ example "create_archive requires at least on argument" do
97
+ expect{ tar_obj.create_archive }.to raise_error(ArgumentError)
98
+ end
99
+
100
+ example "create_archive raises an error if no files match the pattern" do
101
+ expect{ tar_obj.create_archive('*.blah') }.to raise_error(Archive::Tar::Error)
102
+ end
103
+
104
+ example "create_archive accepts optional parameters" do
105
+ expect{ tar_obj.create_archive(pattern, 'cfj') }.not_to raise_error
106
+ end
107
+
108
+ example "create is an alias for create_archive" do
109
+ expect(tar_obj).to respond_to(:create)
110
+ expect(tar_obj.method(:create)).to eq(tar_obj.method(:create_archive))
111
+ end
112
+ end
113
+
114
+ context "compression" do
115
+ example "compress_archive basic functionality" do
116
+ expect(tar_obj).to respond_to(:compress_archive)
117
+ end
118
+
119
+ example "compress is an alias for compress_archive" do
120
+ expect(tar_obj).to respond_to(:compress)
121
+ expect(tar_obj.method(:compress)).to eq(tar_obj.method(:compress_archive))
122
+ end
123
+
124
+ example "compress_archive defaults to gzip", :gzip => true do
125
+ tar_obj.create_archive(pattern)
126
+ tar_obj.compress_archive
127
+
128
+ expect(tar_obj.compressed_archive_name).to eq(archive_name)
129
+ expect(File.exist?(archive_name)).to be true
130
+ end
131
+
132
+ example "compress_archive works with bzip2", :bzip2 => true do
133
+ expect{ tar_obj.create_archive(pattern) }.not_to raise_error
134
+ expect{ tar_obj.compress_archive('bzip2') }.not_to raise_error
135
+ expect(File.exist?('test.tar.bz2')).to be true
136
+ end
137
+ end
138
+
139
+ context "uncompression" do
140
+ before do
141
+ tar_obj.create_archive(pattern).compress_archive
142
+ end
143
+
144
+ example "uncompress_archive basic functionality" do
145
+ expect(tar_obj).to respond_to(:uncompress_archive)
146
+ end
147
+
148
+ example "uncompress_archive behaves as expected" do
149
+ expect{ tar_obj.uncompress_archive }.not_to raise_error
150
+ expect(File.exist?(archive_name)).to be false
151
+ end
152
+
153
+ example "uncompress is an alias for uncompress_archive" do
154
+ expect(tar_obj).to respond_to(:uncompress)
155
+ expect(tar_obj.method(:uncompress)).to eq (tar_obj.method(:uncompress_archive))
156
+ end
157
+
158
+ example "uncompress_archive singleton method" do
159
+ expect(Archive::Tar::External).to respond_to(:uncompress_archive)
160
+ end
161
+ end
162
+
163
+ context "archive" do
164
+ example "archive_info basic functionality" do
165
+ expect(tar_obj).to respond_to(:archive_info)
166
+ end
167
+
168
+ example "archive_info returns the expected value" do
169
+ tar_obj.create_archive(pattern)
170
+ expect(tar_obj.archive_info).to eq([tmp_file1, tmp_file2, tmp_file3])
171
+ end
172
+
173
+ example "add_to_archive basic functionality" do
174
+ expect(tar_obj).to respond_to(:add_to_archive)
175
+ end
176
+
177
+ example "add_to_archive works as expected" do
178
+ tar_obj = described_class.new(tar_name)
179
+ expect{ tar_obj.add_to_archive(tmp_file2) }.not_to raise_error
180
+ expect{ tar_obj.add_to_archive(tmp_file2, tmp_file3) }.not_to raise_error
181
+ expect(tar_obj.archive_info).to eq([tmp_file2, tmp_file2, tmp_file3])
182
+ end
183
+
184
+ example "update_archive basic functionality" do
185
+ expect(tar_obj).to respond_to(:update_archive)
186
+ end
187
+
188
+ example "update_archive behaves as expected", :gtar => true do
189
+ tar_obj.create_archive(pattern)
190
+ expect(tar_obj.archive_info).to eq([tmp_file1, tmp_file2, tmp_file3])
191
+ tar_obj.update_archive(tmp_file2)
192
+ expect(tar_obj.archive_info).to eq([tmp_file1, tmp_file2, tmp_file3])
193
+ end
194
+
195
+ example "extract_archive_basic" do
196
+ expect(tar_obj).to respond_to(:extract_archive)
197
+ end
198
+
199
+ example "extract_archive raises an error if the file isn't in the archive" do
200
+ tar_obj.create(pattern)
201
+ expect{ tar_obj.expand('blah.txt') }.to raise_error(Archive::Tar::Error)
202
+ end
203
+
204
+ example "extract_archive with no arguments extracts all files" do
205
+ tar_obj.create(pattern)
206
+ expect{ tar_obj.extract_archive }.not_to raise_error
207
+ end
208
+
209
+ example "extract_archive with a valid file argument behaves as expected" do
210
+ tar_obj.create(pattern)
211
+ expect{ tar_obj.extract_archive(tmp_file2) }.not_to raise_error
212
+ end
213
+
214
+ example "expand_archive, expand and extract are aliases for extract_archive" do
215
+ expect(tar_obj.method(:expand_archive)).to eq(tar_obj.method(:extract_archive))
216
+ expect(tar_obj.method(:expand)).to eq(tar_obj.method(:extract_archive))
217
+ expect(tar_obj.method(:extract)).to eq(tar_obj.method(:extract_archive))
218
+ end
219
+ end
220
+
221
+ after do
222
+ File.delete(tmp_file1) if File.exist?(tmp_file1)
223
+ File.delete(tmp_file2) if File.exist?(tmp_file2)
224
+ File.delete(tmp_file3) if File.exist?(tmp_file3)
225
+
226
+ File.delete(tar_name) if File.exist?(tar_name)
227
+ File.delete("#{tar_name}.gz") if File.exist?("#{tar_name}.gz")
228
+ File.delete("#{tar_name}.bz2") if File.exist?("#{tar_name}.bz2")
229
+ File.delete("#{tar_name}.zip") if File.exist?("#{tar_name}.zip")
230
+ end
231
+ end
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'ptools'
3
+
4
+ RSpec.configure do |config|
5
+ config.filter_run_excluding(:gzip) unless File.which('gzip')
6
+ config.filter_run_excluding(:gtar) unless File.which('gtar')
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archive-tar-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Berger
@@ -35,10 +35,10 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date: 2021-04-30 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
- name: test-unit
41
+ name: rake
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
@@ -52,33 +52,33 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  - !ruby/object:Gem::Dependency
55
- name: ptools
55
+ name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '3.9'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '3.9'
68
68
  - !ruby/object:Gem::Dependency
69
- name: rake
69
+ name: ptools
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '1.4'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '1.4'
82
82
  description: |2
83
83
  The archive-tar-external is a simple wrapper interface for creating
84
84
  tar files using your system's tar command. You can also easily compress
@@ -89,29 +89,26 @@ executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
- - Rakefile
93
- - certs
94
- - certs/djberg96_pub.pem
95
- - lib
96
- - lib/archive-tar-external.rb
97
- - lib/archive
98
- - lib/archive/tar
99
- - lib/archive/tar/external.rb
100
- - test
101
- - test/test_archive_tar_external.rb
102
92
  - CHANGES.md
93
+ - Gemfile
94
+ - LICENSE
103
95
  - MANIFEST.md
104
96
  - README.md
97
+ - Rakefile
105
98
  - archive-tar-external.gemspec
106
- - doc
99
+ - certs/djberg96_pub.pem
107
100
  - doc/archive_tar_external.md
101
+ - lib/archive-tar-external.rb
102
+ - lib/archive/tar/external.rb
103
+ - spec/archive_tar_external_spec.rb
104
+ - spec/spec_helper.rb
108
105
  homepage: http://github.com/djberg96/archive-tar-external
109
106
  licenses:
110
107
  - Apache-2.0
111
108
  metadata:
112
109
  homepage_uri: https://github.com/djberg96/archive-tar-external
113
110
  bug_tracker_uri: https://github.com/djberg96/archive-tar-external/issues
114
- changelog_uri: https://github.com/djberg96/archive-tar-external/blob/master/CHANGES
111
+ changelog_uri: https://github.com/djberg96/archive-tar-external/blob/main/CHANGES
115
112
  documentation_uri: https://github.com/djberg96/archive-tar-external/wiki
116
113
  source_code_uri: https://github.com/djberg96/archive-tar-external
117
114
  wiki_uri: https://github.com/djberg96/archive-tar-external/wiki
@@ -130,9 +127,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
127
  - !ruby/object:Gem::Version
131
128
  version: '0'
132
129
  requirements: []
133
- rubygems_version: 3.0.3
130
+ rubygems_version: 3.2.15
134
131
  signing_key:
135
132
  specification_version: 4
136
133
  summary: A simple way to create tar archives using external calls
137
134
  test_files:
138
- - test/test_archive_tar_external.rb
135
+ - spec/archive_tar_external_spec.rb
136
+ - spec/spec_helper.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,209 +0,0 @@
1
- ###############################################################################
2
- # test_archive_tar_external.rb
3
- #
4
- # Test suite for the archive-tar-external library. This test case should be
5
- # run via the 'rake test' Rake task.
6
- ###############################################################################
7
- require 'archive/tar/external'
8
- require 'test-unit'
9
- require 'ptools'
10
- include Archive
11
-
12
- class TC_ArchiveTarExternal < Test::Unit::TestCase
13
- def self.startup
14
- Dir.chdir(File.dirname(File.expand_path(__FILE__)))
15
-
16
- @@tmp_file1 = 'temp1.txt'
17
- @@tmp_file2 = 'temp2.txt'
18
- @@tmp_file3 = 'temp3.txt'
19
-
20
- @@gtar_found = File.which('gtar')
21
- @@tar_found = File.which('tar')
22
- @@gzip_found = File.which('gzip')
23
- @@bzip2_found = File.which('bzip2')
24
-
25
- File.open(@@tmp_file1, 'w'){ |f| f.puts 'This is a temporary text file' }
26
- File.open(@@tmp_file2, 'w'){ |f| f.puts 'This is a temporary text file' }
27
- File.open(@@tmp_file3, 'w'){ |f| f.puts 'This is a temporary text file' }
28
- end
29
-
30
- def setup
31
- @tar = Tar::External.new('test.tar')
32
- @tar_name = 'test.tar'
33
- @pattern = '*.txt'
34
- @archive = 'temp.tar.gz'
35
- end
36
-
37
- def test_version
38
- assert_equal('1.4.1', Tar::External::VERSION)
39
- assert_true(Tar::External::VERSION.frozen?)
40
- end
41
-
42
- def test_constructor
43
- assert_nothing_raised{ Tar::External.new(@tar_name) }
44
- end
45
-
46
- def test_constructor_with_extension
47
- assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt') }
48
- end
49
-
50
- def test_constructor_with_program
51
- omit_unless(@@gzip_found){ 'gzip program not found - skipping' }
52
- assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt', 'gzip') }
53
- end
54
-
55
- def test_constructor_expected_errors
56
- assert_raise(ArgumentError){ Tar::External.new }
57
- end
58
-
59
- def test_tar_program
60
- assert_respond_to(@tar, :tar_program)
61
- assert_equal('tar', @tar.tar_program)
62
- end
63
-
64
- def test_archive_name
65
- assert_respond_to(@tar, :archive_name)
66
- assert_respond_to(@tar, :archive_name=)
67
-
68
- assert_equal('test.tar', @tar.archive_name)
69
- assert_nothing_raised{ @tar.archive_name }
70
- assert_nothing_raised{ @tar.archive_name = 'foo' }
71
- end
72
-
73
- def test_compressed_archive_name_get
74
- assert_respond_to(@tar, :compressed_archive_name)
75
- assert_nil(@tar.compressed_archive_name)
76
- end
77
-
78
- def test_compressed_archive_name_set
79
- assert_respond_to(@tar, :compressed_archive_name=)
80
- assert_nothing_raised{ @tar.compressed_archive_name = 'test.tar.gz' }
81
- assert_equal('test.tar.gz', @tar.compressed_archive_name)
82
- assert_equal('test.tar', @tar.archive_name)
83
-
84
- assert_nothing_raised{ @tar.compressed_archive_name = 'test.tgz' }
85
- assert_equal('test.tgz', @tar.compressed_archive_name)
86
- assert_equal('test.tar', @tar.archive_name)
87
- end
88
-
89
- test "create_archive basic functionality" do
90
- assert_respond_to(@tar, :create_archive)
91
- assert_nothing_raised{ @tar.create_archive(@pattern) }
92
- assert_true(File.exist?(@tar_name))
93
- end
94
-
95
- test "create_archive requires at least on argument" do
96
- assert_raises(ArgumentError){ @tar.create_archive }
97
- end
98
-
99
- test "create_archive raises an error if no files match the pattern" do
100
- assert_raises(Tar::Error){ @tar.create_archive('*.blah') }
101
- end
102
-
103
- test "create_archive accepts optional parameters" do
104
- assert_nothing_raised{ @tar.create_archive(@pattern, 'cfj') }
105
- end
106
-
107
- def test_create_alias
108
- assert_respond_to(@tar, :create)
109
- assert_true(Tar::External.instance_method(:create) == Tar::External.instance_method(:create_archive))
110
- end
111
-
112
- def test_compress_archive_basic
113
- assert_respond_to(@tar, :compress_archive)
114
- end
115
-
116
- def test_compress_alias
117
- assert_respond_to(@tar, :compress)
118
- assert_true(Tar::External.instance_method(:compress) == Tar::External.instance_method(:compress_archive))
119
- end
120
-
121
- def test_compress_archive_gzip
122
- assert_nothing_raised{ @tar.create_archive('*.txt') }
123
- assert_nothing_raised{ @tar.compress_archive }
124
-
125
- assert_equal('test.tar.gz', @tar.compressed_archive_name)
126
- assert_true(File.exist?('test.tar.gz'))
127
- end
128
-
129
- def test_compress_archive_bzip2
130
- assert_nothing_raised{ @tar.create_archive('*.txt') }
131
- assert_nothing_raised{ @tar.compress_archive('bzip2') }
132
- assert_true(File.exist?('test.tar.bz2'))
133
- end
134
-
135
- def test_uncompress_archive
136
- assert_respond_to(@tar, :uncompress_archive)
137
- assert_nothing_raised{ @tar.create_archive('*.txt') }
138
- assert_nothing_raised{ @tar.compress_archive }
139
- assert_nothing_raised{ @tar.uncompress_archive }
140
- assert_false(File.exist?('test.tar.gz'))
141
- end
142
-
143
- def test_uncompress_archive_class_method
144
- assert_respond_to(Tar::External, :uncompress_archive)
145
- end
146
-
147
- def test_uncompress_alias
148
- assert_respond_to(Tar::External, :uncompress)
149
- assert_true(Tar::External.method(:uncompress) == Tar::External.method(:uncompress_archive))
150
- end
151
-
152
- def test_archive_info
153
- assert_respond_to(@tar, :archive_info)
154
- assert_nothing_raised{ @tar.create_archive('*.txt') }
155
- assert_equal(['temp1.txt','temp2.txt','temp3.txt'], @tar.archive_info)
156
- end
157
-
158
- def test_add_to_archive
159
- assert_respond_to(@tar,:add_to_archive)
160
- assert_nothing_raised{ @tar.create_archive('temp1.txt') }
161
- assert_nothing_raised{ @tar.add_to_archive('temp2.txt') }
162
- assert_nothing_raised{ @tar.add_to_archive('temp2.txt','temp3.txt') }
163
- end
164
-
165
- def test_update_archive
166
- assert_respond_to(@tar, :update_archive)
167
- assert_nothing_raised{ @tar.create_archive('*.txt') }
168
- assert_nothing_raised{ @tar.update_archive('temp2.txt') }
169
- end
170
-
171
- def test_extract_archive_basic
172
- assert_respond_to(@tar, :extract_archive)
173
- end
174
-
175
- def test_extract_archive_aliases
176
- assert_true(Tar::External.instance_method(:extract_archive) == Tar::External.instance_method(:expand_archive))
177
- assert_true(Tar::External.instance_method(:extract) == Tar::External.instance_method(:expand_archive))
178
- assert_true(Tar::External.instance_method(:expand) == Tar::External.instance_method(:expand_archive))
179
- end
180
-
181
- def test_extract_archive_advanced
182
- omit_unless(RbConfig::CONFIG['host_os'] =~ /sunos|solaris/){
183
- assert_nothing_raised{ @tar.tar_program = @@gtar }
184
- }
185
- assert_nothing_raised{ @tar.create('*.txt') }
186
- assert_raises(Tar::Error){ @tar.expand('blah.txt') }
187
-
188
- assert_nothing_raised{ @tar.extract_archive }
189
- assert_nothing_raised{ @tar.extract_archive('temp2.txt') }
190
- end
191
-
192
- def teardown
193
- @tar = nil
194
- File.delete('test.tar') if File.exist?('test.tar')
195
- File.delete('test.tar.gz') if File.exist?('test.tar.gz')
196
- File.delete('test.tar.bz2') if File.exist?('test.tar.bz2')
197
- File.delete('test.tar.zip') if File.exist?('test.tar.zip')
198
- end
199
-
200
- def self.shutdown
201
- @@tar_foudn = nil
202
- @@gzip_found = nil
203
- @@bzip2_found = nil
204
-
205
- File.delete(@@tmp_file1) if File.exist?(@@tmp_file1)
206
- File.delete(@@tmp_file2) if File.exist?(@@tmp_file2)
207
- File.delete(@@tmp_file3) if File.exist?(@@tmp_file3)
208
- end
209
- end