rubygems-update 0.9.4 → 0.9.5

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 (225) hide show
  1. data/ChangeLog +587 -0
  2. data/README +0 -1
  3. data/Rakefile +39 -12
  4. data/TODO +0 -5
  5. data/bin/gem +7 -7
  6. data/bin/update_rubygems +1 -1
  7. data/examples/application/an-app.gemspec +1 -1
  8. data/gemspecs/cgikit-1.1.0.gemspec +1 -2
  9. data/gemspecs/jabber4r.gemspec +1 -1
  10. data/gemspecs/linguistics.gemspec +1 -1
  11. data/gemspecs/ook.gemspec +1 -1
  12. data/gemspecs/progressbar.gemspec +1 -1
  13. data/gemspecs/redcloth.gemspec +1 -1
  14. data/gemspecs/rublog.gemspec +1 -1
  15. data/gemspecs/ruby-doom.gemspec +1 -1
  16. data/gemspecs/rubyjdwp.gemspec +1 -1
  17. data/gemspecs/statistics.gemspec +1 -1
  18. data/lib/rubygems.rb +167 -105
  19. data/lib/rubygems/builder.rb +12 -10
  20. data/lib/rubygems/command.rb +177 -60
  21. data/lib/rubygems/command_manager.rb +30 -38
  22. data/lib/rubygems/commands/build_command.rb +42 -46
  23. data/lib/rubygems/commands/cert_command.rb +72 -69
  24. data/lib/rubygems/commands/check_command.rb +63 -63
  25. data/lib/rubygems/commands/cleanup_command.rb +25 -7
  26. data/lib/rubygems/commands/contents_command.rb +70 -62
  27. data/lib/rubygems/commands/dependency_command.rb +131 -86
  28. data/lib/rubygems/commands/environment_command.rb +67 -46
  29. data/lib/rubygems/commands/fetch_command.rb +62 -0
  30. data/lib/rubygems/commands/generate_index_command.rb +57 -0
  31. data/lib/rubygems/commands/help_command.rb +163 -73
  32. data/lib/rubygems/commands/install_command.rb +114 -128
  33. data/lib/rubygems/commands/list_command.rb +10 -8
  34. data/lib/rubygems/commands/lock_command.rb +101 -0
  35. data/lib/rubygems/commands/mirror_command.rb +105 -0
  36. data/lib/rubygems/commands/outdated_command.rb +24 -15
  37. data/lib/rubygems/commands/pristine_command.rb +118 -88
  38. data/lib/rubygems/commands/query_command.rb +109 -77
  39. data/lib/rubygems/commands/rdoc_command.rb +13 -10
  40. data/lib/rubygems/commands/search_command.rb +10 -8
  41. data/lib/rubygems/commands/server_command.rb +48 -0
  42. data/lib/rubygems/commands/sources_command.rb +104 -83
  43. data/lib/rubygems/commands/specification_command.rb +65 -51
  44. data/lib/rubygems/commands/uninstall_command.rb +17 -12
  45. data/lib/rubygems/commands/unpack_command.rb +68 -68
  46. data/lib/rubygems/commands/update_command.rb +72 -25
  47. data/lib/rubygems/commands/which_command.rb +86 -0
  48. data/lib/rubygems/config_file.rb +202 -78
  49. data/lib/rubygems/custom_require.rb +7 -88
  50. data/lib/rubygems/dependency.rb +65 -0
  51. data/lib/rubygems/dependency_installer.rb +232 -0
  52. data/lib/rubygems/dependency_list.rb +133 -105
  53. data/lib/rubygems/digest/md5.rb +4 -1
  54. data/lib/rubygems/digest/sha2.rb +1 -1
  55. data/lib/rubygems/doc_manager.rb +41 -19
  56. data/lib/rubygems/exceptions.rb +63 -0
  57. data/lib/rubygems/ext.rb +18 -0
  58. data/lib/rubygems/ext/builder.rb +56 -0
  59. data/lib/rubygems/ext/configure_builder.rb +24 -0
  60. data/lib/rubygems/ext/ext_conf_builder.rb +23 -0
  61. data/lib/rubygems/ext/rake_builder.rb +27 -0
  62. data/lib/rubygems/format.rb +16 -6
  63. data/lib/rubygems/gem_openssl.rb +43 -6
  64. data/lib/rubygems/gem_path_searcher.rb +84 -0
  65. data/lib/rubygems/gem_runner.rb +20 -5
  66. data/lib/rubygems/indexer.rb +163 -0
  67. data/lib/rubygems/indexer/abstract_index_builder.rb +80 -0
  68. data/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
  69. data/lib/rubygems/indexer/master_index_builder.rb +53 -0
  70. data/lib/rubygems/indexer/quick_index_builder.rb +48 -0
  71. data/lib/rubygems/install_update_options.rb +87 -0
  72. data/lib/rubygems/installer.rb +316 -562
  73. data/lib/rubygems/local_remote_options.rb +106 -0
  74. data/lib/rubygems/old_format.rb +5 -13
  75. data/lib/rubygems/open-uri.rb +2 -0
  76. data/lib/rubygems/package.rb +28 -32
  77. data/lib/rubygems/platform.rb +187 -0
  78. data/lib/rubygems/remote_fetcher.rb +46 -29
  79. data/lib/rubygems/remote_installer.rb +11 -18
  80. data/lib/rubygems/requirement.rb +157 -0
  81. data/lib/rubygems/rubygems_version.rb +1 -1
  82. data/lib/rubygems/security.rb +715 -457
  83. data/lib/rubygems/server.rb +77 -59
  84. data/lib/rubygems/source_index.rb +154 -83
  85. data/lib/rubygems/source_info_cache.rb +73 -30
  86. data/lib/rubygems/source_info_cache_entry.rb +12 -3
  87. data/lib/rubygems/specification.rb +378 -145
  88. data/lib/rubygems/uninstaller.rb +183 -0
  89. data/lib/rubygems/user_interaction.rb +38 -9
  90. data/lib/rubygems/validator.rb +53 -24
  91. data/lib/rubygems/version.rb +126 -289
  92. data/lib/rubygems/version_option.rb +49 -0
  93. data/pkgs/sources/lib/sources.rb +1 -4
  94. data/pkgs/sources/sources.gemspec +3 -3
  95. data/scripts/gemdoc.rb +0 -1
  96. data/setup.rb +166 -1505
  97. data/test/bogussources.rb +0 -1
  98. data/test/data/gem-private_key.pem +27 -0
  99. data/test/data/gem-public_cert.pem +20 -0
  100. data/test/functional.rb +3 -105
  101. data/test/gemutilities.rb +145 -24
  102. data/test/insure_session.rb +0 -1
  103. data/test/{test_datadir.rb → test_config.rb} +7 -13
  104. data/test/test_gem.rb +360 -9
  105. data/test/test_gem_builder.rb +34 -0
  106. data/test/{test_command.rb → test_gem_command.rb} +119 -62
  107. data/test/{test_parse_commands.rb → test_gem_command_manager.rb} +64 -40
  108. data/test/test_gem_commands_build_command.rb +75 -0
  109. data/test/test_gem_commands_cert_command.rb +122 -0
  110. data/test/test_gem_commands_check_command.rb +25 -0
  111. data/test/test_gem_commands_contents_command.rb +92 -0
  112. data/test/test_gem_commands_dependency_command.rb +108 -0
  113. data/test/test_gem_commands_environment_command.rb +117 -0
  114. data/test/test_gem_commands_fetch_command.rb +34 -0
  115. data/test/test_gem_commands_generate_index_command.rb +32 -0
  116. data/test/test_gem_commands_install_command.rb +160 -0
  117. data/test/test_gem_commands_mirror_command.rb +56 -0
  118. data/test/test_gem_commands_pristine_command.rb +100 -0
  119. data/test/test_gem_commands_query_command.rb +82 -0
  120. data/test/test_gem_commands_sources_command.rb +147 -0
  121. data/test/test_gem_commands_specification_command.rb +93 -0
  122. data/test/test_gem_commands_unpack_command.rb +55 -0
  123. data/test/test_gem_config_file.rb +210 -0
  124. data/test/test_gem_dependency.rb +89 -0
  125. data/test/test_gem_dependency_installer.rb +542 -0
  126. data/test/test_gem_dependency_list.rb +212 -0
  127. data/test/test_gem_doc_manager.rb +32 -0
  128. data/test/test_gem_ext_configure_builder.rb +13 -17
  129. data/test/test_gem_ext_ext_conf_builder.rb +9 -9
  130. data/test/test_gem_ext_rake_builder.rb +23 -11
  131. data/test/test_gem_format.rb +69 -0
  132. data/test/test_gem_gem_path_searcher.rb +57 -0
  133. data/test/test_gem_gem_runner.rb +35 -0
  134. data/test/test_gem_indexer.rb +119 -0
  135. data/test/test_gem_install_update_options.rb +40 -0
  136. data/test/test_gem_installer.rb +796 -0
  137. data/test/test_gem_local_remote_options.rb +84 -0
  138. data/test/test_gem_outdated_command.rb +11 -9
  139. data/test/test_gem_platform.rb +240 -0
  140. data/test/{test_remote_fetcher.rb → test_gem_remote_fetcher.rb} +124 -55
  141. data/test/{test_remote_installer.rb → test_gem_remote_installer.rb} +3 -4
  142. data/test/test_gem_requirement.rb +223 -0
  143. data/test/test_gem_server.rb +71 -0
  144. data/test/test_gem_source_index.rb +429 -0
  145. data/test/test_gem_source_info_cache.rb +79 -17
  146. data/test/test_gem_source_info_cache_entry.rb +11 -9
  147. data/test/test_gem_specification.rb +738 -0
  148. data/test/test_gem_stream_ui.rb +117 -0
  149. data/test/test_gem_validator.rb +70 -0
  150. data/test/test_gem_version.rb +191 -0
  151. data/test/test_gem_version_option.rb +77 -0
  152. data/test/{test_require_gem.rb → test_kernel.rb} +19 -12
  153. data/test/test_open_uri.rb +1 -2
  154. data/test/test_package.rb +45 -34
  155. metadata +116 -141
  156. data/Releases +0 -127
  157. data/bin/gem_mirror +0 -73
  158. data/bin/gem_server +0 -6
  159. data/bin/gemlock +0 -127
  160. data/bin/gemri +0 -24
  161. data/bin/gemwhich +0 -89
  162. data/bin/index_gem_repository.rb +0 -302
  163. data/lib/gemconfigure.rb +0 -24
  164. data/lib/rubygems/gem_commands.rb +0 -273
  165. data/pkgs/sources/sources-0.0.1.gem +0 -0
  166. data/post-install.rb +0 -121
  167. data/test/brokenbuildgem.rb +0 -35
  168. data/test/data/PostMessage-0.0.1.gem +0 -0
  169. data/test/data/a-0.0.1.gem +0 -0
  170. data/test/data/a-0.0.2.gem +0 -0
  171. data/test/data/b-0.0.2.gem +0 -0
  172. data/test/data/broken-1.0.0.gem +0 -0
  173. data/test/data/broken_build/broken-build.gemspec +0 -20
  174. data/test/data/broken_build/ext/extconf.rb +0 -3
  175. data/test/data/broken_build/ext/foo.c +0 -1
  176. data/test/data/c-1.2.gem +0 -0
  177. data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
  178. data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
  179. data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
  180. data/test/data/gemhome/cache/c-1.2.gem +0 -0
  181. data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -1
  182. data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -1
  183. data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -1
  184. data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -1
  185. data/test/data/gemhome/specifications/a-0.0.1.gemspec +0 -8
  186. data/test/data/gemhome/specifications/a-0.0.2.gemspec +0 -8
  187. data/test/data/gemhome/specifications/b-0.0.2.gemspec +0 -8
  188. data/test/data/gemhome/specifications/c-1.2.gemspec +0 -8
  189. data/test/data/legacy/keyedlist-0.4.0.ruby +0 -11
  190. data/test/data/legacy/keyedlist-0.4.0.yaml +0 -16
  191. data/test/data/lib/code.rb +0 -1
  192. data/test/data/one/README.one +0 -1
  193. data/test/data/one/lib/one.rb +0 -9
  194. data/test/data/one/one-0.0.1.gem +0 -0
  195. data/test/data/one/one.gemspec +0 -17
  196. data/test/data/one/one.yaml +0 -40
  197. data/test/data/post_install.gemspec +0 -19
  198. data/test/functional_extension_gems.rb +0 -48
  199. data/test/functional_generate_yaml_index.rb +0 -104
  200. data/test/gemenvironment.rb +0 -59
  201. data/test/io_capture.rb +0 -33
  202. data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +0 -11
  203. data/test/mock/gems/specifications/sources-0.0.1.gemspec +0 -8
  204. data/test/onegem.rb +0 -35
  205. data/test/test_builder.rb +0 -34
  206. data/test/test_check_command.rb +0 -34
  207. data/test/test_configfile.rb +0 -42
  208. data/test/test_dependency_list.rb +0 -169
  209. data/test/test_file_list.rb +0 -101
  210. data/test/test_format.rb +0 -49
  211. data/test/test_gem_sources_command.rb +0 -135
  212. data/test/test_gemloadpaths.rb +0 -51
  213. data/test/test_gempaths.rb +0 -170
  214. data/test/test_installer.rb +0 -369
  215. data/test/test_loadmanager.rb +0 -48
  216. data/test/test_process_commands.rb +0 -52
  217. data/test/test_source_index.rb +0 -231
  218. data/test/test_specific_extras.rb +0 -46
  219. data/test/test_specification.rb +0 -565
  220. data/test/test_user_interaction.rb +0 -48
  221. data/test/test_validator.rb +0 -59
  222. data/test/test_version_comparison.rb +0 -321
  223. data/test/testgem.rc +0 -7
  224. data/test/user_capture.rb +0 -7
  225. data/test/yaml_data.rb +0 -63
