C0 code coverage information

Generated on Wed Oct 07 08:34:05 -0700 2009 with rcov 0.8.2.1


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
lib/buildr/packaging/zip.rb 73 34
87.7%  
73.5%  
 1 # Licensed to the Apache Software Foundation (ASF) under one or more
 2 # contributor license agreements.  See the NOTICE file distributed with this
 3 # work for additional information regarding copyright ownership.  The ASF
 4 # licenses this file to you under the Apache License, Version 2.0 (the
 5 # "License"); you may not use this file except in compliance with the License.
 6 # You may obtain a copy of the License at
 7 #
 8 #    http://www.apache.org/licenses/LICENSE-2.0
 9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
13 # License for the specific language governing permissions and limitations under
14 # the License.
15 
16 
17 if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9
18   $LOADED_FEATURES.unshift 'ftools'
19   require 'fileutils'
20   def File.move(source, dest)
21     FileUtils.move source, dest
22   end
23   def File.rm_rf(path)
24     FileUtils.rm_rf path
25   end
26 end
27 require 'zip/zip'
28 require 'zip/zipfilesystem'
29 
30 
31 module Zip #:nodoc:
32 
33   class ZipCentralDirectory #:nodoc:
34     # Patch to add entries in alphabetical order.
35     def write_to_stream(io)
36       offset = io.tell
37       @entrySet.sort { |a,b| a.name <=> b.name }.each { |entry| entry.write_c_dir_entry(io) }
38       write_e_o_c_d(io, offset)
39     end
40   end
41 
42 
43   class ZipEntry
44 
45     # :call-seq:
46     #   exist() => boolean
47     #
48     # Returns true if this entry exists.
49     def exist?()
50       Zip::ZipFile.open(zipfile) { |zip| zip.file.exist?(@name) }
51     end
52 
53     # :call-seq:
54     #   empty?() => boolean
55     #
56     # Returns true if this entry is empty.
57     def empty?()
58       Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }.empty?
59     end
60 
61     # :call-seq:
62     #   contain(patterns*) => boolean
63     #
64     # Returns true if this ZIP file entry matches against all the arguments. An argument may be
65     # a string or regular expression.
66     def contain?(*patterns)
67       content = Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }
68       patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
69         all? { |pattern| content =~ pattern }
70     end
71 
72   end
73 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.2.1.

Valid XHTML 1.0! Valid CSS!