archive-tar-external 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,203 +1,203 @@
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 'rubygems'
8
- gem 'test-unit'
9
-
10
- require 'archive/tar/external'
11
- require 'test/unit'
12
- require 'ptools'
13
- include Archive
14
-
15
- class TC_ArchiveTarExternal < Test::Unit::TestCase
16
- def self.startup
17
- Dir.chdir(File.dirname(File.expand_path(__FILE__)))
18
-
19
- @@tmp_file1 = 'temp1.txt'
20
- @@tmp_file2 = 'temp2.txt'
21
- @@tmp_file3 = 'temp3.txt'
22
-
23
- @@gtar_found = File.which('gtar')
24
- @@tar_found = File.which('tar')
25
- @@gzip_found = File.which('gzip')
26
- @@bzip2_found = File.which('bzip2')
27
-
28
- File.open(@@tmp_file1, 'w'){ |f| f.puts 'This is a temporary text file' }
29
- File.open(@@tmp_file2, 'w'){ |f| f.puts 'This is a temporary text file' }
30
- File.open(@@tmp_file3, 'w'){ |f| f.puts 'This is a temporary text file' }
31
- end
32
-
33
- def setup
34
- @tar = Tar::External.new('test.tar')
35
- @tar_name = 'test.tar'
36
- @pattern = '*.txt'
37
- @archive = 'temp.tar.gz'
38
- end
39
-
40
- def test_version
41
- assert_equal('1.3.0', Tar::External::VERSION)
42
- end
43
-
44
- def test_constructor
45
- assert_nothing_raised{ Tar::External.new(@tar_name) }
46
- end
47
-
48
- def test_constructor_with_extension
49
- assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt') }
50
- end
51
-
52
- def test_constructor_with_program
53
- omit_unless(@@gzip_found){ 'gzip program not found - skipping' }
54
- assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt', 'gzip') }
55
- end
56
-
57
- def test_constructor_expected_errors
58
- assert_raise(ArgumentError){ Tar::External.new }
59
- end
60
-
61
- def test_tar_program
62
- assert_respond_to(@tar, :tar_program)
63
- assert_equal('tar', @tar.tar_program)
64
- end
65
-
66
- def test_archive_name
67
- assert_respond_to(@tar, :archive_name)
68
- assert_respond_to(@tar, :archive_name=)
69
-
70
- assert_equal('test.tar', @tar.archive_name)
71
- assert_nothing_raised{ @tar.archive_name }
72
- assert_nothing_raised{ @tar.archive_name = 'foo' }
73
- end
74
-
75
- def test_compressed_archive_name_get
76
- assert_respond_to(@tar, :compressed_archive_name)
77
- assert_nil(@tar.compressed_archive_name)
78
- end
79
-
80
- def test_compressed_archive_name_set
81
- assert_respond_to(@tar, :compressed_archive_name=)
82
- assert_nothing_raised{ @tar.compressed_archive_name = 'test.tar.gz' }
83
- assert_equal('test.tar.gz', @tar.compressed_archive_name)
84
- assert_equal('test.tar', @tar.archive_name)
85
-
86
- assert_nothing_raised{ @tar.compressed_archive_name = 'test.tgz' }
87
- assert_equal('test.tgz', @tar.compressed_archive_name)
88
- assert_equal('test.tar', @tar.archive_name)
89
- end
90
-
91
- def test_create_archive_basic
92
- assert_respond_to(@tar, :create_archive)
93
-
94
- assert_raises(ArgumentError){ @tar.create_archive }
95
- assert_raises(Tar::Error){ @tar.create_archive('*.blah') }
96
-
97
- assert_nothing_raised{ @tar.create_archive(@pattern) }
98
- assert_true(File.exists?(@tar_name))
99
- end
100
-
101
- def test_create_alias
102
- assert_respond_to(@tar, :create)
103
- assert_true(Tar::External.instance_method(:create) == Tar::External.instance_method(:create_archive))
104
- end
105
-
106
- def test_compress_archive_basic
107
- assert_respond_to(@tar, :compress_archive)
108
- end
109
-
110
- def test_compress_alias
111
- assert_respond_to(@tar, :compress)
112
- assert_true(Tar::External.instance_method(:compress) == Tar::External.instance_method(:compress_archive))
113
- end
114
-
115
- def test_compress_archive_gzip
116
- assert_nothing_raised{ @tar.create_archive('*.txt') }
117
- assert_nothing_raised{ @tar.compress_archive }
118
-
119
- assert_equal('test.tar.gz', @tar.compressed_archive_name)
120
- assert_true(File.exists?('test.tar.gz'))
121
- end
122
-
123
- def test_compress_archive_bzip2
124
- assert_nothing_raised{ @tar.create_archive('*.txt') }
125
- assert_nothing_raised{ @tar.compress_archive('bzip2') }
126
- assert_true(File.exists?('test.tar.bz2'))
127
- end
128
-
129
- def test_uncompress_archive
130
- assert_respond_to(@tar, :uncompress_archive)
131
- assert_nothing_raised{ @tar.create_archive('*.txt') }
132
- assert_nothing_raised{ @tar.compress_archive }
133
- assert_nothing_raised{ @tar.uncompress_archive }
134
- assert_false(File.exists?('test.tar.gz'))
135
- end
136
-
137
- def test_uncompress_archive_class_method
138
- assert_respond_to(Tar::External, :uncompress_archive)
139
- end
140
-
141
- def test_uncompress_alias
142
- assert_respond_to(Tar::External, :uncompress)
143
- assert_true(Tar::External.method(:uncompress) == Tar::External.method(:uncompress_archive))
144
- end
145
-
146
- def test_archive_info
147
- assert_respond_to(@tar, :archive_info)
148
- assert_nothing_raised{ @tar.create_archive('*.txt') }
149
- assert_equal(['temp1.txt','temp2.txt','temp3.txt'], @tar.archive_info)
150
- end
151
-
152
- def test_add_to_archive
153
- assert_respond_to(@tar,:add_to_archive)
154
- assert_nothing_raised{ @tar.create_archive('temp1.txt') }
155
- assert_nothing_raised{ @tar.add_to_archive('temp2.txt') }
156
- assert_nothing_raised{ @tar.add_to_archive('temp2.txt','temp3.txt') }
157
- end
158
-
159
- def test_update_archive
160
- assert_respond_to(@tar, :update_archive)
161
- assert_nothing_raised{ @tar.create_archive('*.txt') }
162
- assert_nothing_raised{ @tar.update_archive('temp2.txt') }
163
- end
164
-
165
- def test_extract_archive_basic
166
- assert_respond_to(@tar, :extract_archive)
167
- end
168
-
169
- def test_extract_archive_aliases
170
- assert_true(Tar::External.instance_method(:extract_archive) == Tar::External.instance_method(:expand_archive))
171
- assert_true(Tar::External.instance_method(:extract) == Tar::External.instance_method(:expand_archive))
172
- assert_true(Tar::External.instance_method(:expand) == Tar::External.instance_method(:expand_archive))
173
- end
174
-
175
- def test_extract_archive_advanced
176
- omit_unless(Config::CONFIG['host_os'] =~ /sunos|solaris/){
177
- assert_nothing_raised{ @tar.tar_program = @@gtar }
178
- }
179
- assert_nothing_raised{ @tar.create('*.txt') }
180
- assert_raises(Tar::Error){ @tar.expand('blah.txt') }
181
-
182
- assert_nothing_raised{ @tar.extract_archive }
183
- assert_nothing_raised{ @tar.extract_archive('temp2.txt') }
184
- end
185
-
186
- def teardown
187
- @tar = nil
188
- File.delete('test.tar') if File.exists?('test.tar')
189
- File.delete('test.tar.gz') if File.exists?('test.tar.gz')
190
- File.delete('test.tar.bz2') if File.exists?('test.tar.bz2')
191
- File.delete('test.tar.zip') if File.exists?('test.tar.zip')
192
- end
193
-
194
- def self.shutdown
195
- @@tar_foudn = nil
196
- @@gzip_found = nil
197
- @@bzip2_found = nil
198
-
199
- File.delete(@@tmp_file1) if File.exists?(@@tmp_file1)
200
- File.delete(@@tmp_file2) if File.exists?(@@tmp_file2)
201
- File.delete(@@tmp_file3) if File.exists?(@@tmp_file3)
202
- end
203
- end
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 'rubygems'
8
+ gem 'test-unit'
9
+
10
+ require 'archive/tar/external'
11
+ require 'test/unit'
12
+ require 'ptools'
13
+ include Archive
14
+
15
+ class TC_ArchiveTarExternal < Test::Unit::TestCase
16
+ def self.startup
17
+ Dir.chdir(File.dirname(File.expand_path(__FILE__)))
18
+
19
+ @@tmp_file1 = 'temp1.txt'
20
+ @@tmp_file2 = 'temp2.txt'
21
+ @@tmp_file3 = 'temp3.txt'
22
+
23
+ @@gtar_found = File.which('gtar')
24
+ @@tar_found = File.which('tar')
25
+ @@gzip_found = File.which('gzip')
26
+ @@bzip2_found = File.which('bzip2')
27
+
28
+ File.open(@@tmp_file1, 'w'){ |f| f.puts 'This is a temporary text file' }
29
+ File.open(@@tmp_file2, 'w'){ |f| f.puts 'This is a temporary text file' }
30
+ File.open(@@tmp_file3, 'w'){ |f| f.puts 'This is a temporary text file' }
31
+ end
32
+
33
+ def setup
34
+ @tar = Tar::External.new('test.tar')
35
+ @tar_name = 'test.tar'
36
+ @pattern = '*.txt'
37
+ @archive = 'temp.tar.gz'
38
+ end
39
+
40
+ def test_version
41
+ assert_equal('1.3.1', Tar::External::VERSION)
42
+ end
43
+
44
+ def test_constructor
45
+ assert_nothing_raised{ Tar::External.new(@tar_name) }
46
+ end
47
+
48
+ def test_constructor_with_extension
49
+ assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt') }
50
+ end
51
+
52
+ def test_constructor_with_program
53
+ omit_unless(@@gzip_found){ 'gzip program not found - skipping' }
54
+ assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt', 'gzip') }
55
+ end
56
+
57
+ def test_constructor_expected_errors
58
+ assert_raise(ArgumentError){ Tar::External.new }
59
+ end
60
+
61
+ def test_tar_program
62
+ assert_respond_to(@tar, :tar_program)
63
+ assert_equal('tar', @tar.tar_program)
64
+ end
65
+
66
+ def test_archive_name
67
+ assert_respond_to(@tar, :archive_name)
68
+ assert_respond_to(@tar, :archive_name=)
69
+
70
+ assert_equal('test.tar', @tar.archive_name)
71
+ assert_nothing_raised{ @tar.archive_name }
72
+ assert_nothing_raised{ @tar.archive_name = 'foo' }
73
+ end
74
+
75
+ def test_compressed_archive_name_get
76
+ assert_respond_to(@tar, :compressed_archive_name)
77
+ assert_nil(@tar.compressed_archive_name)
78
+ end
79
+
80
+ def test_compressed_archive_name_set
81
+ assert_respond_to(@tar, :compressed_archive_name=)
82
+ assert_nothing_raised{ @tar.compressed_archive_name = 'test.tar.gz' }
83
+ assert_equal('test.tar.gz', @tar.compressed_archive_name)
84
+ assert_equal('test.tar', @tar.archive_name)
85
+
86
+ assert_nothing_raised{ @tar.compressed_archive_name = 'test.tgz' }
87
+ assert_equal('test.tgz', @tar.compressed_archive_name)
88
+ assert_equal('test.tar', @tar.archive_name)
89
+ end
90
+
91
+ def test_create_archive_basic
92
+ assert_respond_to(@tar, :create_archive)
93
+
94
+ assert_raises(ArgumentError){ @tar.create_archive }
95
+ assert_raises(Tar::Error){ @tar.create_archive('*.blah') }
96
+
97
+ assert_nothing_raised{ @tar.create_archive(@pattern) }
98
+ assert_true(File.exists?(@tar_name))
99
+ end
100
+
101
+ def test_create_alias
102
+ assert_respond_to(@tar, :create)
103
+ assert_true(Tar::External.instance_method(:create) == Tar::External.instance_method(:create_archive))
104
+ end
105
+
106
+ def test_compress_archive_basic
107
+ assert_respond_to(@tar, :compress_archive)
108
+ end
109
+
110
+ def test_compress_alias
111
+ assert_respond_to(@tar, :compress)
112
+ assert_true(Tar::External.instance_method(:compress) == Tar::External.instance_method(:compress_archive))
113
+ end
114
+
115
+ def test_compress_archive_gzip
116
+ assert_nothing_raised{ @tar.create_archive('*.txt') }
117
+ assert_nothing_raised{ @tar.compress_archive }
118
+
119
+ assert_equal('test.tar.gz', @tar.compressed_archive_name)
120
+ assert_true(File.exists?('test.tar.gz'))
121
+ end
122
+
123
+ def test_compress_archive_bzip2
124
+ assert_nothing_raised{ @tar.create_archive('*.txt') }
125
+ assert_nothing_raised{ @tar.compress_archive('bzip2') }
126
+ assert_true(File.exists?('test.tar.bz2'))
127
+ end
128
+
129
+ def test_uncompress_archive
130
+ assert_respond_to(@tar, :uncompress_archive)
131
+ assert_nothing_raised{ @tar.create_archive('*.txt') }
132
+ assert_nothing_raised{ @tar.compress_archive }
133
+ assert_nothing_raised{ @tar.uncompress_archive }
134
+ assert_false(File.exists?('test.tar.gz'))
135
+ end
136
+
137
+ def test_uncompress_archive_class_method
138
+ assert_respond_to(Tar::External, :uncompress_archive)
139
+ end
140
+
141
+ def test_uncompress_alias
142
+ assert_respond_to(Tar::External, :uncompress)
143
+ assert_true(Tar::External.method(:uncompress) == Tar::External.method(:uncompress_archive))
144
+ end
145
+
146
+ def test_archive_info
147
+ assert_respond_to(@tar, :archive_info)
148
+ assert_nothing_raised{ @tar.create_archive('*.txt') }
149
+ assert_equal(['temp1.txt','temp2.txt','temp3.txt'], @tar.archive_info)
150
+ end
151
+
152
+ def test_add_to_archive
153
+ assert_respond_to(@tar,:add_to_archive)
154
+ assert_nothing_raised{ @tar.create_archive('temp1.txt') }
155
+ assert_nothing_raised{ @tar.add_to_archive('temp2.txt') }
156
+ assert_nothing_raised{ @tar.add_to_archive('temp2.txt','temp3.txt') }
157
+ end
158
+
159
+ def test_update_archive
160
+ assert_respond_to(@tar, :update_archive)
161
+ assert_nothing_raised{ @tar.create_archive('*.txt') }
162
+ assert_nothing_raised{ @tar.update_archive('temp2.txt') }
163
+ end
164
+
165
+ def test_extract_archive_basic
166
+ assert_respond_to(@tar, :extract_archive)
167
+ end
168
+
169
+ def test_extract_archive_aliases
170
+ assert_true(Tar::External.instance_method(:extract_archive) == Tar::External.instance_method(:expand_archive))
171
+ assert_true(Tar::External.instance_method(:extract) == Tar::External.instance_method(:expand_archive))
172
+ assert_true(Tar::External.instance_method(:expand) == Tar::External.instance_method(:expand_archive))
173
+ end
174
+
175
+ def test_extract_archive_advanced
176
+ omit_unless(Config::CONFIG['host_os'] =~ /sunos|solaris/){
177
+ assert_nothing_raised{ @tar.tar_program = @@gtar }
178
+ }
179
+ assert_nothing_raised{ @tar.create('*.txt') }
180
+ assert_raises(Tar::Error){ @tar.expand('blah.txt') }
181
+
182
+ assert_nothing_raised{ @tar.extract_archive }
183
+ assert_nothing_raised{ @tar.extract_archive('temp2.txt') }
184
+ end
185
+
186
+ def teardown
187
+ @tar = nil
188
+ File.delete('test.tar') if File.exists?('test.tar')
189
+ File.delete('test.tar.gz') if File.exists?('test.tar.gz')
190
+ File.delete('test.tar.bz2') if File.exists?('test.tar.bz2')
191
+ File.delete('test.tar.zip') if File.exists?('test.tar.zip')
192
+ end
193
+
194
+ def self.shutdown
195
+ @@tar_foudn = nil
196
+ @@gzip_found = nil
197
+ @@bzip2_found = nil
198
+
199
+ File.delete(@@tmp_file1) if File.exists?(@@tmp_file1)
200
+ File.delete(@@tmp_file2) if File.exists?(@@tmp_file2)
201
+ File.delete(@@tmp_file3) if File.exists?(@@tmp_file3)
202
+ end
203
+ end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archive-tar-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 1
10
+ version: 1.3.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Daniel Berger
@@ -9,39 +15,36 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-01-16 00:00:00 -07:00
13
- default_executable:
18
+ date: 2011-09-21 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: test-unit
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
23
- version: 2.0.3
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: ptools
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
27
32
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.1.7
34
- version:
33
+ version_requirements: *id001
35
34
  - !ruby/object:Gem::Dependency
