archive-tar-external 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9b4c98cfeadc9a2a2e13c6bbe405a259bcce5df8
4
+ data.tar.gz: 61b6d4fc658f6d6c92f310e1cb8a960bc13b6d01
5
+ SHA512:
6
+ metadata.gz: 452b2cb1c65b81a885c981a3b26b4fecdfd429697f4a1d8e1b203c5342e60fafe5617965ec56fa2cd0389b5fb862194434ef9e0eb88a4c3921b7c44f35a43f68
7
+ data.tar.gz: 68fe98d2ced0181c51c33d63602a53258c3dc3b10e6b8cd1b7f19e8c08549d9286098c9c9db2976ce84d0b17e0a904390c00357bc6d8a3a174b023c632ce041b
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.3.2 - 14-Mar-2014
2
+ * The create_archive method now accepts an optional second argument that
3
+ specifies options to the tar command. The default is 'cf' (create file).
4
+ * The gem:create task was updated for Rubygems 2.x.
5
+ * Added rake as a development dependency.
6
+ * Ruby 1.8.x support has been dropped. This only matters for MS Windows.
7
+
1
8
  == 1.3.1 - 20-Sep-2011
2
9
  * Refactored the Rakefile a bit.
3
10
 
data/README CHANGED
@@ -17,7 +17,6 @@
17
17
  t = Tar::External.new('test.tar', '*.rb', 'gzip')
18
18
 
19
19
  == Prerequisites
20
- The win32-open3 library (MS Windows only).
21
20
  The 'tar' command line program.
22
21
  At least one compression program, e.g. gzip, bzip2, zip, etc.
23
22
 
@@ -26,10 +25,7 @@
26
25
  try to expand a file from an archive that does not contain that file.
27
26
 
28
27
  If you come across any other issues, please report them on the project
29
- page at http://www.rubyforge.org/projects/shards.
30
-
31
- == Future Plans
32
- Anything folks are looking for?
28
+ page at https://github.com/djberg96/archive-tar-external.
33
29
 
34
30
  == License
35
31
  Artistic 2.0
@@ -40,7 +36,7 @@
40
36
  warranties of merchantability and fitness for a particular purpose.
41
37
 
42
38
  == Copyright
43
- (C) 2003 - 2011 Daniel J. Berger
39
+ (C) 2003 - 2014 Daniel J. Berger
44
40
  All Rights Reserved
45
41
 
46
42
  == Author
data/Rakefile CHANGED
@@ -8,7 +8,12 @@ namespace :gem do
8
8
  desc 'Build the archive-tar-external gem'
9
9
  task :create do
10
10
  spec = eval(IO.read('archive-tar-external.gemspec'))
11
- Gem::Builder.new(spec).build
11
+ if Gem::VERSION < "2.0"
12
+ Gem::Builder.new(spec).build
13
+ else
14
+ require 'rubygems/package'
15
+ Gem::Package.build(spec)
16
+ end
12
17
  end
13
18
 
14
19
  desc 'Install the archive-tar-external library as a gem'
@@ -3,17 +3,15 @@ require 'rbconfig'
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'archive-tar-external'
6
- spec.version = '1.3.1'
6
+ spec.version = '1.3.2'
7
7
  spec.summary = 'A simple way to create tar archives using external calls'
8
8
  spec.license = 'Artistic 2.0'
9
9
  spec.author = 'Daniel Berger'
10
10
  spec.email = 'djberg96@gmail.com'
11
- spec.homepage = 'http://www.rubyforge.org/shards'
11
+ spec.homepage = 'https://github.com/djberg96/archive-tar-external'
12
12
  spec.test_file = 'test/test_archive_tar_external.rb'
13
13
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
14
14
 
