rubygems-update 1.8.30 → 2.0.0.preview2

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 (241) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +3 -0
  4. data/.autotest +6 -3
  5. data/History.txt +137 -63
  6. data/LICENSE.txt +1 -5
  7. data/Manifest.txt +69 -32
  8. data/README.rdoc +11 -9
  9. data/Rakefile +24 -38
  10. data/bin/gem +0 -9
  11. data/bin/update_rubygems +1 -0
  12. data/lib/rubygems.rb +193 -405
  13. data/lib/rubygems/available_set.rb +95 -0
  14. data/lib/rubygems/command.rb +88 -45
  15. data/lib/rubygems/command_manager.rb +67 -40
  16. data/lib/rubygems/commands/build_command.rb +5 -23
  17. data/lib/rubygems/commands/cert_command.rb +199 -57
  18. data/lib/rubygems/commands/check_command.rb +14 -39
  19. data/lib/rubygems/commands/cleanup_command.rb +9 -1
  20. data/lib/rubygems/commands/contents_command.rb +30 -12
  21. data/lib/rubygems/commands/dependency_command.rb +3 -8
  22. data/lib/rubygems/commands/environment_command.rb +13 -8
  23. data/lib/rubygems/commands/fetch_command.rb +3 -16
  24. data/lib/rubygems/commands/generate_index_command.rb +7 -47
  25. data/lib/rubygems/commands/help_command.rb +1 -1
  26. data/lib/rubygems/commands/install_command.rb +69 -36
  27. data/lib/rubygems/commands/list_command.rb +6 -4
  28. data/lib/rubygems/commands/lock_command.rb +1 -1
  29. data/lib/rubygems/commands/mirror_command.rb +17 -0
  30. data/lib/rubygems/commands/outdated_command.rb +6 -3
  31. data/lib/rubygems/commands/owner_command.rb +13 -5
  32. data/lib/rubygems/commands/pristine_command.rb +19 -4
  33. data/lib/rubygems/commands/push_command.rb +12 -1
  34. data/lib/rubygems/commands/query_command.rb +43 -27
  35. data/lib/rubygems/commands/rdoc_command.rb +23 -28
  36. data/lib/rubygems/commands/search_command.rb +4 -18
  37. data/lib/rubygems/commands/server_command.rb +1 -1
  38. data/lib/rubygems/commands/setup_command.rb +124 -38
  39. data/lib/rubygems/commands/sources_command.rb +16 -16
  40. data/lib/rubygems/commands/specification_command.rb +11 -13
  41. data/lib/rubygems/commands/uninstall_command.rb +24 -7
  42. data/lib/rubygems/commands/unpack_command.rb +7 -3
  43. data/lib/rubygems/commands/update_command.rb +22 -36
  44. data/lib/rubygems/commands/yank_command.rb +98 -0
  45. data/lib/rubygems/compatibility.rb +51 -0
  46. data/lib/rubygems/config_file.rb +82 -54
  47. data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
  48. data/lib/rubygems/core_ext/kernel_require.rb +119 -0
  49. data/lib/rubygems/defaults.rb +10 -21
  50. data/lib/rubygems/dependency.rb +61 -10
  51. data/lib/rubygems/dependency_installer.rb +157 -69
  52. data/lib/rubygems/dependency_list.rb +11 -19
  53. data/lib/rubygems/dependency_resolver.rb +562 -0
  54. data/lib/rubygems/deprecate.rb +40 -40
  55. data/lib/rubygems/errors.rb +77 -24
  56. data/lib/rubygems/exceptions.rb +25 -7
  57. data/lib/rubygems/ext/builder.rb +20 -23
  58. data/lib/rubygems/ext/configure_builder.rb +2 -2
  59. data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
  60. data/lib/rubygems/ext/rake_builder.rb +2 -2
  61. data/lib/rubygems/gem_runner.rb +3 -16
  62. data/lib/rubygems/gemcutter_utilities.rb +22 -7
  63. data/lib/rubygems/indexer.rb +6 -159
  64. data/lib/rubygems/install_message.rb +12 -0
  65. data/lib/rubygems/install_update_options.rb +56 -18
  66. data/lib/rubygems/installer.rb +244 -134
  67. data/lib/rubygems/installer_test_case.rb +71 -19
  68. data/lib/rubygems/mock_gem_ui.rb +17 -0
  69. data/lib/rubygems/name_tuple.rb +110 -0
  70. data/lib/rubygems/package.rb +514 -43
  71. data/lib/rubygems/package/digest_io.rb +64 -0
  72. data/lib/rubygems/package/old.rb +147 -0
  73. data/lib/rubygems/package/tar_header.rb +18 -55
  74. data/lib/rubygems/package/tar_reader.rb +20 -3
  75. data/lib/rubygems/package/tar_writer.rb +63 -7
  76. data/lib/rubygems/package_task.rb +3 -4
  77. data/lib/rubygems/path_support.rb +14 -7
  78. data/lib/rubygems/platform.rb +19 -26
  79. data/lib/rubygems/rdoc.rb +316 -0
  80. data/lib/rubygems/remote_fetcher.rb +117 -54
  81. data/lib/rubygems/request_set.rb +182 -0
  82. data/lib/rubygems/requirement.rb +63 -26
  83. data/lib/rubygems/security.rb +295 -555
  84. data/lib/rubygems/security/policies.rb +115 -0
  85. data/lib/rubygems/security/policy.rb +227 -0
  86. data/lib/rubygems/security/signer.rb +136 -0
  87. data/lib/rubygems/security/trust_dir.rb +104 -0
  88. data/lib/rubygems/server.rb +45 -55
  89. data/lib/rubygems/source.rb +144 -0
  90. data/lib/rubygems/source_list.rb +87 -0
  91. data/lib/rubygems/source_local.rb +92 -0
  92. data/lib/rubygems/source_specific_file.rb +28 -0
  93. data/lib/rubygems/spec_fetcher.rb +116 -184
  94. data/lib/rubygems/specification.rb +731 -335
  95. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
  96. data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
  97. data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
  98. data/lib/rubygems/syck_hack.rb +2 -0
  99. data/lib/rubygems/test_case.rb +199 -109
  100. data/lib/rubygems/test_utilities.rb +25 -5
  101. data/lib/rubygems/uninstaller.rb +62 -20
  102. data/lib/rubygems/user_interaction.rb +10 -0
  103. data/lib/rubygems/validator.rb +33 -40
  104. data/lib/rubygems/version.rb +19 -8
  105. data/setup.rb +8 -1
  106. data/test/rubygems/alternate_cert.pem +9 -0
  107. data/test/rubygems/alternate_cert_32.pem +9 -0
  108. data/test/rubygems/alternate_key.pem +9 -0
  109. data/test/rubygems/bad_rake.rb +1 -0
  110. data/test/rubygems/child_cert.pem +9 -0
  111. data/test/rubygems/child_cert_32.pem +9 -0
  112. data/test/rubygems/child_key.pem +9 -0
  113. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  114. data/test/rubygems/expired_cert.pem +9 -0
  115. data/test/rubygems/future_cert.pem +9 -0
  116. data/test/rubygems/future_cert_32.pem +9 -0
  117. data/test/rubygems/good_rake.rb +1 -0
  118. data/test/rubygems/grandchild_cert.pem +9 -0
  119. data/test/rubygems/grandchild_cert_32.pem +9 -0
  120. data/test/rubygems/grandchild_key.pem +9 -0
  121. data/test/rubygems/invalid_issuer_cert.pem +9 -0
  122. data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
  123. data/test/rubygems/invalid_key.pem +9 -0
  124. data/test/rubygems/invalid_signer_cert.pem +9 -0
  125. data/test/rubygems/invalid_signer_cert_32.pem +9 -0
  126. data/test/rubygems/invalidchild_cert.pem +9 -0
  127. data/test/rubygems/invalidchild_cert_32.pem +9 -0
  128. data/test/rubygems/invalidchild_key.pem +9 -0
  129. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  130. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  131. data/test/rubygems/private_key.pem +7 -25
  132. data/test/rubygems/public_cert.pem +8 -18
  133. data/test/rubygems/public_cert_32.pem +10 -0
  134. data/test/rubygems/public_key.pem +4 -0
  135. data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
  136. data/test/rubygems/test_config.rb +4 -6
  137. data/test/rubygems/test_deprecate.rb +76 -0
  138. data/test/rubygems/test_gem.rb +318 -83
  139. data/test/rubygems/test_gem_available_set.rb +106 -0
  140. data/test/rubygems/test_gem_command.rb +10 -0
  141. data/test/rubygems/test_gem_command_manager.rb +55 -9
  142. data/test/rubygems/test_gem_commands_build_command.rb +11 -19
  143. data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
  144. data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
  145. data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
  146. data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
  147. data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
  148. data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
  149. data/test/rubygems/test_gem_commands_help_command.rb +2 -1
  150. data/test/rubygems/test_gem_commands_install_command.rb +647 -48
  151. data/test/rubygems/test_gem_commands_mirror.rb +32 -0
  152. data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
  153. data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
  154. data/test/rubygems/test_gem_commands_push_command.rb +62 -8
  155. data/test/rubygems/test_gem_commands_query_command.rb +51 -0
  156. data/test/rubygems/test_gem_commands_search_command.rb +25 -0
  157. data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
  158. data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
  159. data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
  160. data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
  161. data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
  162. data/test/rubygems/test_gem_commands_update_command.rb +56 -38
  163. data/test/rubygems/test_gem_commands_which_command.rb +4 -4
  164. data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
  165. data/test/rubygems/test_gem_config_file.rb +66 -21
  166. data/test/rubygems/test_gem_dependency.rb +46 -0
  167. data/test/rubygems/test_gem_dependency_installer.rb +228 -18
  168. data/test/rubygems/test_gem_dependency_list.rb +0 -9
  169. data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
  170. data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
  171. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
  172. data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
  173. data/test/rubygems/test_gem_gem_runner.rb +27 -5
  174. data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
  175. data/test/rubygems/test_gem_indexer.rb +14 -227
  176. data/test/rubygems/test_gem_install_update_options.rb +83 -3
  177. data/test/rubygems/test_gem_installer.rb +211 -236
  178. data/test/rubygems/test_gem_local_remote_options.rb +8 -2
  179. data/test/rubygems/test_gem_name_tuple.rb +15 -0
  180. data/test/rubygems/test_gem_package.rb +547 -0
  181. data/test/rubygems/test_gem_package_old.rb +37 -0
  182. data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
  183. data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
  184. data/test/rubygems/test_gem_path_support.rb +4 -30
  185. data/test/rubygems/test_gem_platform.rb +3 -6
  186. data/test/rubygems/test_gem_rdoc.rb +245 -0
  187. data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
  188. data/test/rubygems/test_gem_request_set.rb +70 -0
  189. data/test/rubygems/test_gem_requirement.rb +53 -24
  190. data/test/rubygems/test_gem_security.rb +189 -43
  191. data/test/rubygems/test_gem_security_policy.rb +376 -0
  192. data/test/rubygems/test_gem_security_signer.rb +184 -0
  193. data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
  194. data/test/rubygems/test_gem_server.rb +31 -36
  195. data/test/rubygems/test_gem_silent_ui.rb +2 -2
  196. data/test/rubygems/test_gem_source.rb +188 -0
  197. data/test/rubygems/test_gem_source_list.rb +87 -0
  198. data/test/rubygems/test_gem_source_local.rb +83 -0
  199. data/test/rubygems/test_gem_source_specific_file.rb +33 -0
  200. data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
  201. data/test/rubygems/test_gem_specification.rb +293 -39
  202. data/test/rubygems/test_gem_uninstaller.rb +136 -13
  203. data/test/rubygems/test_gem_validator.rb +14 -41
  204. data/test/rubygems/test_gem_version.rb +15 -21
  205. data/test/rubygems/test_require.rb +193 -0
  206. data/test/rubygems/wrong_key_cert.pem +9 -0
  207. data/test/rubygems/wrong_key_cert_32.pem +9 -0
  208. metadata +171 -83
  209. metadata.gz.sig +1 -0
  210. data/CVE-2013-4287.txt +0 -36
  211. data/CVE-2013-4363.txt +0 -45
  212. data/ci_build.sh +0 -27
  213. data/cruise_config.rb +0 -32
  214. data/lib/rbconfig/datadir.rb +0 -13
  215. data/lib/rubygems/builder.rb +0 -99
  216. data/lib/rubygems/custom_require.rb +0 -69
  217. data/lib/rubygems/doc_manager.rb +0 -243
  218. data/lib/rubygems/format.rb +0 -82
  219. data/lib/rubygems/gem_openssl.rb +0 -90
  220. data/lib/rubygems/gem_path_searcher.rb +0 -172
  221. data/lib/rubygems/old_format.rb +0 -153
  222. data/lib/rubygems/package/f_sync_dir.rb +0 -23
  223. data/lib/rubygems/package/tar_input.rb +0 -234
  224. data/lib/rubygems/package/tar_output.rb +0 -146
  225. data/lib/rubygems/require_paths_builder.rb +0 -18
  226. data/lib/rubygems/source_index.rb +0 -406
  227. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
  228. data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
  229. data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
  230. data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
  231. data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
  232. data/test/rubygems/test_bundled_ca.rb +0 -59
  233. data/test/rubygems/test_gem_builder.rb +0 -44
  234. data/test/rubygems/test_gem_doc_manager.rb +0 -32
  235. data/test/rubygems/test_gem_ext_builder.rb +0 -58
  236. data/test/rubygems/test_gem_format.rb +0 -88
  237. data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
  238. data/test/rubygems/test_gem_package_tar_input.rb +0 -129
  239. data/test/rubygems/test_gem_package_tar_output.rb +0 -101
  240. data/test/rubygems/test_gem_source_index.rb +0 -250
  241. data/util/update_bundled_ca_certificates.rb +0 -103
