lib/buildmaster/cotta/cotta_file.rb in BuildMaster-1.1.9 vs lib/buildmaster/cotta/cotta_file.rb in BuildMaster-1.1.12

- old
+ new

@@ -1,11 +1,7 @@ require 'fileutils' -require 'rubygems/package' -$:.unshift File.dirname(__FILE__) -require 'io_chain' - module BuildMaster class CottaFile include IoChain attr_reader :system, :path, :stat @@ -157,20 +153,21 @@ def delete @system.delete_file(@path) end def extract(directory = nil) + require 'rubygems/package' directory = parent.dir(basename) unless directory read_binary do |io| reader = Gem::Package::TarReader.new(io) reader.each do |entry| full_name = entry.full_name - if (entry.is_file?) + if (entry.file?) directory.file(full_name).write_binary do |output| copy_io(entry, output) end - elsif (entry.is_directory?) + elsif (entry.directory?) directory.dir(full_name).mkdirs end end end directory @@ -208,14 +205,14 @@ return false unless other.kind_of? CottaFile return @system == other.system && @path == other.path end def to_s - @path + @path.to_s end def inspect return "#{self.class}:#{self.object_id}-#{@system.inspect}-#@path" end end -end \ No newline at end of file +end