rubygems-update 2.6.3 → 2.7.7

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 (462) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +17 -34
  3. data/CODE_OF_CONDUCT.md +36 -33
  4. data/CONTRIBUTING.rdoc +56 -55
  5. data/History.txt +467 -10
  6. data/Manifest.txt +276 -4
  7. data/POLICIES.rdoc +4 -4
  8. data/README.md +72 -0
  9. data/Rakefile +77 -10
  10. data/appveyor.yml +61 -31
  11. data/bin/gem +1 -1
  12. data/bin/update_rubygems +2 -2
  13. data/bundler/CHANGELOG.md +2910 -0
  14. data/bundler/CODE_OF_CONDUCT.md +42 -0
  15. data/bundler/CONTRIBUTING.md +17 -0
  16. data/bundler/LICENSE.md +23 -0
  17. data/bundler/README.md +63 -0
  18. data/bundler/bundler.gemspec +57 -0
  19. data/bundler/exe/bundle +31 -0
  20. data/bundler/exe/bundle_ruby +60 -0
  21. data/bundler/exe/bundler +4 -0
  22. data/bundler/lib/bundler/build_metadata.rb +36 -0
  23. data/bundler/lib/bundler/capistrano.rb +22 -0
  24. data/bundler/lib/bundler/cli/add.rb +25 -0
  25. data/bundler/lib/bundler/cli/binstubs.rb +43 -0
  26. data/bundler/lib/bundler/cli/cache.rb +36 -0
  27. data/bundler/lib/bundler/cli/check.rb +38 -0
  28. data/bundler/lib/bundler/cli/clean.rb +25 -0
  29. data/bundler/lib/bundler/cli/common.rb +102 -0
  30. data/bundler/lib/bundler/cli/config.rb +119 -0
  31. data/bundler/lib/bundler/cli/console.rb +43 -0
  32. data/bundler/lib/bundler/cli/doctor.rb +94 -0
  33. data/bundler/lib/bundler/cli/exec.rb +104 -0
  34. data/bundler/lib/bundler/cli/gem.rb +252 -0
  35. data/bundler/lib/bundler/cli/info.rb +50 -0
  36. data/bundler/lib/bundler/cli/init.rb +47 -0
  37. data/bundler/lib/bundler/cli/inject.rb +60 -0
  38. data/bundler/lib/bundler/cli/install.rb +214 -0
  39. data/bundler/lib/bundler/cli/issue.rb +40 -0
  40. data/bundler/lib/bundler/cli/list.rb +22 -0
  41. data/bundler/lib/bundler/cli/lock.rb +63 -0
  42. data/bundler/lib/bundler/cli/open.rb +26 -0
  43. data/bundler/lib/bundler/cli/outdated.rb +260 -0
  44. data/bundler/lib/bundler/cli/package.rb +49 -0
  45. data/bundler/lib/bundler/cli/platform.rb +46 -0
  46. data/bundler/lib/bundler/cli/plugin.rb +24 -0
  47. data/bundler/lib/bundler/cli/pristine.rb +43 -0
  48. data/bundler/lib/bundler/cli/show.rb +75 -0
  49. data/bundler/lib/bundler/cli/update.rb +91 -0
  50. data/bundler/lib/bundler/cli/viz.rb +31 -0
  51. data/bundler/lib/bundler/cli.rb +748 -0
  52. data/bundler/lib/bundler/compact_index_client/cache.rb +118 -0
  53. data/bundler/lib/bundler/compact_index_client/updater.rb +116 -0
  54. data/bundler/lib/bundler/compact_index_client.rb +109 -0
  55. data/bundler/lib/bundler/compatibility_guard.rb +14 -0
  56. data/bundler/lib/bundler/constants.rb +7 -0
  57. data/bundler/lib/bundler/current_ruby.rb +86 -0
  58. data/bundler/lib/bundler/definition.rb +989 -0
  59. data/bundler/lib/bundler/dep_proxy.rb +48 -0
  60. data/bundler/lib/bundler/dependency.rb +138 -0
  61. data/bundler/lib/bundler/deployment.rb +69 -0
  62. data/bundler/lib/bundler/deprecate.rb +43 -0
  63. data/bundler/lib/bundler/dsl.rb +599 -0
  64. data/bundler/lib/bundler/endpoint_specification.rb +141 -0
  65. data/bundler/lib/bundler/env.rb +153 -0
  66. data/bundler/lib/bundler/environment_preserver.rb +59 -0
  67. data/bundler/lib/bundler/errors.rb +158 -0
  68. data/bundler/lib/bundler/feature_flag.rb +67 -0
  69. data/bundler/lib/bundler/fetcher/base.rb +52 -0
  70. data/bundler/lib/bundler/fetcher/compact_index.rb +126 -0
  71. data/bundler/lib/bundler/fetcher/dependency.rb +82 -0
  72. data/bundler/lib/bundler/fetcher/downloader.rb +79 -0
  73. data/bundler/lib/bundler/fetcher/index.rb +52 -0
  74. data/bundler/lib/bundler/fetcher.rb +312 -0
  75. data/bundler/lib/bundler/friendly_errors.rb +131 -0
  76. data/bundler/lib/bundler/gem_helper.rb +202 -0
  77. data/bundler/lib/bundler/gem_helpers.rb +101 -0
  78. data/bundler/lib/bundler/gem_remote_fetcher.rb +43 -0
  79. data/bundler/lib/bundler/gem_tasks.rb +7 -0
  80. data/bundler/lib/bundler/gem_version_promoter.rb +176 -0
  81. data/bundler/lib/bundler/gemdeps.rb +29 -0
  82. data/bundler/lib/bundler/graph.rb +152 -0
  83. data/bundler/lib/bundler/index.rb +213 -0
  84. data/bundler/lib/bundler/injector.rb +94 -0
  85. data/bundler/lib/bundler/inline.rb +74 -0
  86. data/bundler/lib/bundler/installer/gem_installer.rb +83 -0
  87. data/bundler/lib/bundler/installer/parallel_installer.rb +228 -0
  88. data/bundler/lib/bundler/installer/standalone.rb +53 -0
  89. data/bundler/lib/bundler/installer.rb +295 -0
  90. data/bundler/lib/bundler/lazy_specification.rb +123 -0
  91. data/bundler/lib/bundler/lockfile_generator.rb +95 -0
  92. data/bundler/lib/bundler/lockfile_parser.rb +256 -0
  93. data/bundler/lib/bundler/match_platform.rb +24 -0
  94. data/bundler/lib/bundler/mirror.rb +223 -0
  95. data/bundler/lib/bundler/plugin/api/source.rb +306 -0
  96. data/bundler/lib/bundler/plugin/api.rb +81 -0
  97. data/bundler/lib/bundler/plugin/dsl.rb +53 -0
  98. data/bundler/lib/bundler/plugin/index.rb +162 -0
  99. data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
  100. data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
  101. data/bundler/lib/bundler/plugin/installer.rb +96 -0
  102. data/bundler/lib/bundler/plugin/source_list.rb +27 -0
  103. data/bundler/lib/bundler/plugin.rb +285 -0
  104. data/bundler/lib/bundler/process_lock.rb +24 -0
  105. data/bundler/lib/bundler/psyched_yaml.rb +37 -0
  106. data/bundler/lib/bundler/remote_specification.rb +114 -0
  107. data/bundler/lib/bundler/resolver/spec_group.rb +110 -0
  108. data/bundler/lib/bundler/resolver.rb +372 -0
  109. data/bundler/lib/bundler/retry.rb +66 -0
  110. data/bundler/lib/bundler/ruby_dsl.rb +18 -0
  111. data/bundler/lib/bundler/ruby_version.rb +152 -0
  112. data/bundler/lib/bundler/rubygems_ext.rb +210 -0
  113. data/bundler/lib/bundler/rubygems_gem_installer.rb +99 -0
  114. data/bundler/lib/bundler/rubygems_integration.rb +898 -0
  115. data/bundler/lib/bundler/runtime.rb +316 -0
  116. data/bundler/lib/bundler/settings/validator.rb +79 -0
  117. data/bundler/lib/bundler/settings.rb +442 -0
  118. data/bundler/lib/bundler/setup.rb +28 -0
  119. data/bundler/lib/bundler/shared_helpers.rb +356 -0
  120. data/bundler/lib/bundler/similarity_detector.rb +63 -0
  121. data/bundler/lib/bundler/source/gemspec.rb +18 -0
  122. data/bundler/lib/bundler/source/git/git_proxy.rb +262 -0
  123. data/bundler/lib/bundler/source/git.rb +329 -0
  124. data/bundler/lib/bundler/source/metadata.rb +63 -0
  125. data/bundler/lib/bundler/source/path/installer.rb +74 -0
  126. data/bundler/lib/bundler/source/path.rb +249 -0
  127. data/bundler/lib/bundler/source/rubygems/remote.rb +66 -0
  128. data/bundler/lib/bundler/source/rubygems.rb +535 -0
  129. data/bundler/lib/bundler/source.rb +94 -0
  130. data/bundler/lib/bundler/source_list.rb +186 -0
  131. data/bundler/lib/bundler/spec_set.rb +192 -0
  132. data/bundler/lib/bundler/ssl_certs/.document +1 -0
  133. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +66 -0
  134. data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  135. data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  136. data/bundler/lib/bundler/stub_specification.rb +108 -0
  137. data/bundler/lib/bundler/templates/.document +1 -0
  138. data/bundler/lib/bundler/templates/Executable +29 -0
  139. data/bundler/lib/bundler/templates/Executable.bundler +105 -0
  140. data/bundler/lib/bundler/templates/Executable.standalone +14 -0
  141. data/bundler/lib/bundler/templates/Gemfile +7 -0
  142. data/bundler/lib/bundler/templates/gems.rb +8 -0
  143. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
  144. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +6 -0
  145. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  146. data/bundler/lib/bundler/templates/newgem/README.md.tt +47 -0
  147. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
  148. data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
  149. data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  150. data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  151. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  152. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  153. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  154. data/bundler/lib/bundler/templates/newgem/gitignore.tt +20 -0
  155. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  156. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  157. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +51 -0
  158. data/bundler/lib/bundler/templates/newgem/rspec.tt +3 -0
  159. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
  160. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +14 -0
  161. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
  162. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
  163. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +5 -0
  164. data/bundler/lib/bundler/ui/rg_proxy.rb +19 -0
  165. data/bundler/lib/bundler/ui/shell.rb +146 -0
  166. data/bundler/lib/bundler/ui/silent.rb +69 -0
  167. data/bundler/lib/bundler/ui.rb +9 -0
  168. data/bundler/lib/bundler/uri_credentials_filter.rb +37 -0
  169. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  170. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  171. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  172. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +81 -0
  173. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
  174. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
  175. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
  176. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
  177. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
  178. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
  179. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
  180. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
  181. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +126 -0
  182. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +223 -0
  183. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +138 -0
  184. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  185. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +101 -0
  186. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +67 -0
  187. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +837 -0
  188. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +46 -0
  189. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +58 -0
  190. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +12 -0
  191. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +27 -0
  192. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +129 -0
  193. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1233 -0
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +104 -0
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +60 -0
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +364 -0
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +109 -0
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +321 -0
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +679 -0
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +135 -0
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +97 -0
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
  206. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
  207. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  208. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +177 -0
  209. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
  210. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  211. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  212. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +70 -0
  213. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  214. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +146 -0
  215. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +221 -0
  216. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  217. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
  218. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +324 -0
  219. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +437 -0
  220. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
  221. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
  222. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  223. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +268 -0
  224. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  225. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +509 -0
  226. data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
  227. data/bundler/lib/bundler/vendored_molinillo.rb +4 -0
  228. data/bundler/lib/bundler/vendored_persistent.rb +52 -0
  229. data/bundler/lib/bundler/vendored_thor.rb +8 -0
  230. data/bundler/lib/bundler/version.rb +28 -0
  231. data/bundler/lib/bundler/version_ranges.rb +76 -0
  232. data/bundler/lib/bundler/vlad.rb +17 -0
  233. data/bundler/lib/bundler/worker.rb +106 -0
  234. data/bundler/lib/bundler/yaml_serializer.rb +90 -0
  235. data/bundler/lib/bundler.rb +545 -0
  236. data/bundler/man/bundle-add.ronn +29 -0
  237. data/bundler/man/bundle-binstubs.ronn +43 -0
  238. data/bundler/man/bundle-check.ronn +26 -0
  239. data/bundler/man/bundle-clean.ronn +18 -0
  240. data/bundler/man/bundle-config.ronn +376 -0
  241. data/bundler/man/bundle-doctor.ronn +33 -0
  242. data/bundler/man/bundle-exec.ronn +152 -0
  243. data/bundler/man/bundle-gem.ronn +78 -0
  244. data/bundler/man/bundle-info.ronn +17 -0
  245. data/bundler/man/bundle-init.ronn +29 -0
  246. data/bundler/man/bundle-inject.ronn +22 -0
  247. data/bundler/man/bundle-install.ronn +369 -0
  248. data/bundler/man/bundle-list.ronn +15 -0
  249. data/bundler/man/bundle-lock.ronn +94 -0
  250. data/bundler/man/bundle-open.ronn +19 -0
  251. data/bundler/man/bundle-outdated.ronn +107 -0
  252. data/bundler/man/bundle-package.ronn +72 -0
  253. data/bundler/man/bundle-platform.ronn +42 -0
  254. data/bundler/man/bundle-pristine.ronn +34 -0
  255. data/bundler/man/bundle-show.ronn +20 -0
  256. data/bundler/man/bundle-update.ronn +346 -0
  257. data/bundler/man/bundle-viz.ronn +30 -0
  258. data/bundler/man/bundle.ronn +108 -0
  259. data/bundler/man/gemfile.5.ronn +506 -0
  260. data/lib/rubygems/basic_specification.rb +8 -4
  261. data/lib/rubygems/bundler_version_finder.rb +116 -0
  262. data/lib/rubygems/command.rb +10 -2
  263. data/lib/rubygems/command_manager.rb +3 -1
  264. data/lib/rubygems/commands/cert_command.rb +31 -6
  265. data/lib/rubygems/commands/cleanup_command.rb +10 -3
  266. data/lib/rubygems/commands/generate_index_command.rb +1 -1
  267. data/lib/rubygems/commands/help_command.rb +1 -1
  268. data/lib/rubygems/commands/open_command.rb +1 -1
  269. data/lib/rubygems/commands/owner_command.rb +4 -2
  270. data/lib/rubygems/commands/pristine_command.rb +11 -8
  271. data/lib/rubygems/commands/push_command.rb +3 -2
  272. data/lib/rubygems/commands/query_command.rb +17 -17
  273. data/lib/rubygems/commands/setup_command.rb +175 -70
  274. data/lib/rubygems/commands/signin_command.rb +33 -0
  275. data/lib/rubygems/commands/signout_command.rb +33 -0
  276. data/lib/rubygems/commands/sources_command.rb +1 -1
  277. data/lib/rubygems/commands/uninstall_command.rb +4 -3
  278. data/lib/rubygems/commands/unpack_command.rb +19 -7
  279. data/lib/rubygems/commands/update_command.rb +2 -2
  280. data/lib/rubygems/commands/which_command.rb +1 -1
  281. data/lib/rubygems/commands/yank_command.rb +4 -11
  282. data/lib/rubygems/config_file.rb +21 -28
  283. data/lib/rubygems/core_ext/kernel_require.rb +10 -9
  284. data/lib/rubygems/defaults.rb +18 -0
  285. data/lib/rubygems/dependency.rb +10 -4
  286. data/lib/rubygems/dependency_installer.rb +8 -2
  287. data/lib/rubygems/dependency_list.rb +1 -1
  288. data/lib/rubygems/errors.rb +4 -0
  289. data/lib/rubygems/exceptions.rb +11 -1
  290. data/lib/rubygems/ext/builder.rb +2 -2
  291. data/lib/rubygems/ext/ext_conf_builder.rb +7 -7
  292. data/lib/rubygems/ext/rake_builder.rb +2 -2
  293. data/lib/rubygems/gem_runner.rb +5 -1
  294. data/lib/rubygems/indexer.rb +6 -5
  295. data/lib/rubygems/install_update_options.rb +5 -28
  296. data/lib/rubygems/installer.rb +53 -22
  297. data/lib/rubygems/installer_test_case.rb +6 -3
  298. data/lib/rubygems/package/file_source.rb +2 -2
  299. data/lib/rubygems/package/old.rb +3 -3
  300. data/lib/rubygems/package/tar_header.rb +14 -9
  301. data/lib/rubygems/package/tar_writer.rb +12 -16
  302. data/lib/rubygems/package.rb +48 -9
  303. data/lib/rubygems/platform.rb +1 -1
  304. data/lib/rubygems/remote_fetcher.rb +13 -18
  305. data/lib/rubygems/request.rb +47 -1
  306. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  307. data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
  308. data/lib/rubygems/request_set/lockfile.rb +1 -1
  309. data/lib/rubygems/request_set.rb +22 -3
  310. data/lib/rubygems/requirement.rb +5 -1
  311. data/lib/rubygems/resolver/installer_set.rb +4 -6
  312. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  313. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  314. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  315. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +65 -0
  316. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  317. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  318. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +60 -0
  319. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +125 -0
  320. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  321. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  322. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +125 -0
  323. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +78 -147
  324. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
  325. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  326. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +1 -1
  327. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +110 -75
  328. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
  329. data/lib/rubygems/resolver/set.rb +1 -1
  330. data/lib/rubygems/resolver.rb +61 -5
  331. data/lib/rubygems/safe_yaml.rb +51 -0
  332. data/lib/rubygems/security/signer.rb +2 -0
  333. data/lib/rubygems/security/trust_dir.rb +1 -1
  334. data/lib/rubygems/security.rb +12 -5
  335. data/lib/rubygems/security_option.rb +43 -0
  336. data/lib/rubygems/server.rb +49 -40
  337. data/lib/rubygems/source/git.rb +2 -1
  338. data/lib/rubygems/source/local.rb +38 -35
  339. data/lib/rubygems/source/lock.rb +4 -1
  340. data/lib/rubygems/source.rb +9 -6
  341. data/lib/rubygems/source_local.rb +3 -1
  342. data/lib/rubygems/source_specific_file.rb +3 -2
  343. data/lib/rubygems/spec_fetcher.rb +7 -3
  344. data/lib/rubygems/specification.rb +317 -251
  345. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  346. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  347. data/lib/rubygems/stub_specification.rb +10 -4
  348. data/lib/rubygems/test_case.rb +51 -11
  349. data/lib/rubygems/test_utilities.rb +2 -2
  350. data/lib/rubygems/text.rb +14 -1
  351. data/lib/rubygems/user_interaction.rb +22 -20
  352. data/lib/rubygems/util/licenses.rb +37 -0
  353. data/lib/rubygems/util.rb +6 -16
  354. data/lib/rubygems/validator.rb +3 -3
  355. data/lib/rubygems/version.rb +24 -5
  356. data/lib/rubygems/version_option.rb +6 -1
  357. data/lib/rubygems.rb +147 -45
  358. data/lib/ubygems.rb +3 -0
  359. data/setup.rb +1 -1
  360. data/test/rubygems/alternate_cert.pem +10 -9
  361. data/test/rubygems/alternate_cert_32.pem +10 -9
  362. data/test/rubygems/child_cert.pem +11 -9
  363. data/test/rubygems/child_cert_32.pem +11 -9
  364. data/test/rubygems/encrypted_private_key.pem +26 -26
  365. data/test/rubygems/expired_cert.pem +9 -8
  366. data/test/rubygems/future_cert.pem +9 -8
  367. data/test/rubygems/future_cert_32.pem +9 -8
  368. data/test/rubygems/grandchild_cert.pem +11 -9
  369. data/test/rubygems/grandchild_cert_32.pem +11 -9
  370. data/test/rubygems/invalid_issuer_cert.pem +11 -9
  371. data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
  372. data/test/rubygems/invalid_signer_cert.pem +10 -9
  373. data/test/rubygems/invalid_signer_cert_32.pem +10 -9
  374. data/test/rubygems/invalidchild_cert.pem +11 -9
  375. data/test/rubygems/invalidchild_cert_32.pem +11 -9
  376. data/test/rubygems/private3072_key.pem +40 -0
  377. data/test/rubygems/public3072_cert.pem +25 -0
  378. data/test/rubygems/public_cert.pem +11 -9
  379. data/test/rubygems/public_cert_32.pem +10 -9
  380. data/test/rubygems/rubygems_plugin.rb +4 -0
  381. data/test/rubygems/test_bundled_ca.rb +1 -1
  382. data/test/rubygems/test_config.rb +1 -1
  383. data/test/rubygems/test_gem.rb +168 -55
  384. data/test/rubygems/test_gem_bundler_version_finder.rb +125 -0
  385. data/test/rubygems/test_gem_command.rb +7 -1
  386. data/test/rubygems/test_gem_commands_build_command.rb +27 -1
  387. data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
  388. data/test/rubygems/test_gem_commands_cleanup_command.rb +44 -1
  389. data/test/rubygems/test_gem_commands_install_command.rb +36 -2
  390. data/test/rubygems/test_gem_commands_open_command.rb +2 -1
  391. data/test/rubygems/test_gem_commands_owner_command.rb +25 -0
  392. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  393. data/test/rubygems/test_gem_commands_push_command.rb +5 -5
  394. data/test/rubygems/test_gem_commands_query_command.rb +154 -1
  395. data/test/rubygems/test_gem_commands_setup_command.rb +140 -10
  396. data/test/rubygems/test_gem_commands_signin_command.rb +98 -0
  397. data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
  398. data/test/rubygems/test_gem_commands_sources_command.rb +52 -0
  399. data/test/rubygems/test_gem_commands_uninstall_command.rb +14 -2
  400. data/test/rubygems/test_gem_commands_update_command.rb +1 -7
  401. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  402. data/test/rubygems/test_gem_config_file.rb +1 -2
  403. data/test/rubygems/test_gem_dependency.rb +28 -0
  404. data/test/rubygems/test_gem_dependency_installer.rb +1 -1
  405. data/test/rubygems/test_gem_doctor.rb +2 -2
  406. data/test/rubygems/test_gem_ext_builder.rb +8 -8
  407. data/test/rubygems/test_gem_ext_configure_builder.rb +1 -1
  408. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +23 -0
  409. data/test/rubygems/test_gem_ext_rake_builder.rb +33 -16
  410. data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
  411. data/test/rubygems/test_gem_indexer.rb +1 -2
  412. data/test/rubygems/test_gem_install_update_options.rb +4 -1
  413. data/test/rubygems/test_gem_installer.rb +230 -32
  414. data/test/rubygems/test_gem_package.rb +156 -29
  415. data/test/rubygems/test_gem_package_old.rb +1 -1
  416. data/test/rubygems/test_gem_package_tar_header.rb +21 -0
  417. data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
  418. data/test/rubygems/test_gem_rdoc.rb +2 -0
  419. data/test/rubygems/test_gem_remote_fetcher.rb +38 -19
  420. data/test/rubygems/test_gem_request.rb +132 -0
  421. data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
  422. data/test/rubygems/test_gem_request_set.rb +7 -7
  423. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  424. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
  425. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  426. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  427. data/test/rubygems/test_gem_requirement.rb +6 -0
  428. data/test/rubygems/test_gem_resolver.rb +29 -3
  429. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  430. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
  431. data/test/rubygems/test_gem_security.rb +5 -0
  432. data/test/rubygems/test_gem_security_policy.rb +27 -27
  433. data/test/rubygems/test_gem_security_signer.rb +14 -6
  434. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  435. data/test/rubygems/test_gem_server.rb +210 -12
  436. data/test/rubygems/test_gem_source.rb +12 -3
  437. data/test/rubygems/test_gem_source_fetch_problem.rb +8 -0
  438. data/test/rubygems/test_gem_source_git.rb +1 -1
  439. data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
  440. data/test/rubygems/test_gem_specification.rb +163 -32
  441. data/test/rubygems/test_gem_stream_ui.rb +6 -6
  442. data/test/rubygems/test_gem_stub_specification.rb +85 -6
  443. data/test/rubygems/test_gem_text.rb +11 -0
  444. data/test/rubygems/test_gem_util.rb +26 -0
  445. data/test/rubygems/test_gem_version.rb +46 -7
  446. data/test/rubygems/test_gem_version_option.rb +15 -0
  447. data/test/rubygems/test_kernel.rb +30 -0
  448. data/test/rubygems/test_remote_fetch_error.rb +21 -0
  449. data/test/rubygems/test_require.rb +95 -21
  450. data/test/rubygems/wrong_key_cert.pem +10 -9
  451. data/test/rubygems/wrong_key_cert_32.pem +10 -9
  452. data/util/ci +74 -0
  453. data/util/create_certs.rb +64 -49
  454. data/util/generate_spdx_license_list.rb +2 -1
  455. data/util/patch_with_prs.rb +77 -0
  456. data/util/update_bundled_ca_certificates.rb +23 -2
  457. data/util/update_changelog.rb +67 -0
  458. metadata +301 -48
  459. data/README.rdoc +0 -54
  460. data/lib/gauntlet_rubygems.rb +0 -51
  461. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
  462. /data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