@@ -24,15 +24,6 @@ class TestGemDependencyList < Gem::TestCase
24
24
  @d1 = quick_spec 'd', '1' do |s| s.add_dependency 'c', '>= 1' end
25
25
  end
26
26
 
27
- def test_self_from_source_index
28
- util_clear_gems
29
- install_specs @a1, @b2
30
-
31
- deps = Gem::Deprecate.skip_during { Gem::DependencyList.from_source_index }
32
-
33
- assert_equal %w[b-2 a-1], deps.dependency_order.map { |s| s.full_name }
34
- end
35
-
36
27
  def test_active_count
37
28
  assert_equal 0, @deplist.send(:active_count, [], {})
38
29
  assert_equal 1, @deplist.send(:active_count, [@a1], {})
@@ -0,0 +1,327 @@
1
+ require 'rubygems/test_case'
2
+ require 'rubygems/dependency_resolver'
3
+
4
+ class TestGemDependencyResolver < Gem::TestCase
5
+
6
+ def make_dep(name, *req)
7
+ Gem::Dependency.new(name, *req)
8
+ end
9
+
10
+ def set(*specs)
11
+ StaticSet.new(specs)
12
+ end
13
+
14
+ def assert_set(expected, actual)
15
+ exp = expected.sort_by { |s| s.full_name }
16
+ act = actual.map { |a| a.spec }.sort_by { |s| s.full_name }
17
+
18
+ assert_equal exp, act
19
+ end
20
+
21
+ def test_no_overlap_specificly
22
+ a = util_spec "a", '1'
23
+ b = util_spec "b", "1"
24
+
25
+ ad = make_dep "a", "= 1"
26
+ bd = make_dep "b", "= 1"
27
+
28
+ deps = [ad, bd]
29
+
30
+ s = set(a, b)
31
+
32
+ res = Gem::DependencyResolver.new(deps, s)
33
+
34
+ assert_set [a, b], res.resolve
35
+ end
36
+
37
+ def test_pulls_in_dependencies
38
+ a = util_spec "a", '1'
39
+ b = util_spec "b", "1", "c" => "= 1"
40
+ c = util_spec "c", "1"
41
+
42
+ ad = make_dep "a", "= 1"
43
+ bd = make_dep "b", "= 1"
44
+
45
+ deps = [ad, bd]
46
+
47
+ s = set(a, b, c)
48
+
49
+ res = Gem::DependencyResolver.new(deps, s)
50
+
51
+ assert_set [a, b, c], res.resolve
52
+ end
53
+
54
+ def test_picks_highest_version
55
+ a1 = util_spec "a", '1'
56
+ a2 = util_spec "a", '2'
57
+
58
+ s = set(a1, a2)
59
+
60
+ ad = make_dep "a"
61
+
62
+ res = Gem::DependencyResolver.new([ad], s)
63
+
64
+ assert_set [a2], res.resolve
65
+ end
66
+
67
+ def test_only_returns_spec_once
68
+ a1 = util_spec "a", "1", "c" => "= 1"
69
+ b1 = util_spec "b", "1", "c" => "= 1"
70
+
71
+ c1 = util_spec "c", "1"
72
+
73
+ ad = make_dep "a"
74
+ bd = make_dep "b"
75
+
76
+ s = set(a1, b1, c1)
77
+
78
+ res = Gem::DependencyResolver.new([ad, bd], s)
79
+
80
+ assert_set [a1, b1, c1], res.resolve
81
+ end
82
+
83
+ def test_picks_lower_version_when_needed
84
+ a1 = util_spec "a", "1", "c" => ">= 1"
85
+ b1 = util_spec "b", "1", "c" => "= 1"
86
+
87
+ c1 = util_spec "c", "1"
88
+ c2 = util_spec "c", "2"
89
+
90
+ ad = make_dep "a"
91
+ bd = make_dep "b"
92
+
93
+ s = set(a1, b1, c1, c2)
94
+
95
+ res = Gem::DependencyResolver.new([ad, bd], s)
96
+
97
+ assert_set [a1, b1, c1], res.resolve
98
+
99
+ cons = res.conflicts
100
+
101
+ assert_equal 1, cons.size
102
+ con = cons.first
103
+
104
+ assert_equal "c (= 1)", con.dependency.to_s
105
+ assert_equal "c-2", con.activated.full_name
106
+ end
107
+
108
+ def test_conflict_resolution_only_effects_correct_spec
109
+ a1 = util_spec "a", "1", "c" => ">= 1"
110
+ b1 = util_spec "b", "1", "d" => ">= 1"
111
+
112
+ d3 = util_spec "d", "3", "c" => "= 1"
113
+ d4 = util_spec "d", "4", "c" => "= 1"
114
+
115
+ c1 = util_spec "c", "1"
116
+ c2 = util_spec "c", "2"
117
+
118
+ ad = make_dep "a"
119
+ bd = make_dep "b"
120
+
121
+ s = set(a1, b1, d3, d4, c1, c2)
122
+
123
+ res = Gem::DependencyResolver.new([ad, bd], s)
124
+
125
+ assert_set [a1, b1, c1, d4], res.resolve
126
+
127
+ cons = res.conflicts
128
+
129
+ assert_equal 1, cons.size
130
+ con = cons.first
131
+
132
+ assert_equal "c (= 1)", con.dependency.to_s
133
+ assert_equal "c-2", con.activated.full_name
134
+ end
135
+
136
+ def test_raises_dependency_error
137
+ a1 = util_spec "a", "1", "c" => "= 1"
138
+ b1 = util_spec "b", "1", "c" => "= 2"
139
+
140
+ c1 = util_spec "c", "1"
141
+ c2 = util_spec "c", "2"
142
+
143
+ ad = make_dep "a"
144
+ bd = make_dep "b"
145
+
146
+ s = set(a1, b1, c1, c2)
147
+
148
+ r = Gem::DependencyResolver.new([ad, bd], s)
149
+
150
+ e = assert_raises Gem::DependencyResolutionError do
151
+ r.resolve
152
+ end
153
+
154
+ assert_equal "unable to resolve conflicting dependencies 'c (= 2)' and 'c (= 1)'", e.message
155
+
156
+ deps = [make_dep("c", "= 2"), make_dep("c", "= 1")]
157
+ assert_equal deps, e.conflicting_dependencies
158
+
159
+ con = e.conflict
160
+
161
+ act = con.activated
162
+ assert_equal "c-1", act.spec.full_name
163
+
164
+ parent = act.parent
165
+ assert_equal "a-1", parent.spec.full_name
166
+
167
+ act = con.requester
168
+ assert_equal "b-1", act.spec.full_name
169
+ end
170
+
171
+ def test_raises_when_a_gem_is_missing
172
+ ad = make_dep "a"
173
+
174
+ r = Gem::DependencyResolver.new([ad], set)
175
+
176
+ e = assert_raises Gem::UnsatisfiableDepedencyError do
177
+ r.resolve
178
+ end
179
+
180
+ assert_equal "unable to find any gem matching dependency 'a (>= 0)'", e.message
181
+
182
+ assert_equal "a (>= 0)", e.dependency.to_s
183
+ end
184
+
185
+ def test_raises_when_a_gem_version_is_missing
186
+ a1 = util_spec "a", "1"
187
+
188
+ ad = make_dep "a", "= 3"
189
+
190
+ r = Gem::DependencyResolver.new([ad], set(a1))
191
+
192
+ e = assert_raises Gem::UnsatisfiableDepedencyError do
193
+ r.resolve
194
+ end
195
+
196
+ assert_equal "a (= 3)", e.dependency.to_s
197
+ end
198
+
199
+ def test_raises_when_possibles_are_exhausted
200
+ a1 = util_spec "a", "1", "c" => ">= 2"
201
+ b1 = util_spec "b", "1", "c" => "= 1"
202
+
203
+ c1 = util_spec "c", "1"
204
+ c2 = util_spec "c", "2"
205
+ c3 = util_spec "c", "3"
206
+
207
+ s = set(a1, b1, c1, c2, c3)
208
+
209
+ ad = make_dep "a"
210
+ bd = make_dep "b"
211
+
212
+ r = Gem::DependencyResolver.new([ad, bd], s)
213
+
214
+ e = assert_raises Gem::ImpossibleDependenciesError do
215
+ r.resolve
216
+ end
217
+
218
+ assert_equal "detected 1 conflict with dependency 'c (>= 2)'", e.message
219
+
220
+ assert_equal "c (>= 2)", e.dependency.to_s
221
+
222
+ s, con = e.conflicts[0]
223
+ assert_equal "c-3", s.full_name
224
+ assert_equal "c (= 1)", con.dependency.to_s
225
+ assert_equal "b-1", con.requester.full_name
226
+ end
227
+
228
+ def test_keeps_resolving_after_seeing_satisfied_dep
229
+ a1 = util_spec "a", "1", "b" => "= 1", "c" => "= 1"
230
+ b1 = util_spec "b", "1"
231
+ c1 = util_spec "c", "1"
232
+
233
+ ad = make_dep "a"
234
+ bd = make_dep "b"
235
+
236
+ s = set(a1, b1, c1)
237
+
238
+ r = Gem::DependencyResolver.new([ad, bd], s)
239
+
240
+ assert_set [a1, b1, c1], r.resolve
241
+ end
242
+
243
+ def test_common_rack_activation_scenario
244
+ rack100 = util_spec "rack", "1.0.0"
245
+ rack101 = util_spec "rack", "1.0.1"
246
+
247
+ lib1 = util_spec "lib", "1", "rack" => ">= 1.0.1"
248
+
249
+ rails = util_spec "rails", "3", "actionpack" => "= 3"
250
+ ap = util_spec "actionpack", "3", "rack" => ">= 1.0.0"
251
+
252
+ d1 = make_dep "rails"
253
+ d2 = make_dep "lib"
254
+
255
+ s = set(lib1, rails, ap, rack100, rack101)
256
+
257
+ r = Gem::DependencyResolver.new([d1, d2], s)
258
+
259
+ assert_set [rails, ap, rack101, lib1], r.resolve
260
+
261
+ # check it with the deps reverse too
262
+
263
+ r = Gem::DependencyResolver.new([d2, d1], s)
264
+
265
+ assert_set [lib1, rack101, rails, ap], r.resolve
266
+ end
267
+
268
+ def test_backtracks_to_the_first_conflict
269
+ a1 = util_spec "a", "1"
270
+ a2 = util_spec "a", "2"
271
+ a3 = util_spec "a", "3"
272
+ a4 = util_spec "a", "4"
273
+
274
+ d1 = make_dep "a"
275
+ d2 = make_dep "a", ">= 2"
276
+ d3 = make_dep "a", "= 1"
277
+
278
+ s = set(a1, a2, a3, a4)
279
+
280
+ r = Gem::DependencyResolver.new([d1, d2, d3], s)
281
+
282
+ assert_raises Gem::ImpossibleDependenciesError do
283
+ r.resolve
284
+ end
285
+ end
286
+
287
+ # actionmailer 2.3.4
288
+ # activemerchant 1.5.0
289
+ # activesupport 2.3.5, 2.3.4
290
+ # Activemerchant needs activesupport >= 2.3.2. When you require activemerchant, it will activate the latest version that meets that requirement which is 2.3.5. Actionmailer on the other hand needs activesupport = 2.3.4. When rubygems tries to activate activesupport 2.3.4, it will raise an error.
291
+
292
+
293
+ def test_simple_activesupport_problem
294
+ sup1 = util_spec "activesupport", "2.3.4"
295
+ sup2 = util_spec "activesupport", "2.3.5"
296
+
297
+ merch = util_spec "activemerchant", "1.5.0", "activesupport" => ">= 2.3.2"
298
+ mail = util_spec "actionmailer", "2.3.4", "activesupport" => "= 2.3.4"
299
+
300
+ s = set(mail, merch, sup1, sup2)
301
+
302
+ d1 = make_dep "activemerchant"
303
+ d2 = make_dep "actionmailer"
304
+
305
+ r = Gem::DependencyResolver.new([d1, d2], s)
306
+
307
+ assert_set [merch, mail, sup1], r.resolve
308
+ end
309
+
310
+ def test_second_level_backout
311
+ b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb"
312
+ b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
313
+ c1 = new_spec "c", "1"
314
+ c2 = new_spec "c", "2"
315
+ d1 = new_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
316
+ d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb"
317
+
318
+ s = set(b1, b2, c1, c2, d1, d2)
319
+
320
+ p1 = make_dep "b", "> 0"
321
+ p2 = make_dep "d", "> 0"
322
+
323
+ r = Gem::DependencyResolver.new([p1, p2], s)
324
+
325
+ assert_set [b1, c1, d2], r.resolve
326
+ end
327
+ end
@@ -30,9 +30,9 @@ class TestGemExtConfigureBuilder < Gem::TestCase
30
30
 
