Permalink
Browse files

Bumped version to 0.5.3.

Added pack_file options to tar file under different name.
  • Loading branch information...
daniele
daniele committed Jan 24, 2012
1 parent f718198 commit b1c6f95888970082c6500c040d60d69bcc42ca93
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/archive/tar/minitar.rb
View
@@ -231,8 +231,8 @@ def header(chksum)
# modified under the terms of the GPL version 2 (or later) or Ruby's
# licence.
module Archive::Tar::Minitar
- VERSION = "0.5.2"
-
+ VERSION = "0.5.3"
+
# The exception raised when a wrapped data stream class is expected to
# respond to #rewind or #pos but does not.
class NonSeekableStream < StandardError; end
@@ -349,7 +349,7 @@ def add_file_simple(name, opts = {}) # :yields BoundedStream:
remainder = (512 - (opts[:size] % 512)) % 512
@io.write("\0" * remainder)
end
-
+
# Adds a file to the archive as +name+. +opts+ must contain the
# following value:
#
@@ -895,7 +895,9 @@ def pack_file(entry, outputter) #:yields action, name, stats:
if entry.kind_of?(Hash)
name = entry[:name]
-
+ as = entry[:as]
+ as ||= name
+
entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
else
name = entry
@@ -917,7 +919,8 @@ def pack_file(entry, outputter) #:yields action, name, stats:
case
when File.file?(name)
- outputter.add_file_simple(name, stats) do |os|
+ puts "Adding file as: #{as}"
+ outputter.add_file_simple(as, stats) do |os|
stats[:current] = 0
yield :file_start, name, stats if block_given?
File.open(name, "rb") do |ff|

0 comments on commit b1c6f95

Please sign in to comment.