rubygems-update 2.1.11 → 2.2.0.rc.1

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 (190) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +37 -12
  5. data/History.txt +99 -2
  6. data/MIT.txt +1 -0
  7. data/Manifest.txt +59 -19
  8. data/Rakefile +4 -6
  9. data/lib/gauntlet_rubygems.rb +1 -1
  10. data/lib/rubygems.rb +102 -80
  11. data/lib/rubygems/available_set.rb +2 -2
  12. data/lib/rubygems/basic_specification.rb +97 -8
  13. data/lib/rubygems/commands/install_command.rb +58 -15
  14. data/lib/rubygems/commands/list_command.rb +1 -7
  15. data/lib/rubygems/commands/outdated_command.rb +1 -1
  16. data/lib/rubygems/commands/pristine_command.rb +14 -1
  17. data/lib/rubygems/commands/push_command.rb +9 -4
  18. data/lib/rubygems/commands/query_command.rb +33 -17
  19. data/lib/rubygems/commands/search_command.rb +0 -6
  20. data/lib/rubygems/commands/specification_command.rb +1 -1
  21. data/lib/rubygems/commands/unpack_command.rb +1 -1
  22. data/lib/rubygems/commands/update_command.rb +4 -1
  23. data/lib/rubygems/commands/which_command.rb +5 -8
  24. data/lib/rubygems/compatibility.rb +3 -0
  25. data/lib/rubygems/core_ext/kernel_gem.rb +6 -0
  26. data/lib/rubygems/defaults.rb +19 -0
  27. data/lib/rubygems/dependency_installer.rb +28 -9
  28. data/lib/rubygems/doctor.rb +17 -11
  29. data/lib/rubygems/errors.rb +16 -3
  30. data/lib/rubygems/exceptions.rb +52 -5
  31. data/lib/rubygems/ext.rb +1 -2
  32. data/lib/rubygems/ext/build_error.rb +6 -0
  33. data/lib/rubygems/ext/builder.rb +50 -17
  34. data/lib/rubygems/ext/cmake_builder.rb +1 -1
  35. data/lib/rubygems/ext/configure_builder.rb +1 -3
  36. data/lib/rubygems/ext/ext_conf_builder.rb +9 -3
  37. data/lib/rubygems/ext/rake_builder.rb +2 -5
  38. data/lib/rubygems/gemcutter_utilities.rb +8 -1
  39. data/lib/rubygems/installer.rb +14 -4
  40. data/lib/rubygems/installer_test_case.rb +0 -5
  41. data/lib/rubygems/package.rb +11 -2
  42. data/lib/rubygems/psych_additions.rb +1 -1
  43. data/lib/rubygems/rdoc.rb +1 -1
  44. data/lib/rubygems/remote_fetcher.rb +3 -3
  45. data/lib/rubygems/request.rb +16 -8
  46. data/lib/rubygems/request_set.rb +133 -42
  47. data/lib/rubygems/request_set/gem_dependency_api.rb +493 -11
  48. data/lib/rubygems/request_set/lockfile.rb +579 -0
  49. data/lib/rubygems/requirement.rb +58 -30
  50. data/lib/rubygems/resolver.rb +471 -0
  51. data/lib/rubygems/resolver/activation_request.rb +165 -0
  52. data/lib/rubygems/resolver/api_set.rb +110 -0
  53. data/lib/rubygems/resolver/api_specification.rb +79 -0
  54. data/lib/rubygems/resolver/best_set.rb +31 -0
  55. data/lib/rubygems/resolver/composed_set.rb +39 -0
  56. data/lib/rubygems/resolver/conflict.rb +122 -0
  57. data/lib/rubygems/{dependency_resolver → resolver}/current_set.rb +1 -4
  58. data/lib/rubygems/{dependency_resolver → resolver}/dependency_request.rb +37 -7
  59. data/lib/rubygems/resolver/git_set.rb +119 -0
  60. data/lib/rubygems/resolver/git_specification.rb +35 -0
  61. data/lib/rubygems/resolver/index_set.rb +74 -0
  62. data/lib/rubygems/resolver/index_specification.rb +69 -0
  63. data/lib/rubygems/resolver/installed_specification.rb +40 -0
  64. data/lib/rubygems/{dependency_resolver → resolver}/installer_set.rb +18 -17
  65. data/lib/rubygems/resolver/local_specification.rb +16 -0
  66. data/lib/rubygems/resolver/lock_set.rb +78 -0
  67. data/lib/rubygems/resolver/lock_specification.rb +58 -0
  68. data/lib/rubygems/resolver/requirement_list.rb +81 -0
  69. data/lib/rubygems/resolver/set.rb +27 -0
  70. data/lib/rubygems/resolver/spec_specification.rb +58 -0
  71. data/lib/rubygems/resolver/specification.rb +89 -0
  72. data/lib/rubygems/resolver/stats.rb +44 -0
  73. data/lib/rubygems/resolver/vendor_set.rb +83 -0
  74. data/lib/rubygems/resolver/vendor_specification.rb +24 -0
  75. data/lib/rubygems/security/trust_dir.rb +16 -2
  76. data/lib/rubygems/source.rb +71 -18
  77. data/lib/rubygems/source/git.rb +218 -0
  78. data/lib/rubygems/source/installed.rb +8 -1
  79. data/lib/rubygems/source/local.rb +14 -8
  80. data/lib/rubygems/source/lock.rb +48 -0
  81. data/lib/rubygems/source/specific_file.rb +14 -3
  82. data/lib/rubygems/source/vendor.rb +27 -0
  83. data/lib/rubygems/source_list.rb +74 -12
  84. data/lib/rubygems/spec_fetcher.rb +36 -4
  85. data/lib/rubygems/specification.rb +214 -65
  86. data/lib/rubygems/stub_specification.rb +57 -1
  87. data/lib/rubygems/syck_hack.rb +3 -3
  88. data/lib/rubygems/test_case.rb +226 -59
  89. data/lib/rubygems/test_utilities.rb +198 -0
  90. data/lib/rubygems/uninstaller.rb +22 -10
  91. data/lib/rubygems/uri_formatter.rb +20 -0
  92. data/lib/rubygems/user_interaction.rb +193 -71
  93. data/lib/rubygems/util.rb +121 -0
  94. data/lib/rubygems/util/list.rb +4 -0
  95. data/lib/rubygems/util/stringio.rb +34 -0
  96. data/lib/rubygems/validator.rb +6 -2
  97. data/lib/rubygems/version.rb +4 -8
  98. data/test/rubygems/test_bundled_ca.rb +1 -1
  99. data/test/rubygems/test_gem.rb +137 -29
  100. data/test/rubygems/test_gem_available_set.rb +19 -0
  101. data/test/rubygems/test_gem_commands_build_command.rb +1 -1
  102. data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
  103. data/test/rubygems/test_gem_commands_cleanup_command.rb +13 -13
  104. data/test/rubygems/test_gem_commands_dependency_command.rb +24 -34
  105. data/test/rubygems/test_gem_commands_fetch_command.rb +43 -48
  106. data/test/rubygems/test_gem_commands_install_command.rb +244 -279
  107. data/test/rubygems/test_gem_commands_list_command.rb +3 -3
  108. data/test/rubygems/test_gem_commands_outdated_command.rb +7 -12
  109. data/test/rubygems/test_gem_commands_pristine_command.rb +73 -27
  110. data/test/rubygems/test_gem_commands_push_command.rb +76 -8
  111. data/test/rubygems/test_gem_commands_query_command.rb +239 -49
  112. data/test/rubygems/test_gem_commands_sources_command.rb +10 -43
  113. data/test/rubygems/test_gem_commands_specification_command.rb +24 -47
  114. data/test/rubygems/test_gem_commands_stale_command.rb +2 -2
  115. data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
  116. data/test/rubygems/test_gem_commands_unpack_command.rb +16 -30
  117. data/test/rubygems/test_gem_commands_update_command.rb +149 -134
  118. data/test/rubygems/test_gem_commands_which_command.rb +4 -2
  119. data/test/rubygems/test_gem_dependency_installer.rb +68 -0
  120. data/test/rubygems/test_gem_dependency_list.rb +17 -17
  121. data/test/rubygems/test_gem_dependency_resolution_error.rb +28 -0
  122. data/test/rubygems/test_gem_doctor.rb +1 -1
  123. data/test/rubygems/test_gem_ext_builder.rb +178 -8
  124. data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -7
  125. data/test/rubygems/test_gem_ext_configure_builder.rb +8 -10
  126. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +18 -21
  127. data/test/rubygems/test_gem_ext_rake_builder.rb +1 -3
  128. data/test/rubygems/test_gem_impossible_dependencies_error.rb +10 -6
  129. data/test/rubygems/test_gem_indexer.rb +6 -6
  130. data/test/rubygems/test_gem_installer.rb +29 -10
  131. data/test/rubygems/test_gem_local_remote_options.rb +1 -1
  132. data/test/rubygems/test_gem_package.rb +18 -0
  133. data/test/rubygems/test_gem_rdoc.rb +1 -1
  134. data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
  135. data/test/rubygems/test_gem_request.rb +37 -10
  136. data/test/rubygems/test_gem_request_set.rb +271 -9
  137. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +684 -0
  138. data/test/rubygems/test_gem_request_set_lockfile.rb +849 -0
  139. data/test/rubygems/test_gem_requirement.rb +21 -0
  140. data/test/rubygems/{test_gem_dependency_resolver.rb → test_gem_resolver.rb} +231 -70
  141. data/test/rubygems/test_gem_resolver_activation_request.rb +63 -0
  142. data/test/rubygems/test_gem_resolver_api_set.rb +167 -0
  143. data/test/rubygems/test_gem_resolver_api_specification.rb +104 -0
  144. data/test/rubygems/test_gem_resolver_best_set.rb +30 -0
  145. data/test/rubygems/test_gem_resolver_conflict.rb +75 -0
  146. data/test/rubygems/test_gem_resolver_dependency_request.rb +20 -0
  147. data/test/rubygems/test_gem_resolver_git_set.rb +148 -0
  148. data/test/rubygems/test_gem_resolver_git_specification.rb +100 -0
  149. data/test/rubygems/test_gem_resolver_index_set.rb +28 -0
  150. data/test/rubygems/test_gem_resolver_index_specification.rb +89 -0
  151. data/test/rubygems/test_gem_resolver_installed_specification.rb +49 -0
  152. data/test/rubygems/test_gem_resolver_installer_set.rb +22 -0
  153. data/test/rubygems/test_gem_resolver_local_specification.rb +45 -0
  154. data/test/rubygems/test_gem_resolver_lock_set.rb +57 -0
  155. data/test/rubygems/test_gem_resolver_lock_specification.rb +87 -0
  156. data/test/rubygems/test_gem_resolver_requirement_list.rb +20 -0
  157. data/test/rubygems/test_gem_resolver_specification.rb +32 -0
  158. data/test/rubygems/test_gem_resolver_vendor_set.rb +67 -0
  159. data/test/rubygems/test_gem_resolver_vendor_specification.rb +83 -0
  160. data/test/rubygems/test_gem_server.rb +4 -4
  161. data/test/rubygems/test_gem_source.rb +54 -64
  162. data/test/rubygems/test_gem_source_git.rb +231 -0
  163. data/test/rubygems/test_gem_source_list.rb +24 -0
  164. data/test/rubygems/test_gem_source_local.rb +1 -1
  165. data/test/rubygems/test_gem_source_lock.rb +114 -0
  166. data/test/rubygems/test_gem_source_vendor.rb +27 -0
  167. data/test/rubygems/test_gem_spec_fetcher.rb +116 -61
  168. data/test/rubygems/test_gem_specification.rb +526 -94
  169. data/test/rubygems/test_gem_stub_specification.rb +123 -10
  170. data/test/rubygems/test_gem_uninstaller.rb +28 -2
  171. data/test/rubygems/test_gem_util.rb +31 -0
  172. data/test/rubygems/test_gem_validator.rb +9 -0
  173. data/util/update_bundled_ca_certificates.rb +8 -1
  174. metadata +89 -29
  175. metadata.gz.sig +2 -4
  176. data/lib/rubygems/dependency_resolver.rb +0 -254
  177. data/lib/rubygems/dependency_resolver/activation_request.rb +0 -109
  178. data/lib/rubygems/dependency_resolver/api_set.rb +0 -65
  179. data/lib/rubygems/dependency_resolver/api_specification.rb +0 -39
  180. data/lib/rubygems/dependency_resolver/composed_set.rb +0 -18
  181. data/lib/rubygems/dependency_resolver/dependency_conflict.rb +0 -85
  182. data/lib/rubygems/dependency_resolver/index_set.rb +0 -64
  183. data/lib/rubygems/dependency_resolver/index_specification.rb +0 -60
  184. data/lib/rubygems/dependency_resolver/installed_specification.rb +0 -52
  185. data/test/rubygems/test_gem_dependency_resolver_api_specification.rb +0 -33
  186. data/test/rubygems/test_gem_dependency_resolver_dependency_conflict.rb +0 -36
  187. data/test/rubygems/test_gem_dependency_resolver_index_set.rb +0 -53
  188. data/test/rubygems/test_gem_dependency_resolver_index_specification.rb +0 -73
  189. data/test/rubygems/test_gem_dependency_resolver_installed_specification.rb +0 -19
  190. data/test/rubygems/test_gem_dependency_resolver_installer_set.rb +0 -28
