Geminstaller C0 Coverage Information - RCov

lib/geminstaller/enhanced_stream_ui.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/geminstaller/enhanced_stream_ui.rb 71 55
57.75%
52.73%

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 module GemInstaller
2   class EnhancedStreamUI < Gem::StreamUI
3     attr_writer :outs, :errs
4     attr_writer :gem_interaction_handler if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
5     
6     def initialize()
7       # override default constructor to have no args
8     end
9     
10     def ask_yes_no(question, default=nil)
11       if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
12         # Using defaults, we expect no interactive prompts RubyGems >= 0.9.5
13         begin
14           @gem_interaction_handler.handle_ask_yes_no(question)
15         rescue Exception => e
16           @outs.print(question)
17           @outs.flush
18           raise e
19         end
20       end
21       raise_unexpected_prompt_error(question)
22     end
23     
24     def ask(question)
25       raise_unexpected_prompt_error(question)
26     end
27     
28     def choose_from_list(question, list)
29       if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
30         # Using defaults, we expect no interactive prompts RubyGems >= 0.9.5
31         @gem_interaction_handler.handle_choose_from_list(question, list)
32       else
33         list_string = list.join("\n")
34         question_and_list = "#{question}\n#{list_string}"
35         raise_unexpected_prompt_error(question_and_list)
36       end
37     end
38 
39     if GemInstaller::RubyGemsVersionChecker.matches?('<=1.0.1')
40     # explicit exit in terminate_interation was removed after 1.0.1
41     def terminate_interaction!(status=-1)
42       raise_error(status)
43     end
44     
45     def terminate_interaction(status=0)
46       raise_error(status) unless status == 0
47       raise GemInstaller::RubyGemsExit.new(status)
48     end
49     end
50     
51     def alert_error(statement, question=nil)
52       # if alert_error got called due to a GemInstaller::UnexpectedPromptError, re-throw it
53       last_exception = $!
54       if last_exception.class == GemInstaller::UnauthorizedDependencyPromptError || last_exception.class == GemInstaller::RubyGemsExit
55         raise last_exception
56       end
57       # otherwise let alert_error continue normally...
58       super(statement, question)
59     end
60     
61     protected
62     def raise_error(status)
63       raise GemInstaller::GemInstallerError.new("RubyGems exited abnormally.  Status: #{status}\n")
64     end
65     
66     def raise_unexpected_prompt_error(question)
67       raise GemInstaller::UnexpectedPromptError.new("GemInstaller Internal Error - Unexpected prompt received from RubyGems: '#{question}'.")
68     end
69 
70   end
71 end

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