rubygems-update 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (152) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +267 -1
  3. data/Rakefile +13 -7
  4. data/doc/release_notes/rel_1_2_0.rdoc +105 -0
  5. data/lib/rubygems.rb +82 -14
  6. data/lib/rubygems/command.rb +1 -1
  7. data/lib/rubygems/command_manager.rb +3 -2
  8. data/lib/rubygems/commands/cert_command.rb +1 -1
  9. data/lib/rubygems/commands/dependency_command.rb +57 -19
  10. data/lib/rubygems/commands/environment_command.rb +2 -0
  11. data/lib/rubygems/commands/fetch_command.rb +3 -1
  12. data/lib/rubygems/commands/install_command.rb +3 -3
  13. data/lib/rubygems/commands/list_command.rb +30 -28
  14. data/lib/rubygems/commands/lock_command.rb +1 -1
  15. data/lib/rubygems/commands/outdated_command.rb +5 -2
  16. data/lib/rubygems/commands/pristine_command.rb +3 -44
  17. data/lib/rubygems/commands/query_command.rb +80 -21
  18. data/lib/rubygems/commands/sources_command.rb +56 -28
  19. data/lib/rubygems/commands/specification_command.rb +4 -3
  20. data/lib/rubygems/commands/stale_command.rb +27 -0
  21. data/lib/rubygems/commands/update_command.rb +35 -22
  22. data/lib/rubygems/config_file.rb +29 -12
  23. data/lib/rubygems/custom_require.rb +1 -1
  24. data/lib/rubygems/defaults.rb +1 -1
  25. data/lib/rubygems/dependency.rb +63 -9
  26. data/lib/rubygems/dependency_installer.rb +60 -23
  27. data/lib/rubygems/dependency_list.rb +1 -1
  28. data/lib/rubygems/doc_manager.rb +5 -5
  29. data/lib/rubygems/gem_openssl.rb +1 -1
  30. data/lib/rubygems/indexer.rb +269 -84
  31. data/lib/rubygems/install_update_options.rb +6 -0
  32. data/lib/rubygems/installer.rb +35 -12
  33. data/lib/rubygems/local_remote_options.rb +26 -5
  34. data/lib/rubygems/platform.rb +15 -1
  35. data/lib/rubygems/remote_fetcher.rb +158 -90
  36. data/lib/rubygems/requirement.rb +16 -12
  37. data/lib/rubygems/rubygems_version.rb +1 -1
  38. data/lib/rubygems/security.rb +2 -2
  39. data/lib/rubygems/server.rb +239 -110
  40. data/lib/rubygems/source_index.rb +44 -18
  41. data/lib/rubygems/source_info_cache.rb +1 -1
  42. data/lib/rubygems/spec_fetcher.rb +251 -0
  43. data/lib/rubygems/specification.rb +120 -38
  44. data/lib/rubygems/test_utilities.rb +120 -0
  45. data/lib/rubygems/uninstaller.rb +11 -10
  46. data/lib/rubygems/user_interaction.rb +149 -74
  47. data/lib/rubygems/validator.rb +3 -3
  48. data/lib/rubygems/version.rb +23 -21
  49. data/setup.rb +105 -100
  50. data/test/gemutilities.rb +63 -86
  51. data/test/test_config.rb +0 -5
  52. data/test/test_gem.rb +22 -2
  53. data/test/test_gem_command_manager.rb +1 -1
  54. data/test/test_gem_commands_dependency_command.rb +125 -6
  55. data/test/test_gem_commands_environment_command.rb +1 -0
  56. data/test/test_gem_commands_fetch_command.rb +24 -4
  57. data/test/test_gem_commands_install_command.rb +6 -8
  58. data/test/{test_gem_outdated_command.rb → test_gem_commands_outdated_command.rb} +5 -2
  59. data/test/test_gem_commands_pristine_command.rb +13 -4
  60. data/test/test_gem_commands_query_command.rb +113 -37
  61. data/test/test_gem_commands_sources_command.rb +101 -31
  62. data/test/test_gem_commands_specification_command.rb +4 -1
  63. data/test/test_gem_commands_stale_command.rb +39 -0
  64. data/test/test_gem_commands_update_command.rb +17 -27
  65. data/test/test_gem_config_file.rb +38 -1
  66. data/test/test_gem_dependency.rb +51 -0
  67. data/test/test_gem_dependency_installer.rb +133 -25
  68. data/test/test_gem_gem_path_searcher.rb +4 -1
  69. data/test/test_gem_indexer.rb +124 -19
  70. data/test/test_gem_installer.rb +32 -2
  71. data/test/test_gem_local_remote_options.rb +6 -5
  72. data/test/test_gem_remote_fetcher.rb +14 -9
  73. data/test/test_gem_server.rb +207 -21
  74. data/test/test_gem_source_index.rb +203 -63
  75. data/test/test_gem_source_info_cache.rb +8 -6
  76. data/test/test_gem_source_info_cache_entry.rb +11 -9
  77. data/test/test_gem_spec_fetcher.rb +303 -0
  78. data/test/test_gem_specification.rb +91 -7
  79. data/test/test_gem_uninstaller.rb +21 -0
  80. data/test/test_gem_version.rb +14 -5
  81. data/test/test_kernel.rb +1 -1
  82. metadata +10 -73
  83. metadata.gz.sig +0 -0
  84. data/lib/rubygems/indexer/abstract_index_builder.rb +0 -88
  85. data/lib/rubygems/indexer/latest_index_builder.rb +0 -35
  86. data/lib/rubygems/indexer/marshal_index_builder.rb +0 -17
  87. data/lib/rubygems/indexer/master_index_builder.rb +0 -54
  88. data/lib/rubygems/indexer/quick_index_builder.rb +0 -50
  89. data/test/gem_installer_test_case.rbc +0 -0
  90. data/test/gem_package_tar_test_case.rbc +0 -0
  91. data/test/gemutilities.rbc +0 -0
  92. data/test/mockgemui.rbc +0 -0
  93. data/test/simple_gem.rbc +0 -0
  94. data/test/test_config.rbc +0 -0
  95. data/test/test_gem.rbc +0 -0
  96. data/test/test_gem_builder.rbc +0 -0
  97. data/test/test_gem_command.rbc +0 -0
  98. data/test/test_gem_command_manager.rbc +0 -0
  99. data/test/test_gem_commands_build_command.rbc +0 -0
  100. data/test/test_gem_commands_cert_command.rbc +0 -0
  101. data/test/test_gem_commands_check_command.rbc +0 -0
  102. data/test/test_gem_commands_contents_command.rbc +0 -0
  103. data/test/test_gem_commands_dependency_command.rbc +0 -0
  104. data/test/test_gem_commands_environment_command.rbc +0 -0
  105. data/test/test_gem_commands_fetch_command.rbc +0 -0
  106. data/test/test_gem_commands_generate_index_command.rbc +0 -0
  107. data/test/test_gem_commands_install_command.rbc +0 -0
  108. data/test/test_gem_commands_mirror_command.rbc +0 -0
  109. data/test/test_gem_commands_pristine_command.rbc +0 -0
  110. data/test/test_gem_commands_query_command.rbc +0 -0
  111. data/test/test_gem_commands_server_command.rbc +0 -0
  112. data/test/test_gem_commands_sources_command.rbc +0 -0
  113. data/test/test_gem_commands_specification_command.rbc +0 -0
  114. data/test/test_gem_commands_unpack_command.rbc +0 -0
  115. data/test/test_gem_commands_update_command.rbc +0 -0
  116. data/test/test_gem_config_file.rbc +0 -0
  117. data/test/test_gem_dependency.rbc +0 -0
  118. data/test/test_gem_dependency_installer.rbc +0 -0
  119. data/test/test_gem_dependency_list.rbc +0 -0
  120. data/test/test_gem_digest.rbc +0 -0
  121. data/test/test_gem_doc_manager.rbc +0 -0
  122. data/test/test_gem_ext_configure_builder.rbc +0 -0
  123. data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
  124. data/test/test_gem_ext_rake_builder.rbc +0 -0
  125. data/test/test_gem_format.rbc +0 -0
  126. data/test/test_gem_gem_path_searcher.rbc +0 -0
  127. data/test/test_gem_gem_runner.rbc +0 -0
  128. data/test/test_gem_indexer.rbc +0 -0
  129. data/test/test_gem_install_update_options.rbc +0 -0
  130. data/test/test_gem_installer.rbc +0 -0
  131. data/test/test_gem_local_remote_options.rbc +0 -0
  132. data/test/test_gem_outdated_command.rbc +0 -0
  133. data/test/test_gem_package_tar_header.rbc +0 -0
  134. data/test/test_gem_package_tar_input.rbc +0 -0
  135. data/test/test_gem_package_tar_output.rbc +0 -0
  136. data/test/test_gem_package_tar_reader.rbc +0 -0
  137. data/test/test_gem_package_tar_reader_entry.rbc +0 -0
  138. data/test/test_gem_package_tar_writer.rbc +0 -0
  139. data/test/test_gem_platform.rbc +0 -0
  140. data/test/test_gem_remote_fetcher.rbc +0 -0
  141. data/test/test_gem_requirement.rbc +0 -0
  142. data/test/test_gem_server.rbc +0 -0
  143. data/test/test_gem_source_index.rbc +0 -0
  144. data/test/test_gem_source_info_cache.rbc +0 -0
  145. data/test/test_gem_source_info_cache_entry.rbc +0 -0
  146. data/test/test_gem_specification.rbc +0 -0
  147. data/test/test_gem_stream_ui.rbc +0 -0
  148. data/test/test_gem_uninstaller.rbc +0 -0
  149. data/test/test_gem_validator.rbc +0 -0
  150. data/test/test_gem_version.rbc +0 -0
  151. data/test/test_gem_version_option.rbc +0 -0
  152. data/test/test_kernel.rbc +0 -0