metadata.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- $�i\��ִR��%�ҁ�.�" ��7ʷ�%��ᚂh��
2
- ���7��2{�H}���s`�L��h�+.J�.�T�������Z��q�@p{���h>����%�Z��>Z��@�<�9x��V �ޙ�i�`~h{iD
3
- ���
4
- (�x��>(%�thH{ڭI�[�)�0o�%��}:�2a~t��s��y�R�
1
+ Q�܊x0��Ǫ�� T�cqs��qx�=��]���1@3*�����w�s����xY�Dd �ܪ҄����qT�Ԇ�;��/�yD����J=��*,?0m�w-��B�P򓅞`d�s����k2Q�a* ��d�0�� vץul���ӧ���&�c�@���t��ax/֮�Q����DV����D�u�t���6�4 ���P��y .7�;j��b�I8�`�/cZ��3�
2
+ �q ��t� [
@@ -1,254 +0,0 @@
1
- require 'rubygems'
2
- require 'rubygems/dependency'
3
- require 'rubygems/exceptions'
4
- require 'rubygems/util/list'
5
-
6
- require 'uri'
7
- require 'net/http'
8
-
9
- ##
10
- # Given a set of Gem::Dependency objects as +needed+ and a way to query the
11
- # set of available specs via +set+, calculates a set of ActivationRequest
12
- # objects which indicate all the specs that should be activated to meet the
13
- # all the requirements.
14
-
15
- class Gem::DependencyResolver
16
-
17
- ##
18
- # Contains all the conflicts encountered while doing resolution
19
-
20
- attr_reader :conflicts
21
-
22
- attr_accessor :development
23
-
24
- attr_reader :missing
25
-
26
- ##
27
- # When a missing dependency, don't stop. Just go on and record what was
28
- # missing.
29
-
30
- attr_accessor :soft_missing
31
-
32
- def self.compose_sets *sets
33
- Gem::DependencyResolver::ComposedSet.new(*sets)
34
- end
35
-
36
- ##
37
- # Provide a DependencyResolver that queries only against the already
38
- # installed gems.
39
-
40
- def self.for_current_gems needed
41
- new needed, Gem::DependencyResolver::CurrentSet.new
42
- end
43
-
44
- ##
45
- # Create DependencyResolver object which will resolve the tree starting
46
- # with +needed+ Depedency objects.
47
- #
48
- # +set+ is an object that provides where to look for specifications to
49
- # satisify the Dependencies. This defaults to IndexSet, which will query
50
- # rubygems.org.
51
-
52
- def initialize needed, set = nil
53
- @set = set || Gem::DependencyResolver::IndexSet.new
54
- @needed = needed
55
-
56
- @conflicts = nil
57
- @development = false
58
- @missing = []
59
- @soft_missing = false
60
- end
61
-
62
- def requests s, act, reqs=nil
63
- s.dependencies.reverse_each do |d|
64
- next if d.type == :development and not @development
65
- reqs = Gem::List.new Gem::DependencyResolver::DependencyRequest.new(d, act), reqs
66
- end
67
-
68
- @set.prefetch reqs
69
-
70
- reqs
71
- end
72
-
73
- ##
74
- # Proceed with resolution! Returns an array of ActivationRequest objects.
75
-
76
- def resolve
77
- @conflicts = []
78
-
79
- needed = nil
80
-
81
- @needed.reverse_each do |n|
82
- request = Gem::DependencyResolver::DependencyRequest.new n, nil
83
-
84
- needed = Gem::List.new request, needed
85
- end
86
-
87
- res = resolve_for needed, nil
88
-
89
- raise Gem::DependencyResolutionError, res if
90
- res.kind_of? Gem::DependencyResolver::DependencyConflict
91
-
92
- res.to_a
93
- end
94
-
95
- ##
96
- # The meat of the algorithm. Given +needed+ DependencyRequest objects and
97
- # +specs+ being a list to ActivationRequest, calculate a new list of
98
- # ActivationRequest objects.
99
-
100
- def resolve_for needed, specs
101
- while needed
102
- dep = needed.value
103
- needed = needed.tail
104
-
105
- # If there is already a spec activated for the requested name...
106
- if specs && existing = specs.find { |s| dep.name == s.name }
107
-
108
- # then we're done since this new dep matches the
109
- # existing spec.
110
- next if dep.matches_spec? existing
111
-
112
- # There is a conflict! We return the conflict
113
- # object which will be seen by the caller and be
114
- # handled at the right level.
115
-
116
- # If the existing activation indicates that there
117
- # are other possibles for it, then issue the conflict
118
- # on the dep for the activation itself. Otherwise, issue
119
- # it on the requester's request itself.
120
- #
121
- if existing.others_possible? or existing.request.requester.nil? then
122
- conflict =
123
- Gem::DependencyResolver::DependencyConflict.new dep, existing
124
- else
125
- depreq = existing.request.requester.request
126
- conflict =
127
- Gem::DependencyResolver::DependencyConflict.new depreq, existing, dep
128
- end
129
- @conflicts << conflict
130
-
131
- return conflict
132
- end
133
-
134
- # Get a list of all specs that satisfy dep and platform
135
- all_possible = @set.find_all dep
136
- possible = select_local_platforms all_possible
137
-
138
- case possible.size
139
- when 0
140
- @missing << dep
141
-
142
- unless @soft_missing
143
- # If there are none, then our work here is done.
144
- raise Gem::UnsatisfiableDependencyError.new dep, all_possible
145
- end
146
- when 1
147
- # If there is one, then we just add it to specs
148
- # and process the specs dependencies by adding
149
- # them to needed.
150
-
151
- spec = possible.first
152
- act = Gem::DependencyResolver::ActivationRequest.new spec, dep, false
153
-
154
- specs = Gem::List.prepend specs, act
155
-
156
- # Put the deps for at the beginning of needed
157
- # rather than the end to match the depth first
158
- # searching done by the multiple case code below.
159
- #
160
- # This keeps the error messages consistent.
161
- needed = requests(spec, act, needed)
162
- else
163
- # There are multiple specs for this dep. This is
164
- # the case that this class is built to handle.
165
-
166
- # Sort them so that we try the highest versions
167
- # first.
168
- possible = possible.sort_by do |s|
169
- [s.source, s.version, s.platform == Gem::Platform::RUBY ? -1 : 1]
170
- end
171
-
172
- # We track the conflicts seen so that we can report them
173
- # to help the user figure out how to fix the situation.
174
- conflicts = []
175
-
176
- # To figure out which to pick, we keep resolving
177
- # given each one being activated and if there isn't
178
- # a conflict, we know we've found a full set.
179
- #
180
- # We use an until loop rather than #reverse_each
181
- # to keep the stack short since we're using a recursive
182
- # algorithm.
183
- #
184
- until possible.empty?
185
- s = possible.pop
186
-
187
- # Recursively call #resolve_for with this spec
188
- # and add it's dependencies into the picture...
189
-
190
- act = Gem::DependencyResolver::ActivationRequest.new s, dep
191
-
192
- try = requests(s, act, needed)
193
-
194
- res = resolve_for try, Gem::List.prepend(specs, act)
195
-
196
- # While trying to resolve these dependencies, there may
197
- # be a conflict!
198
-
199
- if res.kind_of? Gem::DependencyResolver::DependencyConflict
200
- # The conflict might be created not by this invocation
201
- # but rather one up the stack, so if we can't attempt
202
- # to resolve this conflict (conflict isn't with the spec +s+)
203
- # then just return it so the caller can try to sort it out.
204
- return res unless res.for_spec? s
205
-
206
- # Otherwise, this is a conflict that we can attempt to fix
207
- conflicts << [s, res]
208
-
209
- # Optimization:
210
- #
211
- # Because the conflict indicates the dependency that trigger
212
- # it, we can prune possible based on this new information.
213
- #
214
- # This cuts down on the number of iterations needed.
215
- possible.delete_if { |x| !res.dependency.matches_spec? x }
216
- else
217
- # No conflict, return the specs
218
- return res
219
- end
220
- end
221
-
222
- # We tried all possibles and nothing worked, so we let the user
223
- # know and include as much information about the problem since
224
- # the user is going to have to take action to fix this.
225
- raise Gem::ImpossibleDependenciesError.new(dep, conflicts)
226
- end
227
- end
228
-
229
- specs
230
- end
231
-
232
- ##
233
- # Returns the gems in +specs+ that match the local platform.
234
-
235
- def select_local_platforms specs # :nodoc:
236
- specs.select do |spec|
237
- Gem::Platform.installable? spec
238
- end
239
- end
240
-
241
- end
242
-
243
- require 'rubygems/dependency_resolver/api_set'
244
- require 'rubygems/dependency_resolver/api_specification'
245
- require 'rubygems/dependency_resolver/activation_request'
246
- require 'rubygems/dependency_resolver/composed_set'
247
- require 'rubygems/dependency_resolver/current_set'
248
- require 'rubygems/dependency_resolver/dependency_conflict'
249
- require 'rubygems/dependency_resolver/dependency_request'
250
- require 'rubygems/dependency_resolver/index_set'
251
- require 'rubygems/dependency_resolver/index_specification'
252
- require 'rubygems/dependency_resolver/installed_specification'
253
- require 'rubygems/dependency_resolver/installer_set'
254
-
@@ -1,109 +0,0 @@
1
- ##
2
- # Specifies a Specification object that should be activated.
3
- # Also contains a dependency that was used to introduce this
4
- # activation.
5
-
6
- class Gem::DependencyResolver::ActivationRequest
7
-
8
- attr_reader :request
9
-
10
- attr_reader :spec
11
-
12
- def initialize spec, req, others_possible = true
13
- @spec = spec
14
- @request = req
15
- @others_possible = others_possible
16
- end
17
-
18
- def == other
19
- case other
20
- when Gem::Specification
21
- @spec == other
22
- when Gem::DependencyResolver::ActivationRequest
23
- @spec == other.spec && @request == other.request
24
- else
25
- false
26
- end
27
- end
28
-
29
- def download path
30
- if @spec.respond_to? :source
31
- source = @spec.source
32
- else
33
- source = Gem.sources.first
34
- end
35
-
36
- Gem.ensure_gem_subdirectories path
37
-
38
- source.download full_spec, path
39
- end
40
-
41
- def full_name
42
- @spec.full_name
43
- end
44
-
45
- def full_spec
46
- Gem::Specification === @spec ? @spec : @spec.spec
47
- end
48
-
49
- def inspect # :nodoc:
50
- others_possible = nil
51
- others_possible = ' (others possible)' if @others_possible
52
-
53
- '#<%s for %p from %s%s>' % [
54
- self.class, @spec, @request, others_possible
55
- ]
56
- end
57
-
58
- ##
59
- # Indicates if the requested gem has already been installed.
60
-
61
- def installed?
62
- this_spec = full_spec
63
-
64
- Gem::Specification.any? do |s|
65
- s == this_spec
66
- end
67
- end
68
-
69
- def name
70
- @spec.name
71
- end
72
-
73
- ##
74
- # Indicate if this activation is one of a set of possible
75
- # requests for the same Dependency request.
76
-
77
- def others_possible?
78
- @others_possible
79
- end
80
-
81
- ##
82
- # Return the ActivationRequest that contained the dependency
83
- # that we were activated for.
84
-
85
- def parent
86
- @request.requester
87
- end
88
-
89
- def pretty_print q # :nodoc:
90
- q.group 2, '[Activation request', ']' do
91
- q.breakable
92
- q.pp @spec
93
-
94
- q.breakable
95
- q.text ' for '
96
- q.pp @request
97
-
98
-
99
- q.breakable
100
- q.text ' (other possible)' if @others_possible
101
- end
102
- end
103
-
104
- def version
105
- @spec.version
106
- end
107
-
108
- end
109
-
@@ -1,65 +0,0 @@
1
- ##
2
- # The global rubygems pool, available via the rubygems.org API.
3
- # Returns instances of APISpecification.
4
-
5
- class Gem::DependencyResolver::APISet
6
-
7
- def initialize
8
- @data = Hash.new { |h,k| h[k] = [] }
9
- @dep_uri = URI 'https://rubygems.org/api/v1/dependencies'
10
- end
11
-
12
- ##
13
- # Return an array of APISpecification objects matching
14
- # DependencyRequest +req+.
15
-
16
- def find_all req
17
- res = []
18
-
19
- versions(req.name).each do |ver|
20
- if req.dependency.match? req.name, ver[:number]
21
- res << Gem::DependencyResolver::APISpecification.new(self, ver)
22
- end
23
- end
24
-
25
- res
26
- end
27
-
28
- ##
29
- # A hint run by the resolver to allow the Set to fetch
30
- # data for DependencyRequests +reqs+.
31
-
32
- def prefetch reqs
33
- names = reqs.map { |r| r.dependency.name }
34
- needed = names.find_all { |d| !@data.key?(d) }
35
-
36
- return if needed.empty?
37
-
38
- uri = @dep_uri + "?gems=#{needed.sort.join ','}"
39
- str = Gem::RemoteFetcher.fetcher.fetch_path uri
40
-
41
- Marshal.load(str).each do |ver|
42
- @data[ver[:name]] << ver
43
- end
44
- end
45
-
46
- ##
47
- # Return data for all versions of the gem +name+.
48
-
49
- def versions name
50
- if @data.key?(name)
51
- return @data[name]
52
- end
53
-
54
- uri = @dep_uri + "?gems=#{name}"
55
- str = Gem::RemoteFetcher.fetcher.fetch_path uri
56
-
57
- Marshal.load(str).each do |ver|
58
- @data[ver[:name]] << ver
59
- end
60
-
61
- @data[name]
62
- end
63
-
64
- end
65
-
@@ -1,39 +0,0 @@
1
- ##
2
- # Represents a specification retrieved via the rubygems.org
3
- # API. This is used to avoid having to load the full
4
- # Specification object when all we need is the name, version,
5
- # and dependencies.
6
-
7
- class Gem::DependencyResolver::APISpecification
8
-
9
- attr_reader :dependencies
10
- attr_reader :name
11
- attr_reader :platform
12
- attr_reader :set # :nodoc:
13
- attr_reader :version
14
-
15
- def initialize(set, api_data)
16
- @set = set
17
- @name = api_data[:name]
18
- @version = Gem::Version.new api_data[:number]
19
- @platform = api_data[:platform]
20
- @dependencies = api_data[:dependencies].map do |name, ver|
21
- Gem::Dependency.new name, ver.split(/\s*,\s*/)
22
- end
23
- end
24
-
25
- def == other # :nodoc:
26
- self.class === other and
27
- @set == other.set and
28
- @name == other.name and
29
- @version == other.version and
30
- @platform == other.platform and
31
- @dependencies == other.dependencies
32
- end
33
-
34
- def full_name
35
- "#{@name}-#{@version}"
36
- end
37
-
38
- end
39
-