31
31
  assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
32
32
  assert_equal "", output.shift
33
- assert_contains_make_command '', output.shift
33
+ assert_equal make_command, output.shift
34
34
  assert_match(/^ok$/m, output.shift)
35
- assert_contains_make_command 'install', output.shift
35
+ assert_equal make_command + " install", output.shift
36
36
  assert_match(/^ok$/m, output.shift)
37
37
  end
38
38
 
@@ -76,8 +76,8 @@ class TestGemExtConfigureBuilder < Gem::TestCase
76
76
  Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
77
77
  end
78
78
 
79
- assert_contains_make_command '', output[0]
80
- assert_contains_make_command 'install', output[2]
79
+ assert_equal make_command, output[0]
80
+ assert_equal "#{make_command} install", output[2]
81
81
  end
82
82
 
83
83
  end
@@ -27,17 +27,19 @@ class TestGemExtExtConfBuilder < Gem::TestCase
27
27
  output = []
28
28
 
29
29
  Dir.chdir @ext do
30
- result =
31
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
32
-
33
- assert_same result, output
30
+ Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
34
31
  end
35
32
 
36
33
  assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
37
34
  assert_equal "creating Makefile\n", output[1]
38
- assert_contains_make_command '', output[2]
39
- assert_contains_make_command 'install', output[4]
40
- assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
35
+ case RUBY_PLATFORM
36
+ when /mswin/ then
37
+ assert_equal "nmake", output[2]
38
+ assert_equal "nmake install", output[4]
39
+ else
40
+ assert_equal "make", output[2]
41
+ assert_equal "make install", output[4]
42
+ end
41
43
  end