@@ -0,0 +1,120 @@
1
+ require 'tempfile'
2
+ require 'rubygems'
3
+ require 'rubygems/remote_fetcher'
4
+
5
+ ##
6
+ # A fake Gem::RemoteFetcher for use in tests or to avoid real live HTTP
7
+ # requests when testing code that uses RubyGems.
8
+ #
9
+ # Example:
10
+ #
11
+ # @fetcher = Gem::FakeFetcher.new
12
+ # @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml
13
+ # Gem::RemoteFetcher.fetcher = @fetcher
14
+ #
15
+ # # invoke RubyGems code
16
+ #
17
+ # paths = @fetcher.paths
18
+ # assert_equal 'http://gems.example.com/yaml', paths.shift
19
+ # assert paths.empty?, paths.join(', ')
20
+ #
21
+ # See RubyGems' tests for more examples of FakeFetcher.
22
+
23
+ class Gem::FakeFetcher
24
+
25
+ attr_reader :data
26
+ attr_accessor :paths
27
+
28
+ def initialize
29
+ @data = {}
30
+ @paths = []
31
+ end
32
+
33
+ def fetch_path(path)
34
+ path = path.to_s
35
+ @paths << path
36
+ raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
37
+ data = @data[path]
38
+
39
+ if data.nil? then
40
+ raise Gem::RemoteFetcher::FetchError.new('no data', path)
41
+ end
42
+
43
+ data.respond_to?(:call) ? data.call : data
44
+ end
45
+
46
+ def fetch_size(path)
47
+ path = path.to_s
48
+ @paths << path
49
+ raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
50
+ data = @data[path]
51
+
52
+ if data.nil? then
53
+ raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", nil)
54
+ end
55
+
56
+ data.respond_to?(:call) ? data.call : data.length
57
+ end
58
+
59
+ def download spec, source_uri, install_dir = Gem.dir
60
+ name = "#{spec.full_name}.gem"
61
+ path = File.join(install_dir, 'cache', name)
62
+
63
+ Gem.ensure_gem_subdirectories install_dir
64
+
65
+ if source_uri =~ /^http/ then
66
+ File.open(path, "wb") do |f|
67
+ f.write fetch_path(File.join(source_uri, "gems", name))
68
+ end
69
+ else
70
+ FileUtils.cp source_uri, path
71
+ end
72
+
73
+ path
74
+ end
75
+
76
+ end
77
+
78
+ # :stopdoc:
79
+ class Gem::RemoteFetcher
80
+
81
+ def self.fetcher=(fetcher)
82
+ @fetcher = fetcher
83
+ end
84
+
85
+ end
86
+ # :startdoc:
87
+
88
+ ##
89
+ # A StringIO duck-typed class that uses Tempfile instead of String as the
90
+ # backing store.
91
+ #--
92
+ # This class was added to flush out problems in Rubinius' IO implementation.
93
+
94
+ class TempIO
95
+
96
+ @@count = 0
97
+
98
+ def initialize(string = '')
99
+ @tempfile = Tempfile.new "TempIO-#{@@count += 1}"
100
+ @tempfile.binmode
101
+ @tempfile.write string
102
+ @tempfile.rewind
103
+ end
104
+
105
+ def method_missing(meth, *args, &block)
106
+ @tempfile.send(meth, *args, &block)
107
+ end
108
+
109
+ def respond_to?(meth)
110
+ @tempfile.respond_to? meth
111
+ end
112
+
113
+ def string
114
+ @tempfile.flush
115
+
116
+ Gem.read_binary @tempfile.path
117
+ end
118
+
119
+ end
120
+
@@ -30,7 +30,7 @@ class Gem::Uninstaller
30
30
  @force_executables = options[:executables]