15
- spec.rubyforge_project = 'shards'
16
-
17
15
  spec.extra_rdoc_files = [
18
16
  'README',
19
17
  'CHANGES',
@@ -30,10 +28,5 @@ Gem::Specification.new do |spec|
30
28
 
31
29
  spec.add_development_dependency('test-unit')
32
30
  spec.add_development_dependency('ptools')
33
-
34
- if File::ALT_SEPARATOR
35
- if RUBY_VERSION.to_f < 1.9 && RUBY_PLATFORM !~ /java/i
36
- spec.add_dependency('win32-open3')
37
- end
38
- end
31
+ spec.add_development_dependency('rake')
39
32
  end
@@ -70,8 +70,9 @@ Archive::Tar::External#compress_archive(program="gzip")
70
70
  simply be included as part of the program, e.g. "gzip -f".
71
71
 
72
72
  Archive::Tar::External#create(file_pattern)
73
- Archive::Tar::External#create_archive(file_pattern)
74
- Creates a new tarball, including those files which match 'file_pattern'.
73
+ Archive::Tar::External#create_archive(file_pattern, options = 'cf')
74
+ Creates a new tarball, including those files which match 'file_pattern'
75
+ using 'options', which are set to 'cf' (create file) by default.
75
76
 
76
77
  Archive::Tar::External#expand_archive(files=nil)
77
78
  Archive::Tar::External#extract_archive(files=nil)
@@ -1,12 +1,4 @@
1
- if File::ALT_SEPARATOR
2
- if RUBY_VERSION.to_f < 1.9 && RUBY_PLATFORM !~ /java/i
3
- require 'win32/open3'
4
- else
5
- require 'open3'
6
- end
7
- else
8
- require 'open3'
9
- end
1
+ require 'open3'
10
2
 
11
3
  # The Archive module serves as a namespace only.
12
4
  module Archive
@@ -19,13 +11,13 @@ module Archive
19
11
  class Error < StandardError; end
20
12
 
21
13
  # Raised if something goes wrong during the Tar#compress_archive or
22
- # Tar#uncompress_archive methods.
14
+ # Tar#uncompress_archive methods.
23
15
  class CompressError < StandardError; end
24
16
 
25
17
  # This class encapsulates tar & zip operations.
26
18
  class Tar::External
27
19
  # The version of the archive-tar-external library.
28
- VERSION = '1.3.1'
20
+ VERSION = '1.3.2'
29
21
 
30
22
  # The name of the archive file to be used, e.g. "test.tar"
31
23
  attr_accessor :archive_name
@@ -79,11 +71,13 @@ module Archive
79
71
  @compressed_archive_name = name
80
72
  end
81
73
 
82
- # Creates the archive using +file_pattern+. Any errors that occur
83
- # here will raise a Error.
74
+ # Creates the archive using +file_pattern+ using +options+ or 'cf'
75
+ # (create file) by default.
76
+ #
77
+ # Raises an Archive::Tar::Error if a failure occurs.
84
78
  #
85
- def create_archive(file_pattern)
86
- cmd = "#{@tar_program} cf #{@archive_name} #{file_pattern}"
79
+ def create_archive(file_pattern, options = 'cf')
80
+ cmd = "#{@tar_program} #{options} #{@archive_name} #{file_pattern}"
87
81
 
88
82
  Open3.popen3(cmd){ |tar_in, tar_out, tar_err|
89
83
  err = tar_err.gets
@@ -107,7 +101,7 @@ module Archive
107
101
  cmd = "#{program} #{@archive_name}"
108
102
 
109
103
  Open3.popen3(cmd){ |prog_in, prog_out, prog_err|
110
- err = prog_err.gets
104
+ err = prog_err.gets
111
105
  raise CompressError, err.chomp if err
112
106
 
113
107
  # Find the new file name with the extension. There's probably a more
@@ -135,7 +129,7 @@ module Archive
135
129
  unless @compressed_archive_name
136
130
  raise CompressError, "no compressed file found"
137
131
  end
138
-
132
+
139
133
  cmd = "#{program} #{@compressed_archive_name}"
140
134
 
141
135
  Open3.popen3(cmd){ |prog_in, prog_out, prog_err|
@@ -4,11 +4,8 @@
4
4
  # Test suite for the archive-tar-external library. This test case should be
5
5
  # run via the 'rake test' Rake task.
6
6
  ###############################################################################
7
- require 'rubygems'
8
- gem 'test-unit'
9
-
10
7
  require 'archive/tar/external'
11
- require 'test/unit'
8
+ require 'test-unit'
12
9
  require 'ptools'
13
10
  include Archive
14
11
 
@@ -38,7 +35,7 @@ class TC_ArchiveTarExternal < Test::Unit::TestCase
38
35
  end
39
36
 
40
37
  def test_version
41
- assert_equal('1.3.1', Tar::External::VERSION)
38
+ assert_equal('1.3.2', Tar::External::VERSION)
42
39
  end
43
40
 
44
41
  def test_constructor
@@ -88,14 +85,22 @@ class TC_ArchiveTarExternal < Test::Unit::TestCase
88
85
  assert_equal('test.tar', @tar.archive_name)
89
86
  end
90
87
 
91
- def test_create_archive_basic
88
+ test "create_archive basic functionality" do
92
89
  assert_respond_to(@tar, :create_archive)
90
+ assert_nothing_raised{ @tar.create_archive(@pattern) }
91
+ assert_true(File.exists?(@tar_name))
92
+ end
93
93
 
94
+ test "create_archive requires at least on argument" do
94
95
  assert_raises(ArgumentError){ @tar.create_archive }
96
+ end
97
+
98
+ test "create_archive raises an error if no files match the pattern" do
95
99
  assert_raises(Tar::Error){ @tar.create_archive('*.blah') }
100
+ end
96
101
 
97
- assert_nothing_raised{ @tar.create_archive(@pattern) }
98
- assert_true(File.exists?(@tar_name))
102
+ test "create_archive accepts optional parameters" do
103
+ assert_nothing_raised{ @tar.create_archive(@pattern, 'cfj') }
99
104
  end
100
105
 
101
106
  def test_create_alias
@@ -167,14 +172,14 @@ class TC_ArchiveTarExternal < Test::Unit::TestCase
167
172
  end
168
173
 
169
174
  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))
175
+ assert_true(Tar::External.instance_method(:extract_archive) == Tar::External.instance_method(:expand_archive))
176
+ assert_true(Tar::External.instance_method(:extract) == Tar::External.instance_method(:expand_archive))
177
+ assert_true(Tar::External.instance_method(:expand) == Tar::External.instance_method(:expand_archive))
173
178
  end
174
179
 
175
180
  def test_extract_archive_advanced
176
- omit_unless(Config::CONFIG['host_os'] =~ /sunos|solaris/){
177
- assert_nothing_raised{ @tar.tar_program = @@gtar }
181
+ omit_unless(RbConfig::CONFIG['host_os'] =~ /sunos|solaris/){
182
+ assert_nothing_raised{ @tar.tar_program = @@gtar }
178
183
  }
179
184
  assert_nothing_raised{ @tar.create('*.txt') }
180
185
  assert_raises(Tar::Error){ @tar.expand('blah.txt') }
metadata CHANGED
@@ -1,102 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: archive-tar-external
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
6
- segments:
7
- - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Daniel Berger
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-09-21 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: test-unit
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
35
28
  name: ptools
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
36
35
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
46
48
  type: :development
47
- version_requirements: *id002
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"
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: |2
56
+ The archive-tar-external is a simple wrapper interface for creating
57
+ tar files using your system's tar command. You can also easily compress
58
+ your tar files with your system's compression programs such as zip, gzip,
59
+ or bzip2.
49
60
  email: djberg96@gmail.com
50
61
  executables: []
51
-
52
62
  extensions: []
53
-
54
- extra_rdoc_files:
63
+ extra_rdoc_files:
55
64
  - README
56
65
  - CHANGES
57
66
  - MANIFEST
58
67
  - doc/tar_external.txt
59
- files:
60
- - archive-tar-external.gemspec
68
+ files:
61
69
  - CHANGES
62
- - doc/tar_external.txt
63
- - lib/archive/tar/external.rb
64
70
  - MANIFEST
65
- - Rakefile
66
71
  - README
72
+ - Rakefile
73
+ - archive-tar-external.gemspec
74
+ - doc/tar_external.txt
75
+ - lib/archive/tar/external.rb
67
76
  - test/test_archive_tar_external.rb
68
- homepage: http://www.rubyforge.org/shards
69
- licenses:
77
+ homepage: https://github.com/djberg96/archive-tar-external
78
+ licenses:
70
79
  - Artistic 2.0
80
+ metadata: {}
71
81
  post_install_message:
72
82
  rdoc_options: []
73
-
74
- require_paths:
83
+ require_paths:
75
84
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
77
- none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
- version: "0"
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
94
95
  requirements: []
95
-
96
- rubyforge_project: shards
97
- rubygems_version: 1.8.10
96
+ rubyforge_project:
97
+ rubygems_version: 2.2.2
98
98
  signing_key:
99
- specification_version: 3
99
+ specification_version: 4
100
100
  summary: A simple way to create tar archives using external calls
101
- test_files:
101
+ test_files:
102
102
  - test/test_archive_tar_external.rb