aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-04-14 09:31:00 +0100
committerPeter Wilmott <p@p8952.info>2015-04-14 09:31:00 +0100
commit912cf958d000c2665d493af9b74fadbf21ad1b83 (patch)
treee822f00335465655774116a651d11d685d151043 /web/lib
parentPopulate CI Next column with build data (diff)
downloadruby-tinderbox-912cf958d000c2665d493af9b74fadbf21ad1b83.tar.gz
ruby-tinderbox-912cf958d000c2665d493af9b74fadbf21ad1b83.tar.bz2
ruby-tinderbox-912cf958d000c2665d493af9b74fadbf21ad1b83.zip
Patch minitar to work when there is a .sock file in the directory tree
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/helpers.rb100
1 files changed, 50 insertions, 50 deletions
diff --git a/web/lib/helpers.rb b/web/lib/helpers.rb
index 35ecd46..ab96e20 100644
--- a/web/lib/helpers.rb
+++ b/web/lib/helpers.rb
@@ -4,53 +4,53 @@ class String
end
end
-# module Archive::Tar::Minitar
-# class << self
-# def pack_file(entry, outputter)
-# outputter = outputter.tar if outputter.kind_of?(Archive::Tar::Minitar::Output)
-#
-# stats = {}
-#
-# if entry.kind_of?(Hash)
-# name = entry[:name]
-#
-# entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
-# else
-# name = entry
-# end
-#
-# name = name.sub(%r{\./}, '')
-# stat = File.stat(name)
-# stats[:mode] ||= stat.mode
-# stats[:mtime] ||= stat.mtime
-# stats[:size] = stat.size
-#
-# if RUBY_PLATFORM =~ /win32/
-# stats[:uid] = nil
-# stats[:gid] = nil
-# else
-# stats[:uid] ||= stat.uid
-# stats[:gid] ||= stat.gid
-# end
-#
-# case
-# when File.file?(name)
-# outputter.add_file_simple(name, stats) do |os|
-# stats[:current] = 0
-# yield :file_start, name, stats if block_given?
-# File.open(name, "rb") do |ff|
-# until ff.eof?
-# stats[:currinc] = os.write(ff.read(4096))
-# stats[:current] += stats[:currinc]
-# yield :file_progress, name, stats if block_given?
-# end
-# end
-# yield :file_done, name, stats if block_given?
-# end
-# when dir?(name)
-# yield :dir, name, stats if block_given?
-# outputter.mkdir(name, stats)
-# end
-# end
-# end
-# end
+module Archive::Tar::Minitar
+ class << self
+ def pack_file(entry, outputter)
+ outputter = outputter.tar if outputter.kind_of?(Archive::Tar::Minitar::Output)
+
+ stats = {}
+
+ if entry.kind_of?(Hash)
+ name = entry[:name]
+
+ entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
+ else
+ name = entry
+ end
+
+ name = name.sub(%r{\./}, '')
+ stat = File.stat(name)
+ stats[:mode] ||= stat.mode
+ stats[:mtime] ||= stat.mtime
+ stats[:size] = stat.size
+
+ if RUBY_PLATFORM =~ /win32/
+ stats[:uid] = nil
+ stats[:gid] = nil
+ else
+ stats[:uid] ||= stat.uid
+ stats[:gid] ||= stat.gid
+ end
+
+ case
+ when File.file?(name)
+ outputter.add_file_simple(name, stats) do |os|
+ stats[:current] = 0
+ yield :file_start, name, stats if block_given?
+ File.open(name, "rb") do |ff|
+ until ff.eof?
+ stats[:currinc] = os.write(ff.read(4096))
+ stats[:current] += stats[:currinc]
+ yield :file_progress, name, stats if block_given?
+ end
+ end
+ yield :file_done, name, stats if block_given?
+ end
+ when dir?(name)
+ yield :dir, name, stats if block_given?
+ outputter.mkdir(name, stats)
+ end
+ end
+ end
+end