@@ -6,26 +6,64 @@
6
6
  #++
7
7
 
8
8
  require 'test/unit'
9
- require 'test/mockgemui'
10
-
9
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
11
10
  require 'rubygems/command'
12
- require 'rubygems/command_manager'
13
- require 'rubygems/user_interaction'
14
11
 
15
- class Noop
16
- def method_missing(sym, *args, &block)
17
- end
12
+ class Gem::Command
13
+ public :parser
18
14
  end
19
15
 
20
- class TestCommand < Test::Unit::TestCase
21
- include Gem::DefaultUserInteraction
16
+ class TestGemCommand < RubyGemTestCase
17
+
18
+ def setup
19
+ super
22
20
 
23
- def setup
24
21
  @xopt = nil
22
+
25
23
  Gem::Command.common_options.clear
26
- Gem::Command.common_options << [ ['-x', '--exe', 'Execute'], lambda do @xopt = true end]
27
- @cmd = Gem::Command.new("doit", "summary")
28
- self.ui = Noop.new
24
+ Gem::Command.common_options << [
25
+ ['-x', '--exe', 'Execute'], lambda do |*a|
26
+ @xopt = true
27
+ end
28
+ ]
29
+
30
+ @cmd_name = 'doit'
31
+ @cmd = Gem::Command.new @cmd_name, 'summary'
32
+ end
33
+
34
+ def test_self_add_specific_extra_args
35
+ added_args = %w[--all]
36
+ @cmd.add_option '--all' do |v,o| end
37
+
38
+ Gem::Command.add_specific_extra_args @cmd_name, added_args
39
+
40
+ assert_equal added_args, Gem::Command.specific_extra_args(@cmd_name)
41
+
42
+ h = @cmd.add_extra_args []
43
+
44
+ assert_equal added_args, h
45
+ end
46
+
47
+ def test_self_add_specific_extra_args_unknown
48
+ added_args = %w[--definitely_not_there]
49
+
50
+ Gem::Command.add_specific_extra_args @cmd_name, added_args
51
+
52
+ assert_equal added_args, Gem::Command.specific_extra_args(@cmd_name)
53
+
54
+ h = @cmd.add_extra_args []
55
+
56
+ assert_equal [], h
57
+ end
58
+
59
+ def test_add_option_overlapping_common_and_local_options
60
+ @cmd.add_option('-x', '--zip', 'BAD!') do end
61
+ @cmd.add_option('-z', '--exe', 'BAD!') do end
62
+ @cmd.add_option('-x', '--exe', 'BAD!') do end
63
+
64
+ assert_match %r|-x, --zip|, @cmd.parser.to_s
65
+ assert_match %r|-z, --exe|, @cmd.parser.to_s
66
+ assert_no_match %r|-x, --exe|, @cmd.parser.to_s
29
67
  end