42
44
 
43
45
  def test_class_build_rbconfig_make_prog
@@ -54,8 +56,8 @@ class TestGemExtExtConfBuilder < Gem::TestCase
54
56
  end
55
57
 
56
58
  assert_equal "creating Makefile\n", output[1]
57
- assert_contains_make_command '', output[2]
58
- assert_contains_make_command 'install', output[4]
59
+ assert_equal make_command, output[2]
60
+ assert_equal "#{make_command} install", output[4]
59
61
  ensure
60
62
  RbConfig::CONFIG['configure_args'] = configure_args
61
63
  end
@@ -78,7 +80,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
78
80
  end
79
81
 
80
82
  assert_equal "creating Makefile\n", output[1]
81
- assert_contains_make_command '', output[2]
83
+ assert_equal "anothermake", output[2]
82
84
  ensure
83
85
  RbConfig::CONFIG['configure_args'] = configure_args
84
86
  ENV['make'] = env_make
@@ -108,43 +110,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
108
110
  #{Gem.ruby} extconf.rb.*
109
111
  checking for main\(\) in .*?nonexistent/m, error.message)
110
112
 
111
- assert_equal("#{Gem.ruby} extconf.rb", output[0])
112
- end
113
-
114
- def test_class_build_unconventional
115
- if vc_windows? && !nmake_found?
116
- skip("test_class_build skipped - nmake not found")
117
- end
118
-
119
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
120
- extconf.puts <<-'EXTCONF'
121
- include RbConfig
122
-
123
- ruby_exe = "#{CONFIG['RUBY_INSTALL_NAME']}#{CONFIG['EXEEXT']}"
124
- ruby = File.join CONFIG['bindir'], ruby_exe
125
-
126
- open 'Makefile', 'w' do |io|
127
- io.write <<-Makefile
128
- all: ruby
129
- install: ruby
130
-
131
- ruby:
132
- \t#{ruby} -e0
133
-
134
- Makefile
135
- end
136
- EXTCONF
137
- end
138
-
139
- output = []
140
-
141
- Dir.chdir @ext do
142
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
143
- end
144
-
145
- assert_contains_make_command '', output[2]
146
- assert_contains_make_command 'install', output[4]
147
- assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
113
+ assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
148
114
  end
149
115
 
150
116
  def test_class_make
@@ -166,8 +132,14 @@ end
166
132
  Gem::Ext::ExtConfBuilder.make @ext, output
167
133
  end
168
134
 
169
- assert_contains_make_command '', output[0]
170
- assert_contains_make_command 'install', output[2]
135
+ assert_equal make_command, output[0]
136
+ assert_equal "#{make_command} install", output[2]
137
+
138
+ edited_makefile = Gem.read_binary makefile_path
139
+ edited_makefile.gsub!(/\r/, '') if Gem.win_platform?
140
+
141
+ assert_match "\nRUBYARCHDIR = #{@ext}$(target_prefix)\n", edited_makefile
142
+ assert_match "\nRUBYLIBDIR = #{@ext}$(target_prefix)\n", edited_makefile
171
143
  end
172
144
 
173
145
  def test_class_make_no_Makefile