@@ -0,0 +1,356 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/compatibility_guard"
4
+
5
+ require "pathname"
6
+ require "rubygems"
7
+
8
+ require "bundler/version"
9
+ require "bundler/constants"
10
+ require "bundler/rubygems_integration"
11
+ require "bundler/current_ruby"
12
+
13
+ module Gem
14
+ class Dependency
15
+ # This is only needed for RubyGems < 1.4
16
+ unless method_defined? :requirement
17
+ def requirement
18
+ version_requirements
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ module Bundler
25
+ module SharedHelpers
26
+ def root
27
+ gemfile = find_gemfile
28
+ raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
29
+ Pathname.new(gemfile).untaint.expand_path.parent
30
+ end
31
+
32
+ def default_gemfile
33
+ gemfile = find_gemfile(:order_matters)
34
+ raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
35
+ Pathname.new(gemfile).untaint.expand_path
36
+ end
37
+
38
+ def default_lockfile
39
+ gemfile = default_gemfile
40
+
41
+ case gemfile.basename.to_s
42
+ when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
43
+ else Pathname.new("#{gemfile}.lock")
44
+ end.untaint
45
+ end
46
+
47
+ def default_bundle_dir
48
+ bundle_dir = find_directory(".bundle")
49
+ return nil unless bundle_dir
50
+
51
+ bundle_dir = Pathname.new(bundle_dir)
52
+
53
+ global_bundle_dir = Bundler.user_home.join(".bundle")
54
+ return nil if bundle_dir == global_bundle_dir
55
+
56
+ bundle_dir
57
+ end
58
+
59
+ def in_bundle?
60
+ find_gemfile
61
+ end
62
+
63
+ def chdir(dir, &blk)
64
+ Bundler.rubygems.ext_lock.synchronize do
65
+ Dir.chdir dir, &blk
66
+ end
67
+ end
68
+
69
+ def pwd
70
+ Bundler.rubygems.ext_lock.synchronize do
71
+ Pathname.pwd
72
+ end
73
+ end
74
+
75
+ def with_clean_git_env(&block)
76
+ keys = %w[GIT_DIR GIT_WORK_TREE]
77
+ old_env = keys.inject({}) do |h, k|
78
+ h.update(k => ENV[k])
79
+ end
80
+
81
+ keys.each {|key| ENV.delete(key) }
82
+
83
+ block.call
84
+ ensure
85
+ keys.each {|key| ENV[key] = old_env[key] }
86
+ end
87
+
88
+ def set_bundle_environment
89
+ set_bundle_variables
90
+ set_path
91
+ set_rubyopt
92
+ set_rubylib
93
+ end
94
+
95
+ # Rescues permissions errors raised by file system operations
96
+ # (ie. Errno:EACCESS, Errno::EAGAIN) and raises more friendly errors instead.
97
+ #
98
+ # @param path [String] the path that the action will be attempted to
99
+ # @param action [Symbol, #to_s] the type of operation that will be
100
+ # performed. For example: :write, :read, :exec
101
+ #
102
+ # @yield path
103
+ #
104
+ # @raise [Bundler::PermissionError] if Errno:EACCES is raised in the
105
+ # given block
106
+ # @raise [Bundler::TemporaryResourceError] if Errno:EAGAIN is raised in the
107
+ # given block
108
+ #
109
+ # @example
110
+ # filesystem_access("vendor/cache", :write) do
111
+ # FileUtils.mkdir_p("vendor/cache")
112
+ # end
113
+ #
114
+ # @see {Bundler::PermissionError}
115
+ def filesystem_access(path, action = :write, &block)
116
+ # Use block.call instead of yield because of a bug in Ruby 2.2.2
117
+ # See https://github.com/bundler/bundler/issues/5341 for details
118
+ block.call(path.dup.untaint)
119
+ rescue Errno::EACCES
120
+ raise PermissionError.new(path, action)
121
+ rescue Errno::EAGAIN
122
+ raise TemporaryResourceError.new(path, action)
123
+ rescue Errno::EPROTO
124
+ raise VirtualProtocolError.new
125
+ rescue Errno::ENOSPC
126
+ raise NoSpaceOnDeviceError.new(path, action)
127
+ rescue *[const_get_safely(:ENOTSUP, Errno)].compact
128
+ raise OperationNotSupportedError.new(path, action)
129
+ rescue Errno::EEXIST, Errno::ENOENT
130
+ raise
131
+ rescue SystemCallError => e
132
+ raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
133
+ end
134
+
135
+ def const_get_safely(constant_name, namespace)
136
+ const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
137
+ namespace.constants.include?(constant_name.to_sym)
138
+ return nil unless const_in_namespace
139
+ namespace.const_get(constant_name)
140
+ end
141
+
142
+ def major_deprecation(major_version, message)
143
+ if Bundler.bundler_major_version >= major_version
144
+ require "bundler/errors"
145
+ raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
146
+ end
147
+
148
+ return unless prints_major_deprecations?
149
+ @major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
150
+ ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
151
+ ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
152
+ end
153
+
154
+ def print_major_deprecations!
155
+ multiple_gemfiles = search_up(".") do |dir|
156
+ gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
157
+ next if gemfiles.empty?
158
+ break false if gemfiles.size == 1
159
+ end
160
+ if multiple_gemfiles && Bundler.bundler_major_version == 1
161
+ Bundler::SharedHelpers.major_deprecation 2, \
162
+ "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
163
+ end
164
+
165
+ if RUBY_VERSION < "2"
166
+ major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
167
+ end
168
+ return if Bundler.rubygems.provides?(">= 2")
169
+ major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
170
+ end
171
+
172
+ def trap(signal, override = false, &block)
173
+ prior = Signal.trap(signal) do
174
+ block.call
175
+ prior.call unless override
176
+ end
177
+ end
178
+
179
+ def ensure_same_dependencies(spec, old_deps, new_deps)
180
+ new_deps = new_deps.reject {|d| d.type == :development }
181
+ old_deps = old_deps.reject {|d| d.type == :development }
182
+
183
+ without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
184
+ new_deps.map!(&without_type)
185
+ old_deps.map!(&without_type)
186
+
187
+ extra_deps = new_deps - old_deps
188
+ return if extra_deps.empty?
189
+
190
+ Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has either corrupted API or lockfile dependencies" \
191
+ " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
192
+ raise APIResponseMismatchError,
193
+ "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
194
+ "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
195
+ end
196
+
197
+ def pretty_dependency(dep, print_source = false)
198
+ msg = String.new(dep.name)
199
+ msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
200
+ if dep.is_a?(Bundler::Dependency)
201
+ platform_string = dep.platforms.join(", ")
202
+ msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
203
+ end
204
+ msg << " from the `#{dep.source}` source" if print_source && dep.source
205
+ msg
206
+ end
207
+
208
+ def md5_available?
209
+ return @md5_available if defined?(@md5_available)
210
+ @md5_available = begin
211
+ require "openssl"
212
+ OpenSSL::Digest::MD5.digest("")
213
+ true
214
+ rescue LoadError
215
+ true
216
+ rescue OpenSSL::Digest::DigestError
217
+ false
218
+ end
219
+ end
220
+
221
+ def digest(name)
222
+ require "digest"
223
+ Digest(name)
224
+ end
225
+
226
+ private
227
+
228
+ def validate_bundle_path
229
+ path_separator = Bundler.rubygems.path_separator
230
+ return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
231
+ message = "Your bundle path contains text matching #{path_separator.inspect}, " \
232
+ "which is the path separator for your system. Bundler cannot " \
233
+ "function correctly when the Bundle path contains the " \
234
+ "system's PATH separator. Please change your " \
235
+ "bundle path to not match #{path_separator.inspect}." \
236
+ "\nYour current bundle path is '#{Bundler.bundle_path}'."
237
+ raise Bundler::PathError, message
238
+ end
239
+
240
+ def find_gemfile(order_matters = false)
241
+ given = ENV["BUNDLE_GEMFILE"]
242
+ return given if given && !given.empty?
243
+ names = gemfile_names
244
+ names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
245
+ find_file(*names)
246
+ end
247
+
248
+ def gemfile_names
249
+ ["Gemfile", "gems.rb"]
250
+ end
251
+
252
+ def find_file(*names)
253
+ search_up(*names) do |filename|
254
+ return filename if File.file?(filename)
255
+ end
256
+ end
257
+
258
+ def find_directory(*names)
259
+ search_up(*names) do |dirname|
260
+ return dirname if File.directory?(dirname)
261
+ end
262
+ end
263
+
264
+ def search_up(*names)
265
+ previous = nil
266
+ current = File.expand_path(SharedHelpers.pwd).untaint
267
+
268
+ until !File.directory?(current) || current == previous
269
+ if ENV["BUNDLE_SPEC_RUN"]
270
+ # avoid stepping above the tmp directory when testing
271
+ return nil if File.file?(File.join(current, "bundler.gemspec"))
272
+ end
273
+
274
+ names.each do |name|
275
+ filename = File.join(current, name)
276
+ yield filename
277
+ end
278
+ previous = current
279
+ current = File.expand_path("..", current)
280
+ end
281
+ end
282
+
283
+ def set_env(key, value)
284
+ raise ArgumentError, "new key #{key}" unless EnvironmentPreserver::BUNDLER_KEYS.include?(key)
285
+ orig_key = "#{EnvironmentPreserver::BUNDLER_PREFIX}#{key}"
286
+ orig = ENV[key]
287
+ orig ||= EnvironmentPreserver::INTENTIONALLY_NIL
288
+ ENV[orig_key] ||= orig
289
+
290
+ ENV[key] = value
291
+ end
292
+ public :set_env
293
+
294
+ def set_bundle_variables
295
+ begin
296
+ Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
297
+ rescue Gem::GemNotFoundException
298
+ Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__)
299
+ end
300
+
301
+ # Set BUNDLE_GEMFILE
302
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile(:order_matters).to_s
303
+ Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
304
+ end
305
+
306
+ def set_path
307
+ validate_bundle_path
308
+ paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
309
+ paths.unshift "#{Bundler.bundle_path}/bin"
310
+ Bundler::SharedHelpers.set_env "PATH", paths.uniq.join(File::PATH_SEPARATOR)
311
+ end
312
+
313
+ def set_rubyopt
314
+ rubyopt = [ENV["RUBYOPT"]].compact
315
+ return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
316
+ rubyopt.unshift %(-rbundler/setup)
317
+ Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
318
+ end
319
+
320
+ def set_rubylib
321
+ rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
322
+ rubylib.unshift bundler_ruby_lib
323
+ Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
324
+ end
325
+
326
+ def bundler_ruby_lib
327
+ File.expand_path("../..", __FILE__)
328
+ end
329
+
330
+ def clean_load_path
331
+ # handle 1.9 where system gems are always on the load path
332
+ return unless defined?(::Gem)
333
+
334
+ bundler_lib = bundler_ruby_lib
335
+
336
+ loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
337
+
338
+ $LOAD_PATH.reject! do |p|
339
+ next if File.expand_path(p).start_with?(bundler_lib)
340
+ loaded_gem_paths.delete(p)
341
+ end
342
+ $LOAD_PATH.uniq!
343
+ end
344
+
345
+ def prints_major_deprecations?
346
+ require "bundler"
347
+ deprecation_release = Bundler::VERSION.split(".").drop(1).include?("99")
348
+ return false if !deprecation_release && !Bundler.settings[:major_deprecations]
349
+ require "bundler/deprecate"
350
+ return false if Bundler::Deprecate.skip
351
+ true
352
+ end
353
+
354
+ extend self
355
+ end
356
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class SimilarityDetector
5
+ SimilarityScore = Struct.new(:string, :distance)
6
+
7
+ # initialize with an array of words to be matched against
8
+ def initialize(corpus)
9
+ @corpus = corpus
10
+ end
11
+
12
+ # return an array of words similar to 'word' from the corpus
13
+ def similar_words(word, limit = 3)
14
+ words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) }
15
+ words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string)
16
+ end
17
+
18
+ # return the result of 'similar_words', concatenated into a list
19
+ # (eg "a, b, or c")
20
+ def similar_word_list(word, limit = 3)
21
+ words = similar_words(word, limit)
22
+ if words.length == 1
23
+ words[0]
24
+ elsif words.length > 1
25
+ [words[0..-2].join(", "), words[-1]].join(" or ")
26
+ end
27
+ end
28
+
29
+ protected
30
+
31
+ # http://www.informit.com/articles/article.aspx?p=683059&seqNum=36
32
+ def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
33
+ # ins, del, sub are weighted costs
34
+ return nil if this.nil?
35
+ return nil if that.nil?
36
+ dm = [] # distance matrix
37
+
38
+ # Initialize first row values
39
+ dm[0] = (0..this.length).collect {|i| i * ins }
40
+ fill = [0] * (this.length - 1)
41
+
42
+ # Initialize first column values
43
+ (1..that.length).each do |i|
44
+ dm[i] = [i * del, fill.flatten]
45
+ end
46
+
47
+ # populate matrix
48
+ (1..that.length).each do |i|
49
+ (1..this.length).each do |j|
50
+ # critical comparison
51
+ dm[i][j] = [
52
+ dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
53
+ dm[i][j - 1] + ins,
54
+ dm[i - 1][j] + del
55
+ ].min
56
+ end
57
+ end
58
+
59
+ # The last value in matrix is the Levenshtein distance between the strings
60
+ dm[that.length][this.length]
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class Source
5
+ class Gemspec < Path
6
+ attr_reader :gemspec
7
+
8
+ def initialize(options)
9
+ super
10
+ @gemspec = options["gemspec"]
11
+ end
12
+
13
+ def as_path_source
14
+ Path.new(options)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,262 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shellwords"
4
+ require "tempfile"
5
+ module Bundler
6
+ class Source
7
+ class Git
8
+ class GitNotInstalledError < GitError
9
+ def initialize
10
+ msg = String.new
11
+ msg << "You need to install git to be able to use gems from git repositories. "
12
+ msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git"
13
+ super msg
14
+ end
15
+ end
16
+
17
+ class GitNotAllowedError < GitError
18
+ def initialize(command)
19
+ msg = String.new
20
+ msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
21
+ msg << "this error message could probably be more useful. Please submit a ticket at http://github.com/bundler/bundler/issues "
22
+ msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
23
+ super msg
24
+ end
25
+ end
26
+
27
+ class GitCommandError < GitError
28
+ def initialize(command, path = nil, extra_info = nil)
29
+ msg = String.new
30
+ msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
31
+ msg << "\n#{extra_info}" if extra_info
32
+ msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
33
+ super msg
34
+ end
35
+ end
36
+
37
+ class MissingGitRevisionError < GitError
38
+ def initialize(ref, repo)
39
+ msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
40
+ super msg
41
+ end
42
+ end
43
+
44
+ # The GitProxy is responsible to interact with git repositories.
45
+ # All actions required by the Git source is encapsulated in this
46
+ # object.
47
+ class GitProxy
48
+ attr_accessor :path, :uri, :ref
49
+ attr_writer :revision
50
+
51
+ def initialize(path, uri, ref, revision = nil, git = nil)
52
+ @path = path
53
+ @uri = uri
54
+ @ref = ref
55
+ @revision = revision
56
+ @git = git
57
+ raise GitNotInstalledError.new if allow? && !Bundler.git_present?
58
+ end
59
+
60
+ def revision
61
+ return @revision if @revision
62
+
63
+ begin
64
+ @revision ||= find_local_revision
65
+ rescue GitCommandError
66
+ raise MissingGitRevisionError.new(ref, URICredentialsFilter.credential_filtered_uri(uri))
67
+ end
68
+
69
+ @revision
70
+ end
71
+
72
+ def branch
73
+ @branch ||= allowed_in_path do
74
+ git("rev-parse --abbrev-ref HEAD").strip
75
+ end
76
+ end
77
+
78
+ def contains?(commit)
79
+ allowed_in_path do
80
+ result = git_null("branch --contains #{commit}")
81
+ $? == 0 && result =~ /^\* (.*)$/
82
+ end
83
+ end
84
+
85
+ def version
86
+ git("--version").match(/(git version\s*)?((\.?\d+)+).*/)[2]
87
+ end
88
+
89
+ def full_version
90
+ git("--version").sub("git version", "").strip
91
+ end
92
+
93
+ def checkout
94
+ return if path.exist? && has_revision_cached?
95
+ extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
96
+
97
+ Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
98
+
99
+ unless path.exist?
100
+ SharedHelpers.filesystem_access(path.dirname) do |p|
101
+ FileUtils.mkdir_p(p)
102
+ end
103
+ git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
104
+ return unless extra_ref
105
+ end
106
+
107
+ in_path do
108
+ git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
109
+ end
110
+ end
111
+
112
+ def copy_to(destination, submodules = false)
113
+ # method 1
114
+ unless File.exist?(destination.join(".git"))
115
+ begin
116
+ SharedHelpers.filesystem_access(destination.dirname) do |p|
117
+ FileUtils.mkdir_p(p)
118
+ end
119
+ SharedHelpers.filesystem_access(destination) do |p|
120
+ FileUtils.rm_rf(p)
121
+ end
122
+ git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
123
+ File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
124
+ rescue Errno::EEXIST => e
125
+ file_path = e.message[%r{.*?(/.*)}, 1]
126
+ raise GitError, "Bundler could not install a gem because it needs to " \
127
+ "create a directory, but a file exists - #{file_path}. Please delete " \
128
+ "this file and try again."
129
+ end
130
+ end
131
+ # method 2
132
+ SharedHelpers.chdir(destination) do
133
+ git_retry %(fetch --force --quiet --tags "#{path}")
134
+
135
+ begin
136
+ git "reset --hard #{@revision}"
137
+ rescue GitCommandError
138
+ raise MissingGitRevisionError.new(@revision, URICredentialsFilter.credential_filtered_uri(uri))
139
+ end
140
+
141
+ if submodules
142
+ git_retry "submodule update --init --recursive"
143
+ elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
144
+ git_retry "submodule deinit --all --force"
145
+ end
146
+ end
147
+ end
148
+
149
+ private
150
+
151
+ # TODO: Do not rely on /dev/null.
152
+ # Given that open3 is not cross platform until Ruby 1.9.3,
153
+ # the best solution is to pipe to /dev/null if it exists.
154
+ # If it doesn't, everything will work fine, but the user
155
+ # will get the $stderr messages as well.
156
+ def git_null(command)
157
+ git("#{command} 2>#{Bundler::NULL}", false)
158
+ end
159
+
160
+ def git_retry(command)
161
+ Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
162
+ git(command)
163
+ end
164
+ end
165
+
166
+ def git(command, check_errors = true, error_msg = nil)
167
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
168
+ raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
169
+
170
+ out = SharedHelpers.with_clean_git_env do
171
+ capture_and_filter_stderr(uri) { `git #{command}` }
172
+ end
173
+
174
+ stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
175
+ raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !$?.success?
176
+ stdout_with_no_credentials
177
+ end
178
+
179
+ def has_revision_cached?
180
+ return unless @revision
181
+ in_path { git("cat-file -e #{@revision}") }
182
+ true
183
+ rescue GitError
184
+ false
185
+ end
186
+
187
+ def remove_cache
188
+ FileUtils.rm_rf(path)
189
+ end
190
+
191
+ def find_local_revision
192
+ allowed_in_path do
193
+ git("rev-parse --verify #{Shellwords.shellescape(ref)}", true).strip
194
+ end
195
+ end
196
+
197
+ # Escape the URI for git commands
198
+ def uri_escaped_with_configured_credentials
199
+ remote = configured_uri_for(uri)
200
+ if Bundler::WINDOWS
201
+ # Windows quoting requires double quotes only, with double quotes
202
+ # inside the string escaped by being doubled.
203
+ '"' + remote.gsub('"') { '""' } + '"'
204
+ else
205
+ # Bash requires single quoted strings, with the single quotes escaped
206
+ # by ending the string, escaping the quote, and restarting the string.
207
+ "'" + remote.gsub("'") { "'\\''" } + "'"
208
+ end
209
+ end
210
+
211
+ # Adds credentials to the URI as Fetcher#configured_uri_for does
212
+ def configured_uri_for(uri)
213
+ if /https?:/ =~ uri
214
+ remote = URI(uri)
215
+ config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
216
+ remote.userinfo ||= config_auth
217
+ remote.to_s
218
+ else
219
+ uri
220
+ end
221
+ end
222
+
223
+ def allow?
224
+ @git ? @git.allow_git_ops? : true
225
+ end
226
+
227
+ def in_path(&blk)
228
+ checkout unless path.exist?
229
+ _ = URICredentialsFilter # load it before we chdir
230
+ SharedHelpers.chdir(path, &blk)
231
+ end
232
+
233
+ def allowed_in_path
234
+ return in_path { yield } if allow?
235
+ raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
236
+ end
237
+
238
+ # TODO: Replace this with Open3 when upgrading to bundler 2
239
+ # Similar to #git_null, as Open3 is not cross-platform,
240
+ # a temporary way is to use Tempfile to capture the stderr.
241
+ # When replacing this using Open3, make sure git_null is
242
+ # also replaced by Open3, so stdout and stderr all got handled properly.
243
+ def capture_and_filter_stderr(uri)
244
+ return_value, captured_err = ""
245
+ backup_stderr = STDERR.dup
246
+ begin
247
+ Tempfile.open("captured_stderr") do |f|
248
+ STDERR.reopen(f)
249
+ return_value = yield
250
+ f.rewind
251
+ captured_err = f.read
252
+ end
253
+ ensure
254
+ STDERR.reopen backup_stderr
255
+ end
256
+ $stderr.puts URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
257
+ return_value
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end