30
68
 
31
69
  def test_basic_accessors
@@ -34,85 +72,102 @@ class TestCommand < Test::Unit::TestCase
34
72
  assert_equal "summary", @cmd.summary
35
73
  end
36
74
 
37
- def test_invoke
38
- done = false
39
- @cmd.when_invoked { done = true }
40
- @cmd.invoke
41
- assert done
75
+ def test_common_option_in_class
76
+ assert Array === Gem::Command.common_options
42
77
  end
43
78
 
44
- def test_invoke_with_options
79
+ def test_defaults
45
80
  @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
46
- options[:help] = true
81
+ options[:help] = value
47
82
  end
48
- @cmd.when_invoked do |opts|
49
- assert opts[:help]
50
- done = true
51
- true
83
+
84
+ @cmd.defaults = { :help => true }
85
+
86
+ @cmd.when_invoked do |options|
87
+ assert options[:help], "Help options should default true"
52
88
  end
53
- @cmd.invoke('-h')
89
+
90
+ use_ui @ui do
91
+ @cmd.invoke
92
+ end
93
+
94
+ assert_match %r|Usage: gem doit|, @ui.output
54
95
  end
55
96
 
56
- def test_invoke_with_common_options
57
- @cmd.when_invoked do true end
58
- @cmd.invoke("-x")
59
- assert @xopt, "Should have done xopt"
97
+ def test_invoke
98
+ done = false
99
+ @cmd.when_invoked { done = true }
100
+
101
+ use_ui @ui do
102
+ @cmd.invoke
103
+ end
104
+
105
+ assert done
60
106
  end
