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,129 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ # used for Creating Specifications from the Gemcutter Endpoint
4
+ class EndpointSpecification < Gem::Specification
5
+ ILLFORMED_MESSAGE = 'Ill-formed requirement ["#<YAML::Syck::DefaultKey'.freeze
6
+ include MatchPlatform
7
+
8
+ attr_reader :name, :version, :platform, :dependencies, :required_rubygems_version, :required_ruby_version, :checksum
9
+ attr_accessor :source, :remote
10
+
11
+ def initialize(name, version, platform, dependencies, metadata = nil)
12
+ @name = name
13
+ @version = Gem::Version.create version
14
+ @platform = platform
15
+ @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
16
+
17
+ parse_metadata(metadata)
18
+ end
19
+
20
+ def fetch_platform
21
+ @platform
22
+ end
23
+
24
+ # needed for standalone, load required_paths from local gemspec
25
+ # after the gem is installed
26
+ def require_paths
27
+ if @remote_specification
28
+ @remote_specification.require_paths
29
+ elsif _local_specification
30
+ _local_specification.require_paths
31
+ else
32
+ super
33
+ end
34
+ end
35
+
36
+ # needed for inline
37
+ def load_paths
38
+ # remote specs aren't installed, and can't have load_paths
39
+ if _local_specification
40
+ _local_specification.load_paths
41
+ else
42
+ super
43
+ end
44
+ end
45
+
46
+ # needed for binstubs
47
+ def executables
48
+ if @remote_specification
49
+ @remote_specification.executables
50
+ elsif _local_specification
51
+ _local_specification.executables
52
+ else
53
+ super
54
+ end
55
+ end
56
+
57
+ # needed for bundle clean
58
+ def bindir
59
+ if @remote_specification
60
+ @remote_specification.bindir
61
+ elsif _local_specification
62
+ _local_specification.bindir
63
+ else
64
+ super
65
+ end
66
+ end
67
+
68
+ # needed for post_install_messages during install
69
+ def post_install_message
70
+ if @remote_specification
71
+ @remote_specification.post_install_message
72
+ elsif _local_specification
73
+ _local_specification.post_install_message
74
+ end
75
+ end
76
+
77
+ # needed for "with native extensions" during install
78
+ def extensions
79
+ if @remote_specification
80
+ @remote_specification.extensions
81
+ elsif _local_specification
82
+ _local_specification.extensions
83
+ end
84
+ end
85
+
86
+ def _local_specification
87
+ return unless @loaded_from && File.exist?(local_specification_path)
88
+ eval(File.read(local_specification_path)).tap do |spec|
89
+ spec.loaded_from = @loaded_from
90
+ end
91
+ end
92
+
93
+ def __swap__(spec)
94
+ @remote_specification = spec
95
+ end
96
+
97
+ private
98
+
99
+ def local_specification_path
100
+ "#{base_dir}/specifications/#{full_name}.gemspec"
101
+ end
102
+
103
+ def parse_metadata(data)
104
+ return unless data
105
+ data.each do |k, v|
106
+ next unless v
107
+ case k.to_s
108
+ when "checksum"
109
+ @checksum = v.last
110
+ when "rubygems"
111
+ @required_rubygems_version = Gem::Requirement.new(v)
112
+ when "ruby"
113
+ @required_ruby_version = Gem::Requirement.new(v)
114
+ end
115
+ end
116
+ end
117
+
118
+ def build_dependency(name, requirements)
119
+ Gem::Dependency.new(name, requirements)
120
+ rescue ArgumentError => e
121
+ raise unless e.message.include?(ILLFORMED_MESSAGE)
122
+ puts # we shouldn't print the error message on the "fetching info" status line
123
+ raise GemspecError,
124
+ "Unfortunately, the gem #{name} (#{version}) has an invalid " \
125
+ "gemspec.\nPlease ask the gem author to yank the bad version to fix " \
126
+ "this issue. For more information, see http://bit.ly/syck-defaultkey."
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/rubygems_integration"
3
+ require "bundler/source/git/git_proxy"
4
+
5
+ module Bundler
6
+ class Env
7
+ def write(io)
8
+ io.write report(:print_gemfile => true, :print_gemspecs => true)
9
+ end
10
+
11
+ def report(options = {})
12
+ print_gemfile = options.delete(:print_gemfile)
13
+ print_gemspecs = options.delete(:print_gemspecs)
14
+
15
+ out = String.new("Environment\n\n")
16
+ out << " Bundler #{Bundler::VERSION}\n"
17
+ out << " Rubygems #{Gem::VERSION}\n"
18
+ out << " Ruby #{ruby_version}"
19
+ out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty?
20
+ out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"]
21
+ out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"]
22
+ out << " Git #{git_version}\n"
23
+ %w(rubygems-bundler open_gem).each do |name|
24
+ specs = Bundler.rubygems.find_name(name)
25
+ out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty?
26
+ end
27
+
28
+ out << "\nBundler settings\n\n" unless Bundler.settings.all.empty?
29
+ Bundler.settings.all.each do |setting|
30
+ out << " " << setting << "\n"
31
+ Bundler.settings.pretty_values_for(setting).each do |line|
32
+ out << " " << line << "\n"
33
+ end
34
+ end
35
+
36
+ if print_gemfile
37
+ out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n"
38
+ out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n"
39
+
40
+ out << "\n#{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n"
41
+ out << " " << read_file(Bundler.default_lockfile).gsub(/\n/, "\n ") << "\n"
42
+ end
43
+
44
+ if print_gemspecs
45
+ dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) }
46
+ dsl.gemspecs.each do |gs|
47
+ out << "\n#{File.basename(gs.loaded_from)}"
48
+ out << "\n\n " << read_file(gs.loaded_from).gsub(/\n/, "\n ") << "\n"
49
+ end
50
+ end
51
+
52
+ out
53
+ end
54
+
55
+ private
56
+
57
+ def read_file(filename)
58
+ File.read(filename.to_s).strip
59
+ rescue Errno::ENOENT
60
+ "<No #{filename} found>"
61
+ rescue => e
62
+ "#{e.class}: #{e.message}"
63
+ end
64
+
65
+ def ruby_version
66
+ str = String.new("#{RUBY_VERSION}")
67
+ if RUBY_VERSION < "1.9"
68
+ str << " (#{RUBY_RELEASE_DATE}"
69
+ str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
70
+ str << ") [#{RUBY_PLATFORM}]\n"
71
+ else
72
+ str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
73
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]\n"
74
+ end
75
+ end
76
+
77
+ def git_version
78
+ Bundler::Source::Git::GitProxy.new(nil, nil, nil).version
79
+ rescue Bundler::Source::Git::GitNotInstalledError
80
+ "not installed"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Environment
4
+ attr_reader :root
5
+
6
+ def initialize(root, definition)
7
+ @root = root
8
+ @definition = definition
9
+
10
+ env_file = Bundler.app_config_path.join("environment.rb")
11
+ env_file.rmtree if env_file.exist?
12
+ end
13
+
14
+ def inspect
15
+ @definition.to_lock.inspect
16
+ end
17
+
18
+ def requested_specs
19
+ @definition.requested_specs
20
+ end
21
+
22
+ def specs
23
+ @definition.specs
24
+ end
25
+
26
+ def dependencies
27
+ @definition.dependencies
28
+ end
29
+
30
+ def current_dependencies
31
+ @definition.current_dependencies
32
+ end
33
+
34
+ def lock(opts = {})
35
+ @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
36
+ end
37
+
38
+ def update(*gems)
39
+ # Nothing
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class EnvironmentPreserver
4
+ # @param env [ENV]
5
+ # @param keys [Array<String>]
6
+ def initialize(env, keys)
7
+ @original = env.to_hash
8
+ @keys = keys
9
+ @prefix = "BUNDLE_ORIG_"
10
+ end
11
+
12
+ # @return [Hash]
13
+ def backup
14
+ env = @original.clone
15
+ @keys.each do |key|
16
+ value = env[key]
17
+ original_value = env[@prefix + key]
18
+ if !value.nil? && !value.empty? && original_value.nil?
19
+ env[@prefix + key] = value
20
+ end
21
+ end
22
+ env
23
+ end
24
+
25
+ # @return [Hash]
26
+ def restore
27
+ env = @original.clone
28
+ @keys.each do |key|
29
+ value_original = env[@prefix + key]
30
+ unless value_original.nil? || value_original.empty?
31
+ env[key] = value_original
32
+ env.delete(@prefix + key)
33
+ end
34
+ end
35
+ env
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class BundlerError < StandardError
4
+ def self.status_code(code)
5
+ define_method(:status_code) { code }
6
+ end
7
+ end
8
+
9
+ class GemfileError < BundlerError; status_code(4); end
10
+ class InstallError < BundlerError; status_code(5); end
11
+
12
+ # Internal error, should be rescued
13
+ class VersionConflict < BundlerError
14
+ attr_reader :conflicts
15
+
16
+ def initialize(conflicts, msg = nil)
17
+ super(msg)
18
+ @conflicts = conflicts
19
+ end
20
+
21
+ status_code(6)
22
+ end
23
+
24
+ class GemNotFound < BundlerError; status_code(7); end
25
+ class InstallHookError < BundlerError; status_code(8); end
26
+ class GemfileNotFound < BundlerError; status_code(10); end
27
+ class GitError < BundlerError; status_code(11); end
28
+ class DeprecatedError < BundlerError; status_code(12); end
29
+ class PathError < BundlerError; status_code(13); end
30
+ class GemspecError < BundlerError; status_code(14); end
31
+ class InvalidOption < BundlerError; status_code(15); end
32
+ class ProductionError < BundlerError; status_code(16); end
33
+ class HTTPError < BundlerError
34
+ status_code(17)
35
+ def filter_uri(uri)
36
+ URICredentialsFilter.credential_filtered_uri(uri)
37
+ end
38
+ end
39
+ class RubyVersionMismatch < BundlerError; status_code(18); end
40
+ class SecurityError < BundlerError; status_code(19); end
41
+ class LockfileError < BundlerError; status_code(20); end
42
+ class CyclicDependencyError < BundlerError; status_code(21); end
43
+ class GemfileLockNotFound < BundlerError; status_code(22); end
44
+ class PluginError < BundlerError; status_code(23); end
45
+ class GemfileEvalError < GemfileError; end
46
+ class MarshalError < StandardError; end
47
+
48
+ class PermissionError < BundlerError
49
+ def initialize(path, permission_type = :write)
50
+ @path = path
51
+ @permission_type = permission_type
52
+ end
53
+
54
+ def action
55
+ case @permission_type
56
+ when :read then "read from"
57
+ when :write then "write to"
58
+ when :executable, :exec then "execute"
59
+ else @permission_type.to_s
60
+ end
61
+ end
62
+
63
+ def message
64
+ "There was an error while trying to #{action} `#{@path}`. " \
65
+ "It is likely that you need to grant #{@permission_type} permissions " \
66
+ "for that path."
67
+ end
68
+
69
+ status_code(23)
70
+ end
71
+
72
+ class GemRequireError < BundlerError
73
+ attr_reader :orig_exception
74
+
75
+ def initialize(orig_exception, msg)
76
+ full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
77
+ "Backtrace for gem load error is:\n"\
78
+ "#{orig_exception.backtrace.join("\n")}\n"\
79
+ "Bundler Error Backtrace:\n"
80
+ super(full_message)
81
+ @orig_exception = orig_exception
82
+ end
83
+
84
+ status_code(24)
85
+ end
86
+
87
+ class YamlSyntaxError < BundlerError
88
+ attr_reader :orig_exception
89
+
90
+ def initialize(orig_exception, msg)
91
+ super(msg)
92
+ @orig_exception = orig_exception
93
+ end
94
+
95
+ status_code(25)
96
+ end
97
+
98
+ class TemporaryResourceError < PermissionError
99
+ def message
100
+ "There was an error while trying to #{action} `#{@path}`. " \
101
+ "Some resource was temporarily unavailable. It's suggested that you try" \
102
+ "the operation again."
103
+ end
104
+
105
+ status_code(26)
106
+ end
107
+
108
+ class VirtualProtocolError < BundlerError
109
+ def message
110
+ "There was an error relating to virtualization and file access." \
111
+ "It is likely that you need to grant access to or mount some file system correctly."
112
+ end
113
+
114
+ status_code(27)
115
+ end
116
+
117
+ class OperationNotSupportedError < PermissionError
118
+ def message
119
+ "Attempting to #{action} `#{@path}` is unsupported by your OS."
120
+ end
121
+
122
+ status_code(28)
123
+ end
124
+ end
@@ -0,0 +1,304 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/vendored_persistent"
3
+ require "cgi"
4
+ require "securerandom"
5
+ require "zlib"
6
+
7
+ module Bundler
8
+ # Handles all the fetching with the rubygems server
9
+ class Fetcher
10
+ autoload :CompactIndex, "bundler/fetcher/compact_index"
11
+ autoload :Downloader, "bundler/fetcher/downloader"
12
+ autoload :Dependency, "bundler/fetcher/dependency"
13
+ autoload :Index, "bundler/fetcher/index"
14
+
15
+ # This error is raised when it looks like the network is down
16
+ class NetworkDownError < HTTPError; end
17
+ # This error is raised if the API returns a 413 (only printed in verbose)
18
+ class FallbackError < HTTPError; end
19
+ # This is the error raised if OpenSSL fails the cert verification
20
+ class CertificateFailureError < HTTPError
21
+ def initialize(remote_uri)
22
+ remote_uri = filter_uri(remote_uri)
23
+ super "Could not verify the SSL certificate for #{remote_uri}.\nThere" \
24
+ " is a chance you are experiencing a man-in-the-middle attack, but" \
25
+ " most likely your system doesn't have the CA certificates needed" \
26
+ " for verification. For information about OpenSSL certificates, see" \
27
+ " http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile" \
28
+ " sources and change 'https' to 'http'."
29
+ end
30
+ end
31
+ # This is the error raised when a source is HTTPS and OpenSSL didn't load
32
+ class SSLError < HTTPError
33
+ def initialize(msg = nil)
34
+ super msg || "Could not load OpenSSL.\n" \
35
+ "You must recompile Ruby with OpenSSL support or change the sources in your " \
36
+ "Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \
37
+ "using RVM are available at rvm.io/packages/openssl."
38
+ end
39
+ end
40
+ # This error is raised if HTTP authentication is required, but not provided.
41
+ class AuthenticationRequiredError < HTTPError
42
+ def initialize(remote_uri)
43
+ remote_uri = filter_uri(remote_uri)
44
+ super "Authentication is required for #{remote_uri}.\n" \
45
+ "Please supply credentials for this source. You can do this by running:\n" \
46
+ " bundle config #{remote_uri} username:password"
47
+ end
48
+ end
49
+ # This error is raised if HTTP authentication is provided, but incorrect.
50
+ class BadAuthenticationError < HTTPError
51
+ def initialize(remote_uri)
52
+ remote_uri = filter_uri(remote_uri)
53
+ super "Bad username or password for #{remote_uri}.\n" \
54
+ "Please double-check your credentials and correct them."
55
+ end
56
+ end
57
+
58
+ # Exceptions classes that should bypass retry attempts. If your password didn't work the
59
+ # first time, it's not going to the third time.
60
+ NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
61
+ :HTTPForbidden, :HTTPInsufficientStorage, :HTTPMethodNotAllowed,
62
+ :HTTPMovedPermanently, :HTTPNoContent, :HTTPNotFound,
63
+ :HTTPNotImplemented, :HTTPPreconditionFailed, :HTTPRequestEntityTooLarge,
64
+ :HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
65
+ :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
66
+ FAIL_ERRORS = begin
67
+ fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
68
+ fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError)
69
+ fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact)
70
+ end.freeze
71
+
72
+ class << self
73
+ attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries
74
+ end
75
+
76
+ self.redirect_limit = Bundler.settings[:redirect] # How many redirects to allow in one request
77
+ self.api_timeout = Bundler.settings[:timeout] # How long to wait for each API call
78
+ self.max_retries = Bundler.settings[:retry] # How many retries for the API call
79
+
80
+ def initialize(remote)
81
+ @remote = remote
82
+
83
+ Socket.do_not_reverse_lookup = true
84
+ connection # create persistent connection
85
+ end
86
+
87
+ def uri
88
+ @remote.anonymized_uri
89
+ end
90
+
91
+ # fetch a gem specification
92
+ def fetch_spec(spec)
93
+ spec -= [nil, "ruby", ""]
94
+ spec_file_name = "#{spec.join "-"}.gemspec"
95
+
96
+ uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
97
+ if uri.scheme == "file"
98
+ Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path))
99
+ elsif cached_spec_path = gemspec_cached_path(spec_file_name)
100
+ Bundler.load_gemspec(cached_spec_path)
101
+ else
102
+ Bundler.load_marshal Gem.inflate(downloader.fetch(uri).body)
103
+ end
104
+ rescue MarshalError
105
+ raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
106
+ "Your network or your gem server is probably having issues right now."
107
+ end
108
+
109
+ # return the specs in the bundler format as an index with retries
110
+ def specs_with_retry(gem_names, source)
111
+ Bundler::Retry.new("fetcher", FAIL_ERRORS).attempts do
112
+ specs(gem_names, source)
113
+ end
114
+ end
115
+
116
+ # return the specs in the bundler format as an index
117
+ def specs(gem_names, source)
118
+ old = Bundler.rubygems.sources
119
+ index = Bundler::Index.new
120
+
121
+ if Bundler::Fetcher.disable_endpoint
122
+ @use_api = false
123
+ specs = fetchers.last.specs(gem_names)
124
+ else
125
+ specs = []
126
+ fetchers.shift until fetchers.first.available? || fetchers.empty?
127
+ fetchers.dup.each do |f|
128
+ break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
129
+ fetchers.delete(f)
130
+ end
131
+ @use_api = false if fetchers.none?(&:api_fetcher?)
132
+ end
133
+
134
+ specs.each do |name, version, platform, dependencies|
135
+ next if name == "bundler"
136
+ spec = if dependencies
137
+ EndpointSpecification.new(name, version, platform, dependencies)
138
+ else
139
+ RemoteSpecification.new(name, version, platform, self)
140
+ end
141
+ spec.source = source
142
+ spec.remote = @remote
143
+ index << spec
144
+ end
145
+
146
+ index
147
+ rescue CertificateFailureError
148
+ Bundler.ui.info "" if gem_names && use_api # newline after dots
149
+ raise
150
+ ensure
151
+ Bundler.rubygems.sources = old
152
+ end
153
+
154
+ def use_api
155
+ return @use_api if defined?(@use_api)
156
+
157
+ fetchers.shift until fetchers.first.available?
158
+
159
+ @use_api = if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
160
+ false
161
+ else
162
+ fetchers.first.api_fetcher?
163
+ end
164
+ end
165
+
166
+ def user_agent
167
+ @user_agent ||= begin
168
+ ruby = Bundler::RubyVersion.system
169
+
170
+ agent = String.new("bundler/#{Bundler::VERSION}")
171
+ agent << " rubygems/#{Gem::VERSION}"
172
+ agent << " ruby/#{ruby.versions_string(ruby.versions)}"
173
+ agent << " (#{ruby.host})"
174
+ agent << " command/#{ARGV.first}"
175
+
176
+ if ruby.engine != "ruby"
177
+ # engine_version raises on unknown engines
178
+ engine_version = begin
179
+ ruby.engine_versions
180
+ rescue
181
+ "???"
182
+ end
183
+ agent << " #{ruby.engine}/#{ruby.versions_string(engine_version)}"
184
+ end
185
+
186
+ agent << " options/#{Bundler.settings.all.join(",")}"
187
+
188
+ agent << " ci/#{cis.join(",")}" if cis.any?
189
+
190
+ # add a random ID so we can consolidate runs server-side
191
+ agent << " " << SecureRandom.hex(8)
192
+
193
+ # add any user agent strings set in the config
194
+ extra_ua = Bundler.settings[:user_agent]
195
+ agent << " " << extra_ua if extra_ua
196
+
197
+ agent
198
+ end
199
+ end
200
+
201
+ def fetchers
202
+ @fetchers ||= FETCHERS.map {|f| f.new(downloader, @remote, uri) }
203
+ end
204
+
205
+ def http_proxy
206
+ return unless uri = connection.proxy_uri
207
+ uri.to_s
208
+ end
209
+
210
+ def inspect
211
+ "#<#{self.class}:0x#{object_id} uri=#{uri}>"
212
+ end
213
+
214
+ private
215
+
216
+ FETCHERS = [CompactIndex, Dependency, Index].freeze
217
+
218
+ def cis
219
+ env_cis = {
220
+ "TRAVIS" => "travis",
221
+ "CIRCLECI" => "circle",
222
+ "SEMAPHORE" => "semaphore",
223
+ "JENKINS_URL" => "jenkins",
224
+ "BUILDBOX" => "buildbox",
225
+ "GO_SERVER_URL" => "go",
226
+ "SNAP_CI" => "snap",
227
+ "CI_NAME" => ENV["CI_NAME"],
228
+ "CI" => "ci"
229
+ }
230
+ env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
231
+ end
232
+
233
+ def connection
234
+ @connection ||= begin
235
+ needs_ssl = remote_uri.scheme == "https" ||
236
+ Bundler.settings[:ssl_verify_mode] ||
237
+ Bundler.settings[:ssl_client_cert]
238
+ raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
239
+
240
+ con = Net::HTTP::Persistent.new "bundler", :ENV
241
+ if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
242
+ con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
243
+ end
244
+
245
+ if remote_uri.scheme == "https"
246
+ con.verify_mode = (Bundler.settings[:ssl_verify_mode] ||
247
+ OpenSSL::SSL::VERIFY_PEER)
248
+ con.cert_store = bundler_cert_store
249
+ end
250
+
251
+ if Bundler.settings[:ssl_client_cert]
252
+ pem = File.read(Bundler.settings[:ssl_client_cert])
253
+ con.cert = OpenSSL::X509::Certificate.new(pem)
254
+ con.key = OpenSSL::PKey::RSA.new(pem)
255
+ end
256
+
257
+ con.read_timeout = Fetcher.api_timeout
258
+ con.override_headers["User-Agent"] = user_agent
259
+ con.override_headers["X-Gemfile-Source"] = @remote.original_uri.to_s if @remote.original_uri
260
+ con
261
+ end
262
+ end
263
+
264
+ # cached gem specification path, if one exists
265
+ def gemspec_cached_path(spec_file_name)
266
+ paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
267
+ paths = paths.select {|path| File.file? path }
268
+ paths.first
269
+ end
270
+
271
+ HTTP_ERRORS = [
272
+ Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
273
+ Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
274
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
275
+ Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
276
+ ].freeze
277
+
278
+ def bundler_cert_store
279
+ store = OpenSSL::X509::Store.new
280
+ if Bundler.settings[:ssl_ca_cert]
281
+ if File.directory? Bundler.settings[:ssl_ca_cert]
282
+ store.add_path Bundler.settings[:ssl_ca_cert]
283
+ else
284
+ store.add_file Bundler.settings[:ssl_ca_cert]
285
+ end
286
+ else
287
+ store.set_default_paths
288
+ certs = File.expand_path("../ssl_certs/*/*.pem", __FILE__)
289
+ Dir.glob(certs).each {|c| store.add_file c }
290
+ end
291
+ store
292
+ end
293
+
294
+ private
295
+
296
+ def remote_uri
297
+ @remote.uri
298
+ end
299
+
300
+ def downloader
301
+ @downloader ||= Downloader.new(connection, self.class.redirect_limit)
302
+ end
303
+ end
304
+ end