Geminstaller C0 Coverage Information - RCov

spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/package.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/package.rb 97 74
54.64%
43.24%

Key

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.

Coverage Details

1 # -*- coding: utf-8 -*-
2 #--
3 # Copyright (C) 2004 Mauricio Julio Fernández Pradier
4 # See LICENSE.txt for additional licensing information.
5 #++
6 
7 require 'fileutils'
8 require 'find'
9 require 'stringio'
10 require 'yaml'
11 require 'zlib'
12 
13 require 'rubygems/security'
14 require 'rubygems/specification'
15 
16 ##
17 # Wrapper for FileUtils meant to provide logging and additional operations if
18 # needed.
19 
20 class Gem::FileOperations
21 
22   def initialize(logger = nil)
23     @logger = logger
24   end
25 
26   def method_missing(meth, *args, &block)
27     case
28     when FileUtils.respond_to?(meth)
29       @logger.log "#{meth}: #{args}" if @logger
30       FileUtils.send meth, *args, &block
31     when Gem::FileOperations.respond_to?(meth)
32       @logger.log "#{meth}: #{args}" if @logger
33       Gem::FileOperations.send meth, *args, &block
34     else
35       super
36     end
37   end
38 
39 end
40 
41 module Gem::Package
42 
43   class Error < StandardError; end
44   class NonSeekableIO < Error; end
45   class ClosedIO < Error; end
46   class BadCheckSum < Error; end
47   class TooLongFileName < Error; end
48   class FormatError < Error; end
49 
50   def self.open(io, mode = "r", signer = nil, &block)
51     tar_type = case mode
52                when 'r' then TarInput
53                when 'w' then TarOutput
54                else
55                  raise "Unknown Package open mode"
56                end
57 
58     tar_type.open(io, signer, &block)
59   end
60 
61   def self.pack(src, destname, signer = nil)
62     TarOutput.open(destname, signer) do |outp|
63       dir_class.chdir(src) do
64         outp.metadata = (file_class.read("RPA/metadata") rescue nil)
65         find_class.find('.') do |entry|
66           case
67           when file_class.file?(entry)
68             entry.sub!(%r{\./}, "")
69             next if entry =~ /\ARPA\//
70             stat = File.stat(entry)
71             outp.add_file_simple(entry, stat.mode, stat.size) do |os|
72               file_class.open(entry, "rb") do |f|
73                 os.write(f.read(4096)) until f.eof?
74               end
75             end
76           when file_class.dir?(entry)
77             entry.sub!(%r{\./}, "")
78             next if entry == "RPA"
79             outp.mkdir(entry, file_class.stat(entry).mode)
80           else
81             raise "Don't know how to pack this yet!"
82           end
83         end
84       end
85     end
86   end
87 
88 end
89 
90 require 'rubygems/package/f_sync_dir'
91 require 'rubygems/package/tar_header'
92 require 'rubygems/package/tar_input'
93 require 'rubygems/package/tar_output'
94 require 'rubygems/package/tar_reader'
95 require 'rubygems/package/tar_reader/entry'
96 require 'rubygems/package/tar_writer'
97 

Generated on Mon May 10 23:40:28 -0700 2010 with rcov 0.9.8