31
31
  @force_all = options[:all]
32
32
  @force_ignore = options[:ignore]
33
- @bin_dir = options[:bin_dir]
33
+ @bin_dir = options[:bin_dir]
34
34
  end
35
35
 
36
36
  ##
@@ -41,17 +41,17 @@ class Gem::Uninstaller
41
41
  list = Gem.source_index.search(/^#{@gem}$/, @version)
42
42
 
43
43
  if list.empty? then
44
- raise Gem::InstallError, "Unknown gem #{@gem}-#{@version}"
44
+ raise Gem::InstallError, "Unknown gem #{@gem} #{@version}"
45
45
  elsif list.size > 1 && @force_all
46
- remove_all(list.dup)
46
+ remove_all(list.dup)
47
47
  remove_executables(list.last)
48
- elsif list.size > 1
49
- say
48
+ elsif list.size > 1
49
+ say
50
50
  gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
51
51
  gem_name, index =
52
52
  choose_from_list("Select gem to uninstall:", gem_names)
53
53
  if index == list.size
54
- remove_all(list.dup)
54
+ remove_all(list.dup)
55
55
  remove_executables(list.last)
56
56
  elsif index >= 0 && index < list.size
57
57
  to_remove = list[index]
@@ -65,7 +65,7 @@ class Gem::Uninstaller
65
65
  remove_executables(list.last)
66
66
  end
67
67
  end
68
-
68
+
69
69
  ##
70
70
  # Removes installed executables and batch files (windows only) for
71
71
  # +gemspec+.
@@ -111,7 +111,7 @@ class Gem::Uninstaller
111
111
  end
112
112
  end
113
113
  end
114
-
114
+
115
115
  ##
116
116
  # Removes all gems in +list+.
117
117
  #
@@ -176,9 +176,10 @@ class Gem::Uninstaller
176
176
  end
177
177
 
178
178
  def path_ok?(spec)
179
- match_path = File.join @gem_home, 'gems', spec.full_name
179
+ full_path = File.join @gem_home, 'gems', spec.full_name
180
+ original_path = File.join @gem_home, 'gems', spec.original_name
180
181
 
181
- match_path == spec.full_gem_path
182
+ full_path == spec.full_gem_path || original_path == spec.full_gem_path
182
183
  end
183
184
 
184
185
  def dependencies_ok?(spec)
@@ -6,54 +6,71 @@
6
6
 
7
7
  module Gem
8
8
 
9
- ####################################################################
10
- # Module that defines the default UserInteraction. Any class
11
- # including this module will have access to the +ui+ method that
12
- # returns the default UI.
9
+ ##
10
+ # Module that defines the default UserInteraction. Any class including this
11
+ # module will have access to the +ui+ method that returns the default UI.
12
+
13
13
  module DefaultUserInteraction
14
14
 
15
+ ##
16
+ # The default UI is a class variable of the singleton class for this
17
+ # module.
18
+
19
+ @ui = nil
20
+
21
+ ##
15
22
  # Return the default UI.
23
+
24
+ def self.ui
25
+ @ui ||= Gem::ConsoleUI.new
26
+ end
27
+
28
+ ##
29
+ # Set the default UI. If the default UI is never explicitly set, a simple
30
+ # console based UserInteraction will be used automatically.
31
+
32
+ def self.ui=(new_ui)
33
+ @ui = new_ui
34
+ end
35
+
36
+ ##
37
+ # Use +new_ui+ for the duration of +block+.
38
+
39
+ def self.use_ui(new_ui)
40
+ old_ui = @ui
41
+ @ui = new_ui
42
+ yield
43
+ ensure
44
+ @ui = old_ui
45
+ end
46
+
47
+ ##
48
+ # See DefaultUserInteraction::ui
49
+
16
50
  def ui
17
51
  DefaultUserInteraction.ui
18
52
  end
19
53
 
20
- # Set the default UI. If the default UI is never explicity set, a
21
- # simple console based UserInteraction will be used automatically.
54
+ ##
55
+ # See DefaultUserInteraction::ui=
56
+
22
57
  def ui=(new_ui)
23
58
  DefaultUserInteraction.ui = new_ui
24
59
  end
25
60
 
61
+ ##
62
+ # See DefaultUserInteraction::use_ui
63
+
26
64
  def use_ui(new_ui, &block)
27
65
  DefaultUserInteraction.use_ui(new_ui, &block)
28
66
  end
29
67
 
30
- # The default UI is a class variable of the singleton class for
31
- # this module.
32
-
33
- @ui = nil
34
-
35
- class << self
36
- def ui
37
- @ui ||= Gem::ConsoleUI.new
38
- end
39
- def ui=(new_ui)
40
- @ui = new_ui
41
- end
42
- def use_ui(new_ui)
43
- old_ui = @ui
44
- @ui = new_ui
45
- yield
46
- ensure
47
- @ui = old_ui
48
- end
49
- end
50
68
  end
51
69
 
52
- ####################################################################
70
+ ##
53
71
  # Make the default UI accessable without the "ui." prefix. Classes
54
- # including this module may use the interaction methods on the
55
- # default UI directly. Classes may also reference the +ui+ and
56
- # <tt>ui=</tt> methods.
72
+ # including this module may use the interaction methods on the default UI
73
+ # directly. Classes may also reference the ui and ui= methods.
57
74
  #
58
75
  # Example:
59
76
  #
@@ -64,22 +81,30 @@ module Gem
64
81
  # n = ask("What is the meaning of life?")
65
82
  # end
66
83
  # end
84
+
67
85
  module UserInteraction
86
+
68
87
  include DefaultUserInteraction
69
- [
70
- :choose_from_list, :ask, :ask_yes_no, :say, :alert, :alert_warning,
71
- :alert_error, :terminate_interaction
72
- ].each do |methname|
88
+
89
+ [:alert,
90
+ :alert_error,
91
+ :alert_warning,
92
+ :ask,
93
+ :ask_yes_no,
94
+ :choose_from_list,
95
+ :say,
96
+ :terminate_interaction ].each do |methname|
73
97
  class_eval %{
74
98
  def #{methname}(*args)
75
99
  ui.#{methname}(*args)
76
100
  end
77
- }
101
+ }, __FILE__, __LINE__
78
102
  end