36
- name: win32-open3
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
35
+ name: ptools
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
40
39
  requirements:
41
40
  - - ">="
42
41
  - !ruby/object:Gem::Version
43
- version: 0.3.1
44
- version:
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
45
48
  description: " The archive-tar-external is a simple wrapper interface for creating\n tar files using your system's tar command. You can also easily compress\n your tar files with your system's compression programs such as zip, gzip,\n or bzip2.\n"
46
49
  email: djberg96@gmail.com
47
50
  executables: []
@@ -62,7 +65,6 @@ files:
62
65
  - Rakefile
63
66
  - README
64
67
  - test/test_archive_tar_external.rb
65
- has_rdoc: true
66
68
  homepage: http://www.rubyforge.org/shards
67
69
  licenses:
68
70
  - Artistic 2.0
@@ -72,21 +74,27 @@ rdoc_options: []
72
74
  require_paths:
73
75
  - lib
74
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
75
78
  requirements:
76
79
  - - ">="
77
80
  - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
78
84
  version: "0"
79
- version:
80
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
81
87
  requirements:
82
88
  - - ">="
83
89
  - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
84
93
  version: "0"
85
- version:
86
94
  requirements: []
87
95
 
88
96
  rubyforge_project: shards
89
- rubygems_version: 1.3.5
97
+ rubygems_version: 1.8.10
90
98
  signing_key:
91
99
  specification_version: 3
92
100
  summary: A simple way to create tar archives using external calls