61
-
107
+
62
108
  def test_invode_with_bad_options
63
- use_ui(MockGemUi.new) do
109
+ use_ui @ui do
64
110
  @cmd.when_invoked do true end
65
- ex = assert_raise(OptionParser::InvalidOption) { @cmd.invoke('-zzz') }
111
+
112
+ ex = assert_raise(OptionParser::InvalidOption) do
113
+ @cmd.invoke('-zzz')
114
+ end
115
+
66
116
  assert_match(/invalid option:/, ex.message)
67
117
  end
68
118
  end
69
119
 
70
- def test_overlapping_common_and_local_options
71
- use_ui(MockGemUi.new) do
72
- @cmd.add_option('-x', '--zip', 'BAD!') do end
73
- @cmd.add_option('-z', '--exe', 'BAD!') do end
74
- @cmd.add_option('-x', '--exe', 'BAD!') do end
75
- @cmd.when_invoked do |opts| false end
76
- @cmd.invoke('-x')
77
- md = ui.output =~ /Common.*-exe/m
78
- assert ! @xopt, "Should not do xopt"
79
- assert_nil md, "Should not have common options"
120
+ def test_invoke_with_common_options
121
+ @cmd.when_invoked do true end
122
+
123
+ use_ui @ui do
124
+ @cmd.invoke "-x"
80
125
  end