79
103
  end
80
104
 
81
- ####################################################################
105
+ ##
82
106
  # StreamUI implements a simple stream based user interface.
107
+
83
108
  class StreamUI
84
109
 
85
110
  attr_reader :ins, :outs, :errs
@@ -89,15 +114,19 @@ module Gem
89
114
  @outs = out_stream
90
115
  @errs = err_stream
91
116
  end
92
-
93
- # Choose from a list of options. +question+ is a prompt displayed
94
- # above the list. +list+ is a list of option strings. Returns
95
- # the pair [option_name, option_index].
117
+
118
+ ##
119
+ # Choose from a list of options. +question+ is a prompt displayed above
120
+ # the list. +list+ is a list of option strings. Returns the pair
121
+ # [option_name, option_index].
122
+
96
123
  def choose_from_list(question, list)
97
124
  @outs.puts question
125
+
98
126
  list.each_with_index do |item, index|
99
127
  @outs.puts " #{index+1}. #{item}"
100
128
  end
129
+
101
130
  @outs.print "> "
102
131
  @outs.flush
103
132
 
@@ -109,28 +138,32 @@ module Gem
109
138
  return list[result], result
110
139
  end
111
140
 
112
- # Ask a question. Returns a true for yes, false for no. If not
113
- # connected to a tty, raises an exception if default is nil,
114
- # otherwise returns default.
141
+ ##
142
+ # Ask a question. Returns a true for yes, false for no. If not connected
143
+ # to a tty, raises an exception if default is nil, otherwise returns
144
+ # default.
145
+
115
146
  def ask_yes_no(question, default=nil)
