rubygems-update 2.6.4 → 2.6.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 (288) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +18 -24
  3. data/CODE_OF_CONDUCT.md +2 -2
  4. data/CONTRIBUTING.rdoc +1 -1
  5. data/History.txt +30 -1
  6. data/Manifest.txt +233 -3
  7. data/Rakefile +30 -1
  8. data/appveyor.yml +0 -2
  9. data/bundler/CHANGELOG.md +2407 -0
  10. data/bundler/CODE_OF_CONDUCT.md +42 -0
  11. data/bundler/CONTRIBUTING.md +36 -0
  12. data/bundler/DEVELOPMENT.md +148 -0
  13. data/bundler/ISSUES.md +100 -0
  14. data/bundler/LICENSE.md +23 -0
  15. data/bundler/README.md +40 -0
  16. data/bundler/exe/bundle +35 -0
  17. data/bundler/exe/bundle_ruby +61 -0
  18. data/bundler/exe/bundler +22 -0
  19. data/bundler/lib/bundler.rb +455 -0
  20. data/bundler/lib/bundler/capistrano.rb +17 -0
  21. data/bundler/lib/bundler/cli.rb +497 -0
  22. data/bundler/lib/bundler/cli/binstubs.rb +40 -0
  23. data/bundler/lib/bundler/cli/cache.rb +35 -0
  24. data/bundler/lib/bundler/cli/check.rb +40 -0
  25. data/bundler/lib/bundler/cli/clean.rb +26 -0
  26. data/bundler/lib/bundler/cli/common.rb +56 -0
  27. data/bundler/lib/bundler/cli/config.rb +100 -0
  28. data/bundler/lib/bundler/cli/console.rb +39 -0
  29. data/bundler/lib/bundler/cli/exec.rb +82 -0
  30. data/bundler/lib/bundler/cli/gem.rb +214 -0
  31. data/bundler/lib/bundler/cli/init.rb +33 -0
  32. data/bundler/lib/bundler/cli/inject.rb +33 -0
  33. data/bundler/lib/bundler/cli/install.rb +225 -0
  34. data/bundler/lib/bundler/cli/lock.rb +48 -0
  35. data/bundler/lib/bundler/cli/open.rb +25 -0
  36. data/bundler/lib/bundler/cli/outdated.rb +151 -0
  37. data/bundler/lib/bundler/cli/package.rb +46 -0
  38. data/bundler/lib/bundler/cli/platform.rb +45 -0
  39. data/bundler/lib/bundler/cli/plugin.rb +23 -0
  40. data/bundler/lib/bundler/cli/show.rb +75 -0
  41. data/bundler/lib/bundler/cli/update.rb +72 -0
  42. data/bundler/lib/bundler/cli/viz.rb +27 -0
  43. data/bundler/lib/bundler/constants.rb +6 -0
  44. data/bundler/lib/bundler/current_ruby.rb +84 -0
  45. data/bundler/lib/bundler/definition.rb +744 -0
  46. data/bundler/lib/bundler/dep_proxy.rb +46 -0
  47. data/bundler/lib/bundler/dependency.rb +127 -0
  48. data/bundler/lib/bundler/deployment.rb +63 -0
  49. data/bundler/lib/bundler/deprecate.rb +16 -0
  50. data/bundler/lib/bundler/dsl.rb +512 -0
  51. data/bundler/lib/bundler/endpoint_specification.rb +129 -0
  52. data/bundler/lib/bundler/env.rb +83 -0
  53. data/bundler/lib/bundler/environment.rb +42 -0
  54. data/bundler/lib/bundler/environment_preserver.rb +38 -0
  55. data/bundler/lib/bundler/errors.rb +124 -0
  56. data/bundler/lib/bundler/fetcher.rb +304 -0
  57. data/bundler/lib/bundler/fetcher/base.rb +41 -0
  58. data/bundler/lib/bundler/fetcher/compact_index.rb +103 -0
  59. data/bundler/lib/bundler/fetcher/dependency.rb +92 -0
  60. data/bundler/lib/bundler/fetcher/downloader.rb +66 -0
  61. data/bundler/lib/bundler/fetcher/index.rb +51 -0
  62. data/bundler/lib/bundler/friendly_errors.rb +103 -0
  63. data/bundler/lib/bundler/gem_helper.rb +188 -0
  64. data/bundler/lib/bundler/gem_helpers.rb +32 -0
  65. data/bundler/lib/bundler/gem_remote_fetcher.rb +42 -0
  66. data/bundler/lib/bundler/gem_tasks.rb +6 -0
  67. data/bundler/lib/bundler/graph.rb +172 -0
  68. data/bundler/lib/bundler/index.rb +191 -0
  69. data/bundler/lib/bundler/injector.rb +63 -0
  70. data/bundler/lib/bundler/inline.rb +74 -0
  71. data/bundler/lib/bundler/installer.rb +217 -0
  72. data/bundler/lib/bundler/installer/gem_installer.rb +77 -0
  73. data/bundler/lib/bundler/installer/parallel_installer.rb +126 -0
  74. data/bundler/lib/bundler/installer/standalone.rb +52 -0
  75. data/bundler/lib/bundler/lazy_specification.rb +85 -0
  76. data/bundler/lib/bundler/lockfile_parser.rb +233 -0
  77. data/bundler/lib/bundler/match_platform.rb +14 -0
  78. data/bundler/lib/bundler/mirror.rb +218 -0
  79. data/bundler/lib/bundler/plugin.rb +156 -0
  80. data/bundler/lib/bundler/plugin/api.rb +56 -0
  81. data/bundler/lib/bundler/plugin/dsl.rb +29 -0
  82. data/bundler/lib/bundler/plugin/index.rb +88 -0
  83. data/bundler/lib/bundler/plugin/installer.rb +99 -0
  84. data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
  85. data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
  86. data/bundler/lib/bundler/plugin/source_list.rb +24 -0
  87. data/bundler/lib/bundler/postit_trampoline.rb +57 -0
  88. data/bundler/lib/bundler/psyched_yaml.rb +27 -0
  89. data/bundler/lib/bundler/remote_specification.rb +85 -0
  90. data/bundler/lib/bundler/resolver.rb +368 -0
  91. data/bundler/lib/bundler/retry.rb +61 -0
  92. data/bundler/lib/bundler/ruby_dsl.rb +17 -0
  93. data/bundler/lib/bundler/ruby_version.rb +140 -0
  94. data/bundler/lib/bundler/rubygems_ext.rb +178 -0
  95. data/bundler/lib/bundler/rubygems_gem_installer.rb +10 -0
  96. data/bundler/lib/bundler/rubygems_integration.rb +710 -0
  97. data/bundler/lib/bundler/runtime.rb +282 -0
  98. data/bundler/lib/bundler/settings.rb +259 -0
  99. data/bundler/lib/bundler/setup.rb +28 -0
  100. data/bundler/lib/bundler/shared_helpers.rb +212 -0
  101. data/bundler/lib/bundler/similarity_detector.rb +62 -0
  102. data/bundler/lib/bundler/source.rb +37 -0
  103. data/bundler/lib/bundler/source/gemspec.rb +13 -0
  104. data/bundler/lib/bundler/source/git.rb +297 -0
  105. data/bundler/lib/bundler/source/git/git_proxy.rb +218 -0
  106. data/bundler/lib/bundler/source/path.rb +245 -0
  107. data/bundler/lib/bundler/source/path/installer.rb +44 -0
  108. data/bundler/lib/bundler/source/rubygems.rb +450 -0
  109. data/bundler/lib/bundler/source/rubygems/remote.rb +59 -0
  110. data/bundler/lib/bundler/source_list.rb +106 -0
  111. data/bundler/lib/bundler/spec_set.rb +157 -0
  112. data/bundler/lib/bundler/ssl_certs/.document +1 -0
  113. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +65 -0
  114. data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  115. data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  116. data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
  117. data/bundler/lib/bundler/stub_specification.rb +24 -0
  118. data/bundler/lib/bundler/templates/Executable +17 -0
  119. data/bundler/lib/bundler/templates/Executable.standalone +12 -0
  120. data/bundler/lib/bundler/templates/Gemfile +5 -0
  121. data/bundler/lib/bundler/templates/newgem/.travis.yml.tt +5 -0
  122. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
  123. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  124. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  125. data/bundler/lib/bundler/templates/newgem/README.md.tt +41 -0
  126. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
  127. data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
  128. data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  129. data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  130. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  131. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  132. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  133. data/bundler/lib/bundler/templates/newgem/gitignore.tt +16 -0
  134. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  135. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  136. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +46 -0
  137. data/bundler/lib/bundler/templates/newgem/rspec.tt +2 -0
  138. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  139. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  140. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
  141. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
  142. data/bundler/lib/bundler/ui.rb +8 -0
  143. data/bundler/lib/bundler/ui/rg_proxy.rb +18 -0
  144. data/bundler/lib/bundler/ui/shell.rb +114 -0
  145. data/bundler/lib/bundler/ui/silent.rb +48 -0
  146. data/bundler/lib/bundler/uri_credentials_filter.rb +36 -0
  147. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +79 -0
  148. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +98 -0
  149. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +80 -0
  150. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +4 -0
  151. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +10 -0
  152. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  153. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  154. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +203 -0
  155. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +5 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +100 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +65 -0
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +460 -0
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +45 -0
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +54 -0
  170. data/bundler/lib/bundler/vendor/net/http/faster.rb +26 -0
  171. data/bundler/lib/bundler/vendor/net/http/persistent.rb +1230 -0
  172. data/bundler/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
  173. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +15 -0
  174. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
  175. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
  176. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
  177. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
  178. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
  179. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +484 -0
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  206. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
  207. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
  208. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
  209. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
  210. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  211. data/bundler/lib/bundler/vendored_molinillo.rb +3 -0
  212. data/bundler/lib/bundler/vendored_persistent.rb +12 -0
  213. data/bundler/lib/bundler/vendored_thor.rb +4 -0
  214. data/bundler/lib/bundler/version.rb +11 -0
  215. data/bundler/lib/bundler/vlad.rb +12 -0
  216. data/bundler/lib/bundler/worker.rb +82 -0
  217. data/bundler/lib/bundler/yaml_serializer.rb +67 -0
  218. data/bundler/man/bundle-config.ronn +193 -0
  219. data/bundler/man/bundle-exec.ronn +136 -0
  220. data/bundler/man/bundle-gem.ronn +77 -0
  221. data/bundler/man/bundle-install.ronn +404 -0
  222. data/bundler/man/bundle-lock.ronn +47 -0
  223. data/bundler/man/bundle-package.ronn +67 -0
  224. data/bundler/man/bundle-platform.ronn +42 -0
  225. data/bundler/man/bundle-update.ronn +194 -0
  226. data/bundler/man/bundle.ronn +98 -0
  227. data/bundler/man/gemfile.5.ronn +499 -0
  228. data/bundler/man/index.txt +8 -0
  229. data/lib/rubygems.rb +42 -2
  230. data/lib/rubygems/config_file.rb +1 -1
  231. data/lib/rubygems/defaults.rb +18 -0
  232. data/lib/rubygems/installer.rb +1 -0
  233. data/lib/rubygems/package.rb +3 -1
  234. data/lib/rubygems/package/tar_writer.rb +10 -16
  235. data/lib/rubygems/remote_fetcher.rb +1 -15
  236. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  237. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  238. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +57 -145
  239. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  240. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  241. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  242. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  243. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  244. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  245. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  246. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  247. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
  248. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  249. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +55 -54
  250. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
  251. data/lib/rubygems/security/signer.rb +2 -0
  252. data/lib/rubygems/specification.rb +4 -4
  253. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  254. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  255. data/test/rubygems/alternate_cert.pem +10 -9
  256. data/test/rubygems/alternate_cert_32.pem +10 -9
  257. data/test/rubygems/child_cert.pem +11 -9
  258. data/test/rubygems/child_cert_32.pem +11 -9
  259. data/test/rubygems/encrypted_private_key.pem +26 -26
  260. data/test/rubygems/expired_cert.pem +9 -8
  261. data/test/rubygems/future_cert.pem +9 -8
  262. data/test/rubygems/future_cert_32.pem +9 -8
  263. data/test/rubygems/grandchild_cert.pem +11 -9
  264. data/test/rubygems/grandchild_cert_32.pem +11 -9
  265. data/test/rubygems/invalid_issuer_cert.pem +11 -9
  266. data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
  267. data/test/rubygems/invalid_signer_cert.pem +10 -9
  268. data/test/rubygems/invalid_signer_cert_32.pem +10 -9
  269. data/test/rubygems/invalidchild_cert.pem +11 -9
  270. data/test/rubygems/invalidchild_cert_32.pem +11 -9
  271. data/test/rubygems/public_cert.pem +11 -9
  272. data/test/rubygems/public_cert_32.pem +10 -9
  273. data/test/rubygems/test_bundled_ca.rb +1 -1
  274. data/test/rubygems/test_gem.rb +7 -0
  275. data/test/rubygems/test_gem_installer.rb +119 -0
  276. data/test/rubygems/test_gem_package.rb +9 -3
  277. data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
  278. data/test/rubygems/test_gem_remote_fetcher.rb +0 -12
  279. data/test/rubygems/test_gem_security_signer.rb +8 -0
  280. data/test/rubygems/test_gem_specification.rb +1 -1
  281. data/test/rubygems/wrong_key_cert.pem +10 -9
  282. data/test/rubygems/wrong_key_cert_32.pem +10 -9
  283. data/util/ci +73 -0
  284. data/util/create_certs.rb +64 -49
  285. data/util/update_bundled_ca_certificates.rb +23 -2
  286. metadata +257 -19
  287. data/lib/gauntlet_rubygems.rb +0 -51
  288. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Standalone