126
+
127
+ assert @xopt, "Should have done xopt"
81
128
  end
82
129
 
83
130
  # Returning false from the command handler invokes the usage output.
84
131
  def test_invoke_with_help
85
- use_ui(MockGemUi.new) do
132
+ done = false
133
+
134
+ use_ui @ui do
86
135
  @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
87
136
  options[:help] = true
137
+ done = true
88
138
  end
139
+
89
140
  @cmd.invoke('--help')
90
- assert_match(/Usage/, ui.output)
91
- assert_match(/gem doit/, ui.output)
92
- assert_match(/\[options\]/, ui.output)
93
- assert_match(/-h/, ui.output)
94
- assert_match(/--help \[COMMAND\]/, ui.output)
95
- assert_match(/Get help on COMMAND/, ui.output)
96
- assert_match(/-x/, ui.output)
97
- assert_match(/--exe/, ui.output)
98
- assert_match(/Execute/, ui.output)
99
- assert_match(/Common Options:/, ui.output)
141
+
142
+ assert done
100
143
  end
144
+
145
+ assert_match(/Usage/, @ui.output)
146
+ assert_match(/gem doit/, @ui.output)
147
+ assert_match(/\[options\]/, @ui.output)
148
+ assert_match(/-h/, @ui.output)
149
+ assert_match(/--help \[COMMAND\]/, @ui.output)
150
+ assert_match(/Get help on COMMAND/, @ui.output)
151
+ assert_match(/-x/, @ui.output)
152
+ assert_match(/--exe/, @ui.output)
153
+ assert_match(/Execute/, @ui.output)
154
+ assert_match(/Common Options:/, @ui.output)
101
155
  end
102
156
 
103
- def test_defaults
157
+ def test_invoke_with_options
104
158
  @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
105
- options[:help] = value
159
+ options[:help] = true
106
160
  end