116
- if not @ins.tty? then
147
+ unless @ins.tty? then
117
148
  if default.nil? then
118
- raise(
119
- Gem::OperationNotSupportedError,
120
- "Not connected to a tty and no default specified")
149
+ raise Gem::OperationNotSupportedError,
150
+ "Not connected to a tty and no default specified"
121
151
  else
122
152
  return default
123
153
  end
124
154
  end
155
+
125
156
  qstr = case default
126
- when nil
127
- 'yn'
128
- when true
129
- 'Yn'
130
- else
131
- 'yN'
132
- end
157
+ when nil
158
+ 'yn'
159
+ when true
160
+ 'Yn'
161
+ else
162
+ 'yN'
163
+ end
164
+
133
165
  result = nil
166
+
134
167
  while result.nil?
135
168
  result = ask("#{question} [#{qstr}]")
136
169
  result = case result
@@ -144,51 +177,68 @@ module Gem
144
177
  nil
145
178
  end
146
179
  end
180
+
147
181
  return result
148
182
  end
149
-
150
- # Ask a question. Returns an answer if connected to a tty, nil
151
- # otherwise.
183
+
184
+ ##
185
+ # Ask a question. Returns an answer if connected to a tty, nil otherwise.
186
+
152
187
  def ask(question)
153
188
  return nil if not @ins.tty?
