C0 code coverage information generated on Wed Mar 15 10:52:01 MST 2006


Marked code looks like this.
This line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this.
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
./test/../bin/verify-hostnames.rb 81 81
69.1% 
62.1% 
 1 #! /usr/bin/ruby
 2 
 3 # == Usage
 4 #
 5 # verify-hostnames.rb [ -h | --help ] [ -v | --verbose ] equinix.psv
 6 #
 7 # == Author
 8 # Jared Harper
 9 
10 require 'rdoc/usage'
11 require 'getoptlong'
12 require 'rubygems'
13 require 'psvparse'
14 require 'hostname'
15 require_gem 'net-ssh'
16 
17 @verbose = false
18 @remote_user = 'build'
19 
20 class VerifyHosts
21   attr_reader :hosts, :parser
22 
23   def initialize(file)
24     @hosts = Array.new
25     @parser = PSVParse.new(file)
26 
27     psvHost = @parser.search(
28         {:search_term => 'HOST_NAME',
29          :search_field => :host_name,
30          :result_field => :all,
31          :negated => true})
32     psvHost.each do |row|
33       # JARED
34       # temporary code, remove when database has the reference class
35       case row[:reference_name]
36       when 'production-primary'
37         ref_code = 'pp'
38       when 'production-beta'
39         ref_code = 'pb'
40       when 'systemtest'
41         ref_code = 'st'
42       when 'systemtest-secondary'
43         ref_code = 'st'
44       when 'demo'
45         ref_code = 'dm'
46       else
47         ref_code = row[:reference_name]
48       end
49       # HARPER
50       @hosts.push(
51           HostName.new(row[:ip], row[:host_name], ref_code))
52     end
53   end
54 
55 end
56 
57 ###################### main ####################
58 
59 if __FILE__ == $0
60   opts = GetoptLong.new(
61       ["--verbose", "-v", GetoptLong::NO_ARGUMENT],
62       ["--help", "-h",  GetoptLong::NO_ARGUMENT])
63   opts.each do |opt, arg|
64     case opt
65       when '--verbose' then
66         @verbose = true
67       when '--help'
68         RDoc::usage
69     end
70   end
71   filename = ARGV.join(' ')
72 
73   all_hosts = VerifyHosts.new(filename)
74   all_hosts.hosts.each do |host|
75     if !host.verify_name
76       print "Error: #{host}\n"
77     end
78   end
79 end
80 
81 # vim:ts=2:sw=2:sts=2:et

Valid XHTML 1.0!Valid CSS!