107
- @cmd.defaults = { :help => true }
108
- @cmd.when_invoked do |options|
109
- assert options[:help], "Help options should default true"
161
+
162
+ @cmd.when_invoked do |opts|
163
+ assert opts[:help]
110
164
  end
111
- @cmd.invoke
112
- end
113
165
 
114
- def test_common_option_in_class
115
- assert Array === Gem::Command.common_options
166
+ use_ui @ui do
167
+ @cmd.invoke '-h'
168
+ end
169
+
170
+ assert_match %r|Usage: gem doit|, @ui.output
116
171
  end
117
172
 
118
173
  def test_option_recognition
@@ -136,4 +191,6 @@ class TestCommand < Test::Unit::TestCase
136
191
  @cmd.handles?(args)
137
192
  assert_equal ['-h', 'command'], args
138
193
  end
194
+
139
195
  end
196
+
@@ -5,36 +5,59 @@
5
5
  #++
6
6
 
7
7
  require 'test/unit'
8
- $:.unshift '../lib'
9
- require 'rubygems'
10
- require 'test/mockgemui'
11
- Gem::manage_gems
8
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
9
+ require 'rubygems/command_manager'
12
10
 
13
- class TestParseCommands < Test::Unit::TestCase
14
- include Gem::DefaultUserInteraction
11
+ class InterruptCommand < Gem::Command
12
+
13
+ def initialize
14
+ super('interrupt', 'Raises an Interrupt Exception', {})
15
+ end
16
+
17
+ def execute
18
+ raise Interrupt, "Interrupt exception"
19
+ end
20
+
21
+ end
22
+
23
+ class TestGemCommandManager < RubyGemTestCase
15
24
 
16
25
  def setup
26
+ super
27
+
17
28
  @command_manager = Gem::CommandManager.new
18
29
  end
19
30
 
20
- def test_parsing_bad_options
21
- use_ui(MockGemUi.new) do
31
+ def test_run_interrupt
32
+ use_ui @ui do
33
+ @command_manager.register_command :interrupt
34
+ assert_raises MockGemUi::TermError do
35
+ @command_manager.run 'interrupt'
36
+ end
37
+ assert_equal '', ui.output
38
+ assert_equal "ERROR: Interrupted\n", ui.error
39
+ end
40
+ end
41
+
42
+ def test_process_args_bad_arg
43
+ use_ui @ui do
22
44
  assert_raises(MockGemUi::TermError) {
23
45
  @command_manager.process_args("--bad-arg")
24
46
  }
25
- assert_match(/invalid option: --bad-arg/i, ui.error)
26
47
  end
48
+
49
+ assert_match(/invalid option: --bad-arg/i, @ui.error)
27
50
  end
28
51
 
29
- def test_parsing_install_options
52
+ def test_process_args_install
30
53
  #capture all install options
31
- use_ui(MockGemUi.new) do
54
+ use_ui @ui do
32
55
  check_options = nil
33
56
  @command_manager['install'].when_invoked do |options|
34
57
  check_options = options
35
58
  true
36
59
  end
37
-
60
+
38
61
  #check defaults
39
62
  @command_manager.process_args("install")
40
63
  assert_equal false, check_options[:test]
@@ -42,9 +65,9 @@ class TestParseCommands < Test::Unit::TestCase
42
65
  assert_equal false, check_options[:force]
43
66
  assert_equal :both, check_options[:domain]
44
67
  assert_equal true, check_options[:wrappers]
45
- assert_equal "> 0", check_options[:version]
68
+ assert_equal Gem::Requirement.default, check_options[:version]
46
69
  assert_equal Gem.dir, check_options[:install_dir]
47
-
70
+
48
71
  #check settings
49
72
  check_options = nil