189
+
154
190
  @outs.print(question + " ")
155
191
  @outs.flush
192
+
156
193
  result = @ins.gets
157
194
  result.chomp! if result
158
195
  result
159
196
  end
160
-
197
+
198
+ ##
161
199
  # Display a statement.
200
+
162
201
  def say(statement="")
163
202
  @outs.puts statement
164
203
  end
165
-
166
- # Display an informational alert.
204
+
205
+ ##
206
+ # Display an informational alert. Will ask +question+ if it is not nil.
207
+
167
208
  def alert(statement, question=nil)
168
209
  @outs.puts "INFO: #{statement}"
169
- return ask(question) if question
210
+ ask(question) if question
170
211
  end
171
-
172
- # Display a warning in a location expected to get error messages.
212
+
213
+ ##
214
+ # Display a warning in a location expected to get error messages. Will
215
+ # ask +question+ if it is not nil.
216
+
173
217
  def alert_warning(statement, question=nil)
174
218
  @errs.puts "WARNING: #{statement}"
175
- ask(question) if question
219
+ ask(question) if question
176
220
  end
177
-
178
- # Display an error message in a location expected to get error
179
- # messages.
221
+
222
+ ##
223
+ # Display an error message in a location expected to get error messages.
224
+ # Will ask +question+ if it is not nil.
225
+
180
226
  def alert_error(statement, question=nil)