4
+ def initialize(groups, definition)
5
+ @specs = groups.empty? ? definition.requested_specs : definition.specs_for(groups.map(&:to_sym))
6
+ end
7
+
8
+ def generate
9
+ SharedHelpers.filesystem_access(bundler_path) do |p|
10
+ FileUtils.mkdir_p(p)
11
+ end
12
+ File.open File.join(bundler_path, "setup.rb"), "w" do |file|
13
+ file.puts "require 'rbconfig'"
14
+ file.puts "# ruby 1.8.7 doesn't define RUBY_ENGINE"
15
+ file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'"
16
+ file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
17
+ file.puts "path = File.expand_path('..', __FILE__)"
18
+ paths.each do |path|
19
+ file.puts %($:.unshift "\#{path}/#{path}")
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def paths
27
+ @specs.map do |spec|
28
+ next if spec.name == "bundler"
29
+ Array(spec.require_paths).map do |path|
30
+ gem_path(path, spec).sub(version_dir, '#{ruby_engine}/#{ruby_version}')
31
+ # This is a static string intentionally. It's interpolated at a later time.
32
+ end
33
+ end.flatten
34
+ end
35
+
36
+ def version_dir
37
+ "#{Bundler::RubyVersion.system.engine}/#{RbConfig::CONFIG["ruby_version"]}"
38
+ end
39
+
40
+ def bundler_path
41
+ Bundler.root.join(Bundler.settings[:path], "bundler")
42
+ end
43
+
44
+ def gem_path(path, spec)
45
+ full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
46
+ Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
47
+ rescue TypeError
48
+ error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
49
+ raise Gem::InvalidSpecificationException.new(error_message)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+ require "uri"
3
+ require "rubygems/spec_fetcher"
4
+ require "bundler/match_platform"
5
+
6
+ module Bundler
7
+ class LazySpecification
8
+ include MatchPlatform
9
+
10
+ attr_reader :name, :version, :dependencies, :platform
11
+ attr_accessor :source, :remote
12
+
13
+ def initialize(name, version, platform, source = nil)
14
+ @name = name
15
+ @version = version
16
+ @dependencies = []
17
+ @platform = platform
18
+ @source = source
19
+ @specification = nil
20
+ end
21
+
22
+ def full_name
23
+ if platform == Gem::Platform::RUBY || platform.nil?
24
+ "#{@name}-#{@version}"
25
+ else
26
+ "#{@name}-#{@version}-#{platform}"
27
+ end
28
+ end
29
+
30
+ def ==(other)
31
+ identifier == other.identifier
32
+ end
33
+
34
+ def satisfies?(dependency)
35
+ @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
36
+ end
37
+
38
+ def to_lock
39
+ out = String.new
40
+
41
+ if platform == Gem::Platform::RUBY || platform.nil?
42
+ out << " #{name} (#{version})\n"
43
+ else
44
+ out << " #{name} (#{version}-#{platform})\n"
45
+ end
46
+
47
+ dependencies.sort_by(&:to_s).uniq.each do |dep|
48
+ next if dep.type == :development
49
+ out << " #{dep.to_lock}\n"
50
+ end
51
+
52
+ out
53
+ end
54
+
55
+ def __materialize__
56
+ @specification = source.specs.search(Gem::Dependency.new(name, version)).last
57
+ end
58
+
59
+ def respond_to?(*args)
60
+ super || @specification ? @specification.respond_to?(*args) : nil
61
+ end
62
+
63
+ def to_s
64
+ @__to_s ||= "#{name} (#{version})"
65
+ end
66
+
67
+ def identifier
68
+ @__identifier ||= [name, version, source, platform, dependencies].hash
69
+ end
70
+
71
+ private
72
+
73
+ def to_ary
74
+ nil
75
+ end
76
+
77
+ def method_missing(method, *args, &blk)
78
+ raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
79
+
80
+ return super unless respond_to?(method)
81
+
82
+ @specification.send(method, *args, &blk)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,233 @@
1
+ # frozen_string_literal: true
2
+ require "strscan"
3
+
4
+ # Some versions of the Bundler 1.1 RC series introduced corrupted
5
+ # lockfiles. There were two major problems:
6
+ #
7
+ # * multiple copies of the same GIT section appeared in the lockfile
8
+ # * when this happened, those sections got multiple copies of gems
9
+ # in those sections.
10
+ #
11
+ # As a result, Bundler 1.1 contains code that fixes the earlier
12
+ # corruption. We will remove this fix-up code in Bundler 1.2.
13
+
14
+ module Bundler
15
+ class LockfileParser
16
+ attr_reader :sources, :dependencies, :specs, :platforms, :bundler_version, :ruby_version
17
+
18
+ BUNDLED = "BUNDLED WITH".freeze
19
+ DEPENDENCIES = "DEPENDENCIES".freeze
20
+ PLATFORMS = "PLATFORMS".freeze
21
+ RUBY = "RUBY VERSION".freeze
22
+ GIT = "GIT".freeze
23
+ GEM = "GEM".freeze
24
+ PATH = "PATH".freeze
25
+ SPECS = " specs:".freeze
26
+ OPTIONS = /^ ([a-z]+): (.*)$/i
27
+ SOURCE = [GIT, GEM, PATH].freeze
28
+
29
+ SECTIONS_BY_VERSION_INTRODUCED = {
30
+ Gem::Version.create("1.0") => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
31
+ Gem::Version.create("1.10") => [BUNDLED].freeze,
32
+ Gem::Version.create("1.12") => [RUBY].freeze,
33
+ }.freeze
34
+
35
+ KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten.freeze
36
+
37
+ ENVIRONMENT_VERSION_SECTIONS = [BUNDLED, RUBY].freeze
38
+
39
+ def self.sections_in_lockfile(lockfile_contents)
40
+ lockfile_contents.scan(/^\w[\w ]*$/).uniq
41
+ end
42
+
43
+ def self.unknown_sections_in_lockfile(lockfile_contents)
44
+ sections_in_lockfile(lockfile_contents) - KNOWN_SECTIONS
45
+ end
46
+
47
+ def self.sections_to_ignore(base_version = nil)
48
+ base_version &&= base_version.release
49
+ base_version ||= Gem::Version.create("1.0")
50
+ attributes = []
51
+ SECTIONS_BY_VERSION_INTRODUCED.each do |version, introduced|
52
+ next if version <= base_version
53
+ attributes += introduced
54
+ end
55
+ attributes
56
+ end
57
+
58
+ def initialize(lockfile)
59
+ @platforms = []
60
+ @sources = []
61
+ @dependencies = []
62
+ @state = nil
63
+ @specs = {}
64
+
65
+ @rubygems_aggregate = Source::Rubygems.new
66
+
67
+ if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
68
+ raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
69
+ "Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
70
+ end
71
+
72
+ lockfile.split(/(?:\r?\n)+/).each do |line|
73
+ if SOURCE.include?(line)
74
+ @state = :source
75
+ parse_source(line)
76
+ elsif line == DEPENDENCIES
77
+ @state = :dependency
78
+ elsif line == PLATFORMS
79
+ @state = :platform
80
+ elsif line == RUBY
81
+ @state = :ruby
82
+ elsif line == BUNDLED
83
+ @state = :bundled_with
84
+ elsif line =~ /^[^\s]/
85
+ @state = nil
86
+ elsif @state
87
+ send("parse_#{@state}", line)
88
+ end
89
+ end
90
+ @sources << @rubygems_aggregate
91
+ @specs = @specs.values
92
+ warn_for_outdated_bundler_version
93
+ rescue ArgumentError => e
94
+ Bundler.ui.debug(e)
95
+ raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
96
+ "and then `bundle install` to generate a new lockfile."
97
+ end
98
+
99
+ def warn_for_outdated_bundler_version
100
+ return unless bundler_version
101
+ prerelease_text = bundler_version.prerelease? ? " --pre" : ""
102
+ current_version = Gem::Version.create(Bundler::VERSION)
103
+ case current_version.segments.first <=> bundler_version.segments.first
104
+ when -1
105
+ raise LockfileError, "You must use Bundler #{bundler_version.segments.first} or greater with this lockfile."
106
+ when 0
107
+ if current_version < bundler_version
108
+ Bundler.ui.warn "Warning: the running version of Bundler is older " \
109
+ "than the version that created the lockfile. We suggest you " \
110
+ "upgrade to the latest version of Bundler by running `gem " \
111
+ "install bundler#{prerelease_text}`.\n"
112
+ end
113
+ end
114
+ end
115
+
116
+ private
117
+
118
+ TYPES = {
119
+ GIT => Bundler::Source::Git,
120
+ GEM => Bundler::Source::Rubygems,
121
+ PATH => Bundler::Source::Path,
122
+ }.freeze
123
+
124
+ def parse_source(line)
125
+ case line
126
+ when GIT, GEM, PATH
127
+ @current_source = nil
128
+ @opts = {}
129
+ @type = line
130
+ when SPECS
131
+ case @type
132
+ when PATH
133
+ @current_source = TYPES[@type].from_lock(@opts)
134
+ @sources << @current_source
135
+ when GIT
136
+ @current_source = TYPES[@type].from_lock(@opts)
137
+ # Strip out duplicate GIT sections
138
+ if @sources.include?(@current_source)
139
+ @current_source = @sources.find {|s| s == @current_source }
140
+ else
141
+ @sources << @current_source
142
+ end
143
+ when GEM
144
+ Array(@opts["remote"]).each do |url|
145
+ @rubygems_aggregate.add_remote(url)
146
+ end
147
+ @current_source = @rubygems_aggregate
148
+ end
149
+ when OPTIONS
150
+ value = $2
151
+ value = true if value == "true"
152
+ value = false if value == "false"
153
+
154
+ key = $1
155
+
156
+ if @opts[key]
157
+ @opts[key] = Array(@opts[key])
158
+ @opts[key] << value
159
+ else
160
+ @opts[key] = value
161
+ end
162
+ else
163
+ parse_spec(line)
164
+ end
165
+ end
166
+
167
+ NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'.freeze
168
+ NAME_VERSION_2 = /^ {2}#{NAME_VERSION}(!)?$/
169
+ NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/
170
+ NAME_VERSION_6 = /^ {6}#{NAME_VERSION}$/
171
+
172
+ def parse_dependency(line)
173
+ if line =~ NAME_VERSION_2
174
+ name = $1
175
+ version = $2
176
+ pinned = $4
177
+ version = version.split(",").map(&:strip) if version
178
+
179
+ dep = Bundler::Dependency.new(name, version)
180
+
181
+ if pinned && dep.name != "bundler"
182
+ spec = @specs.find {|_, v| v.name == dep.name }
183
+ dep.source = spec.last.source if spec
184
+
185
+ # Path sources need to know what the default name / version
186
+ # to use in the case that there are no gemspecs present. A fake
187
+ # gemspec is created based on the version set on the dependency
188
+ # TODO: Use the version from the spec instead of from the dependency
189
+ if version && version.size == 1 && version.first =~ /^\s*= (.+)\s*$/ && dep.source.is_a?(Bundler::Source::Path)
190
+ dep.source.name = name
191
+ dep.source.version = $1
192
+ end
193
+ end
194
+
195
+ @dependencies << dep
196
+ end
197
+ end
198
+
199
+ def parse_spec(line)
200
+ if line =~ NAME_VERSION_4
201
+ name = $1
202
+ version = Gem::Version.new($2)
203
+ platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
204
+ @current_spec = LazySpecification.new(name, version, platform)
205
+ @current_spec.source = @current_source
206
+
207
+ # Avoid introducing multiple copies of the same spec (caused by
208
+ # duplicate GIT sections)
209
+ @specs[@current_spec.identifier] ||= @current_spec
210
+ elsif line =~ NAME_VERSION_6
211
+ name = $1
212
+ version = $2
213
+ version = version.split(",").map(&:strip) if version
214
+ dep = Gem::Dependency.new(name, version)
215
+ @current_spec.dependencies << dep
216
+ end
217
+ end
218
+
219
+ def parse_platform(line)
220
+ @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
221
+ end
222
+
223
+ def parse_bundled_with(line)
224
+ line = line.strip
225
+ return unless Gem::Version.correct?(line)
226
+ @bundler_version = Gem::Version.create(line)
227
+ end
228
+
229
+ def parse_ruby(line)
230
+ @ruby_version = line.strip
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/gem_helpers"
3
+
4
+ module Bundler
5
+ module MatchPlatform
6
+ include GemHelpers
7
+
8
+ def match_platform(p)
9
+ Gem::Platform::RUBY == platform ||
10
+ platform.nil? || p == platform ||
11
+ generic(Gem::Platform.new(platform)) === p
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,218 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Settings
4
+ # Class used to build the mirror set and then find a mirror for a given URI
5
+ #
6
+ # @param prober [Prober object, nil] by default a TCPSocketProbe, this object
7
+ # will be used to probe the mirror address to validate that the mirror replies.
8
+ class Mirrors
9
+ def initialize(prober = nil)
10
+ @all = Mirror.new
11
+ @prober = prober || TCPSocketProbe.new
12
+ @mirrors = {}
13
+ end
14
+
15
+ # Returns a mirror for the given uri.
16
+ #
17
+ # Depending on the uri having a valid mirror or not, it may be a
18
+ # mirror that points to the provided uri
19
+ def for(uri)
20
+ if @all.validate!(@prober).valid?
21
+ @all
22
+ else
23
+ fetch_valid_mirror_for(Settings.normalize_uri(uri))
24
+ end
25
+ end
26
+
27
+ def each
28
+ @mirrors.each do |k, v|
29
+ yield k, v.uri.to_s
30
+ end
31
+ end
32
+
33
+ def parse(key, value)
34
+ config = MirrorConfig.new(key, value)
35
+ mirror = if config.all?
36
+ @all
37
+ else
38
+ (@mirrors[config.uri] = @mirrors[config.uri] || Mirror.new)
39
+ end
40
+ config.update_mirror(mirror)
41
+ end
42
+
43
+ private
44
+
45
+ def fetch_valid_mirror_for(uri)
46
+ mirror = (@mirrors[URI(uri.to_s.downcase)] || Mirror.new(uri)).validate!(@prober)
47
+ mirror = Mirror.new(uri) unless mirror.valid?
48
+ mirror
49
+ end
50
+ end
51
+
52
+ # A mirror
53
+ #
54
+ # Contains both the uri that should be used as a mirror and the
55
+ # fallback timeout which will be used for probing if the mirror
56
+ # replies on time or not.
57
+ class Mirror
58
+ DEFAULT_FALLBACK_TIMEOUT = 0.1
59
+
60
+ attr_reader :uri, :fallback_timeout
61
+
62
+ def initialize(uri = nil, fallback_timeout = 0)
63
+ self.uri = uri
64
+ self.fallback_timeout = fallback_timeout
65
+ @valid = nil
66
+ end
67
+
68
+ def uri=(uri)
69
+ @uri = if uri.nil?
70
+ nil
71
+ else
72
+ URI(uri.to_s)
73
+ end
74
+ @valid = nil
75
+ end
76
+
77
+ def fallback_timeout=(timeout)
78
+ case timeout
79
+ when true, "true"
80
+ @fallback_timeout = DEFAULT_FALLBACK_TIMEOUT
81
+ when false, "false"
82
+ @fallback_timeout = 0
83
+ else
84
+ @fallback_timeout = timeout.to_i
85
+ end
86
+ @valid = nil
87
+ end
88
+
89
+ def ==(other)
90
+ !other.nil? && uri == other.uri && fallback_timeout == other.fallback_timeout
91
+ end
92
+
93
+ def valid?
94
+ return false if @uri.nil?
95
+ return @valid unless @valid.nil?
96
+ false
97
+ end
98
+
99
+ def validate!(probe = nil)
100
+ @valid = false if uri.nil?
101
+ if @valid.nil?
102
+ @valid = fallback_timeout == 0 || (probe || TCPSocketProbe.new).replies?(self)
103
+ end
104
+ self
105
+ end
106
+ end
107
+
108
+ # Class used to parse one configuration line
109
+ #
110
+ # Gets the configuration line and the value.
111
+ # This object provides a `update_mirror` method
112
+ # used to setup the given mirror value.
113
+ class MirrorConfig
114
+ attr_accessor :uri, :value
115
+
116
+ def initialize(config_line, value)
117
+ uri, fallback =
118
+ config_line.match(%r{^mirror\.(all|.+?)(\.fallback_timeout)?\/?$}).captures
119
+ @fallback = !fallback.nil?
120
+ @all = false
121
+ if uri == "all"
122
+ @all = true
123
+ else
124
+ @uri = Settings.normalize_uri(uri)
125
+ end
126
+ @value = value
127
+ end
128
+
129
+ def all?
130
+ @all
131
+ end
132
+
133
+ def update_mirror(mirror)
134
+ if @fallback
135
+ mirror.fallback_timeout = @value
136
+ else
137
+ mirror.uri = Settings.normalize_uri(@value)
138
+ end
139
+ end
140
+ end
141
+
142
+ # Class used for probing TCP availability for a given mirror.
143
+ class TCPSocketProbe
144
+ def replies?(mirror)
145
+ MirrorSockets.new(mirror).any? do |socket, address, timeout|
146
+ begin
147
+ socket.connect_nonblock(address)
148
+ rescue Errno::EINPROGRESS
149
+ wait_for_writtable_socket(socket, address, timeout)
150
+ rescue # Connection failed somehow, again
151
+ false
152
+ end
153
+ end
154
+ end
155
+
156
+ private
157
+
158
+ def wait_for_writtable_socket(socket, address, timeout)
159
+ if IO.select(nil, [socket], nil, timeout)
160
+ probe_writtable_socket(socket, address)
161
+ else # TCP Handshake timed out, or there is something dropping packets
162
+ false
163
+ end
164
+ end
165
+
166
+ def probe_writtable_socket(socket, address)
167
+ socket.connect_nonblock(address)
168
+ rescue Errno::EISCONN
169
+ true
170
+ rescue # Connection failed
171
+ false
172
+ end
173
+ end
174
+ end
175
+
176
+ # Class used to build the list of sockets that correspond to
177
+ # a given mirror.
178
+ #
179
+ # One mirror may correspond to many different addresses, both
180
+ # because of it having many dns entries or because
181
+ # the network interface is both ipv4 and ipv5
182
+ class MirrorSockets
183
+ def initialize(mirror)
184
+ @timeout = mirror.fallback_timeout
185
+ @addresses = Socket.getaddrinfo(mirror.uri.host, mirror.uri.port).map do |address|
186
+ SocketAddress.new(address[0], address[3], address[1])
187
+ end
188
+ end
189
+
190
+ def any?
191
+ @addresses.any? do |address|
192
+ socket = Socket.new(Socket.const_get(address.type), Socket::SOCK_STREAM, 0)
193
+ socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
194
+ value = yield socket, address.to_socket_address, @timeout
195
+ socket.close unless socket.closed?
196
+ value
197
+ end
198
+ end
199
+ end
200
+
201
+ # Socket address builder.
202
+ #
203
+ # Given a socket type, a host and a port,
204
+ # provides a method to build sockaddr string
205
+ class SocketAddress
206
+ attr_reader :type, :host, :port
207
+
208
+ def initialize(type, host, port)
209
+ @type = type
210
+ @host = host
211
+ @port = port
212
+ end
213
+
214
+ def to_socket_address
215
+ Socket.pack_sockaddr_in(@port, @host)
216
+ end
217
+ end
218
+ end