50
73
  @command_manager.process_args(
@@ -54,53 +77,53 @@ class TestParseCommands < Test::Unit::TestCase
54
77
  assert_equal true, check_options[:force]
55
78
  assert_equal :local, check_options[:domain]
56
79
  assert_equal false, check_options[:wrappers]
57
- assert_equal '3.0', check_options[:version]
80
+ assert_equal Gem::Requirement.new('3.0'), check_options[:version]
58
81
  assert_equal Dir.pwd, check_options[:install_dir]
59
-
82
+
60
83
  #check remote domain
61
84
  check_options = nil
62
85
  @command_manager.process_args("install --remote")
63
86
  assert_equal :remote, check_options[:domain]
64
-
87
+
65
88
  #check both domain
66
89
  check_options = nil
67
90
  @command_manager.process_args("install --both")
68
91
  assert_equal :both, check_options[:domain]
69
-
92
+
70
93
  #check both domain
71
94
  check_options = nil
72
95
  @command_manager.process_args("install --both")
73
96
  assert_equal :both, check_options[:domain]
74
97
  end
75
98
  end
76
-
77
- def test_parsing_uninstall_options
99
+
100
+ def test_process_args_uninstall
78
101
  #capture all uninstall options
79
102
  check_options = nil
80
103
  @command_manager['uninstall'].when_invoked do |options|
81
104
  check_options = options
82
105
  true
83
106
  end
84
-
107
+
85
108
  #check defaults
86
109
  @command_manager.process_args("uninstall")
87
- assert_equal "> 0", check_options[:version]
110
+ assert_equal Gem::Requirement.default, check_options[:version]
88
111
 
89
112
  #check settings
90
113
  check_options = nil
91
114
  @command_manager.process_args("uninstall foobar --version 3.0")
92
115
  assert_equal "foobar", check_options[:args].first
93
- assert_equal "3.0", check_options[:version]
116
+ assert_equal Gem::Requirement.new('3.0'), check_options[:version]
94
117
  end
95
118
 
96
- def test_parsing_check_options
119
+ def test_process_args_check
97
120
  #capture all check options
98
121
  check_options = nil
99
122
  @command_manager['check'].when_invoked do |options|
100
123
  check_options = options
101
124
  true
102
125
  end
103
-
126
+
104
127
  #check defaults
105
128
  @command_manager.process_args("check")
106
129
  assert_equal false, check_options[:verify]
@@ -112,39 +135,39 @@ class TestParseCommands < Test::Unit::TestCase
112
135
  assert_equal "foobar", check_options[:verify]
113
136
  assert_equal true, check_options[:alien]
114
137
  end
115
-
116
- def test_parsing_build_options
138
+
139
+ def test_process_args_build
117
140
  #capture all build options
118
141
  check_options = nil
119
142
  @command_manager['build'].when_invoked do |options|
120
143
  check_options = options
121
144
  true
122
145
  end
123
-
146
+
124
147
  #check defaults
125
148
  @command_manager.process_args("build")
126
149
  #NOTE: Currently no defaults
127
-
150
+
128
151
  #check settings
129
152
  check_options = nil
130
153
  @command_manager.process_args("build foobar.rb")
131
154
  assert_equal 'foobar.rb', check_options[:args].first
132
155
  end
133
-
134
- def test_parsing_query_options
156
+
157
+ def test_process_args_query
135
158
  #capture all query options
136
159
  check_options = nil
137
160
  @command_manager['query'].when_invoked do |options|
138
161
  check_options = options
139
162
  true
140
163
  end
141
-
164
+
142
165
  #check defaults
143
166
  @command_manager.process_args("query")
144
167
  assert_equal(/.*/, check_options[:name])
145
168
  assert_equal :local, check_options[:domain]
146
169
  assert_equal false, check_options[:details]
147
-
170
+
148
171
  #check settings
149
172
  check_options = nil
150
173
  @command_manager.process_args("query --name foobar --local --details")
@@ -161,20 +184,20 @@ class TestParseCommands < Test::Unit::TestCase
161
184
  check_options = nil
162
185
  @command_manager.process_args("query --both")
163
186
  assert_equal :both, check_options[:domain]
164
- end
165
-
166
- def test_parsing_update_options
187
+ end
188
+
189
+ def test_process_args_update
167
190
  #capture all update options
168
191
  check_options = nil
169
192
  @command_manager['update'].when_invoked do |options|
170
193
  check_options = options
171
194
  true
172
195
  end
173
-
196
+
174
197
  #check defaults
175
198
  @command_manager.process_args("update")
176
199
  assert_equal true, check_options[:generate_rdoc]
177
-
200
+
178
201
  #check settings
179
202
  check_options = nil
180
203
  @command_manager.process_args("update --force --test --rdoc --install-dir .")
@@ -182,6 +205,7 @@ class TestParseCommands < Test::Unit::TestCase
182
205
  assert_equal true, check_options[:generate_rdoc]
183
206
  assert_equal true, check_options[:force]
184
207
  assert_equal Dir.pwd, check_options[:install_dir]
185
- end
186
-
208
+ end
209
+
187
210
  end
211
+