181
227
  @errs.puts "ERROR: #{statement}"
182
228
  ask(question) if question
183
229
  end
184
230
 
185
- # Terminate the appliation normally, running any exit handlers
186
- # that might have been defined.
231
+ ##
232
+ # Terminate the application with exit code +status+, running any exit
233
+ # handlers that might have been defined.
234
+
187
235
  def terminate_interaction(status = 0)
188
236
  raise Gem::SystemExitException, status
189
237
  end
190
238
 
191
- # Return a progress reporter object
239
+ ##
240
+ # Return a progress reporter object chosen from the current verbosity.
241
+
192
242
  def progress_reporter(*args)
193
243
  case Gem.configuration.verbose
194
244
  when nil, false
@@ -200,6 +250,9 @@ module Gem
200
250
  end
201
251
  end
202
252
 
253
+ ##
254
+ # An absolutely silent progress reporter.
255
+
203
256
  class SilentProgressReporter
204
257
  attr_reader :count
205
258
 
@@ -213,6 +266,9 @@ module Gem
213
266
  end
214
267
  end
215
268
 
269
+ ##
270
+ # A basic dotted progress reporter.
271
+
216
272
  class SimpleProgressReporter
217
273
  include DefaultUserInteraction
218
274
 
@@ -228,17 +284,27 @@ module Gem
228
284
  @out.puts initial_message
229
285
  end
230
286
 
287
+ ##
288
+ # Prints out a dot and ignores +message+.
289
+
231
290
  def updated(message)
232
291
  @count += 1
233
292
  @out.print "."
234
293
  @out.flush
235
294
  end
236
295
 
296
+ ##
297
+ # Prints out the terminal message.
298
+
237
299
  def done
238
300
  @out.puts "\n#{@terminal_message}"
239
301
  end
302
+
240
303
  end
241
304
 
305
+ ##
306
+ # A progress reporter that prints out messages about the current progress.
307
+
242
308
  class VerboseProgressReporter
243
309
  include DefaultUserInteraction
244
310
 
@@ -254,32 +320,41 @@ module Gem
254
320
  @out.puts initial_message
255
321
  end
256
322
 
323
+ ##
324
+ # Prints out the position relative to the total and the +message+.
325
+
257
326
  def updated(message)
258
327
  @count += 1
259
328
  @out.puts "#{@count}/#{@total}: #{message}"
260
329
  end
261
330
 
331
+ ##
332
+ # Prints out the terminal message.
333
+
262
334
  def done
263
335
  @out.puts @terminal_message
264
336
  end
265
337
  end
266
338
  end
267
339
 
268
- ####################################################################
269
- # Subclass of StreamUI that instantiates the user interaction using
270
- # standard in, out and error.
340
+ ##
341
+ # Subclass of StreamUI that instantiates the user interaction using STDIN,
342
+ # STDOUT, and STDERR.
343
+
271
344
  class ConsoleUI < StreamUI
272
345
  def initialize
273
346
  super(STDIN, STDOUT, STDERR)
274
347
  end
275
348
  end
276
349
 
277
- ####################################################################
350
+ ##
278
351
  # SilentUI is a UI choice that is absolutely silent.
352
+
279
353
  class SilentUI
280
354
  def method_missing(sym, *args, &block)
281
355
  self
282
356
  end
283
357
  end
358
+
284
359
  end
285
360