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,218 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Source
4
+ class Git < Path
5
+ class GitNotInstalledError < GitError
6
+ def initialize
7
+ msg = String.new
8
+ msg << "You need to install git to be able to use gems from git repositories. "
9
+ msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git"
10
+ super msg
11
+ end
12
+ end
13
+
14
+ class GitNotAllowedError < GitError
15
+ def initialize(command)
16
+ msg = String.new
17
+ msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
18
+ msg << "this error message could probably be more useful. Please submit a ticket at http://github.com/bundler/bundler/issues "
19
+ msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
20
+ super msg
21
+ end
22
+ end
23
+
24
+ class GitCommandError < GitError
25
+ def initialize(command, path = nil, extra_info = nil)
26
+ msg = String.new
27
+ msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
28
+ msg << "\n#{extra_info}" if extra_info
29
+ msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
30
+ super msg
31
+ end
32
+ end
33
+
34
+ class MissingGitRevisionError < GitError
35
+ def initialize(ref, repo)
36
+ msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
37
+ super msg
38
+ end
39
+ end
40
+
41
+ # The GitProxy is responsible to interact with git repositories.
42
+ # All actions required by the Git source is encapsulated in this
43
+ # object.
44
+ class GitProxy
45
+ attr_accessor :path, :uri, :ref
46
+ attr_writer :revision
47
+
48
+ def initialize(path, uri, ref, revision = nil, git = nil)
49
+ @path = path
50
+ @uri = uri
51
+ @ref = ref
52
+ @revision = revision
53
+ @git = git
54
+ raise GitNotInstalledError.new if allow? && !Bundler.git_present?
55
+ end
56
+
57
+ def revision
58
+ return @revision if @revision
59
+
60
+ begin
61
+ @revision ||= find_local_revision
62
+ rescue GitCommandError
63
+ raise MissingGitRevisionError.new(ref, uri)
64
+ end
65
+
66
+ @revision
67
+ end
68
+
69
+ def branch
70
+ @branch ||= allowed_in_path do
71
+ git("rev-parse --abbrev-ref HEAD").strip
72
+ end
73
+ end
74
+
75
+ def contains?(commit)
76
+ allowed_in_path do
77
+ result = git_null("branch --contains #{commit}")
78
+ $? == 0 && result =~ /^\* (.*)$/
79
+ end
80
+ end
81
+
82
+ def version
83
+ git("--version").sub("git version", "").strip
84
+ end
85
+
86
+ def checkout
87
+ if path.exist?
88
+ return if has_revision_cached?
89
+ Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
90
+ in_path do
91
+ git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*")
92
+ end
93
+ else
94
+ Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
95
+ SharedHelpers.filesystem_access(path.dirname) do |p|
96
+ FileUtils.mkdir_p(p)
97
+ end
98
+ git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
99
+ end
100
+ end
101
+
102
+ def copy_to(destination, submodules = false)
103
+ # method 1
104
+ unless File.exist?(destination.join(".git"))
105
+ begin
106
+ SharedHelpers.filesystem_access(destination.dirname) do |p|
107
+ FileUtils.mkdir_p(p)
108
+ end
109
+ SharedHelpers.filesystem_access(destination) do |p|
110
+ FileUtils.rm_rf(p)
111
+ end
112
+ git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
113
+ File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination)
114
+ rescue Errno::EEXIST => e
115
+ file_path = e.message[%r{.*?(/.*)}, 1]
116
+ raise GitError, "Bundler could not install a gem because it needs to " \
117
+ "create a directory, but a file exists - #{file_path}. Please delete " \
118
+ "this file and try again."
119
+ end
120
+ end
121
+ # method 2
122
+ SharedHelpers.chdir(destination) do
123
+ git_retry %(fetch --force --quiet --tags "#{path}")
124
+ git "reset --hard #{@revision}"
125
+
126
+ git_retry "submodule update --init --recursive" if submodules
127
+ end
128
+ end
129
+
130
+ private
131
+
132
+ # TODO: Do not rely on /dev/null.
133
+ # Given that open3 is not cross platform until Ruby 1.9.3,
134
+ # the best solution is to pipe to /dev/null if it exists.
135
+ # If it doesn't, everything will work fine, but the user
136
+ # will get the $stderr messages as well.
137
+ def git_null(command)
138
+ git("#{command} 2>#{Bundler::NULL}", false)
139
+ end
140
+
141
+ def git_retry(command)
142
+ Bundler::Retry.new("git #{command}", GitNotAllowedError).attempts do
143
+ git(command)
144
+ end
145
+ end
146
+
147
+ def git(command, check_errors = true, error_msg = nil)
148
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
149
+ raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
150
+
151
+ out = SharedHelpers.with_clean_git_env { `git #{command}` }
152
+
153
+ stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
154
+ raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !$?.success?
155
+ stdout_with_no_credentials
156
+ end
157
+
158
+ def has_revision_cached?
159
+ return unless @revision
160
+ in_path { git("cat-file -e #{@revision}") }
161
+ true
162
+ rescue GitError
163
+ false
164
+ end
165
+
166
+ def remove_cache
167
+ FileUtils.rm_rf(path)
168
+ end
169
+
170
+ def find_local_revision
171
+ allowed_in_path do
172
+ git("rev-parse --verify #{ref}", true).strip
173
+ end
174
+ end
175
+
176
+ # Escape the URI for git commands
177
+ def uri_escaped_with_configured_credentials
178
+ remote = configured_uri_for(uri)
179
+ if Bundler::WINDOWS
180
+ # Windows quoting requires double quotes only, with double quotes
181
+ # inside the string escaped by being doubled.
182
+ '"' + remote.gsub('"') { '""' } + '"'
183
+ else
184
+ # Bash requires single quoted strings, with the single quotes escaped
185
+ # by ending the string, escaping the quote, and restarting the string.
186
+ "'" + remote.gsub("'") { "'\\''" } + "'"
187
+ end
188
+ end
189
+
190
+ # Adds credentials to the URI as Fetcher#configured_uri_for does
191
+ def configured_uri_for(uri)
192
+ if /https?:/ =~ uri
193
+ remote = URI(uri)
194
+ config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
195
+ remote.userinfo ||= config_auth
196
+ remote.to_s
197
+ else
198
+ uri
199
+ end
200
+ end
201
+
202
+ def allow?
203
+ @git ? @git.allow_git_ops? : true
204
+ end
205
+
206
+ def in_path(&blk)
207
+ checkout unless path.exist?
208
+ SharedHelpers.chdir(path, &blk)
209
+ end
210
+
211
+ def allowed_in_path
212
+ return in_path { yield } if allow?
213
+ raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,245 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Source
4
+ class Path < Source
5
+ autoload :Installer, "bundler/source/path/installer"
6
+
7
+ attr_reader :path, :options, :root_path
8
+ attr_writer :name
9
+ attr_accessor :version
10
+
11
+ DEFAULT_GLOB = "{,*,*/*}.gemspec".freeze
12
+
13
+ def initialize(options)
14
+ @options = options
15
+ @glob = options["glob"] || DEFAULT_GLOB
16
+
17
+ @allow_cached = false
18
+ @allow_remote = false
19
+
20
+ @root_path = options["root_path"] || Bundler.root
21
+
22
+ if options["path"]
23
+ @path = Pathname.new(options["path"])
24
+ @path = expand(@path) unless @path.relative?
25
+ end
26
+
27
+ @name = options["name"]
28
+ @version = options["version"]
29
+
30
+ # Stores the original path. If at any point we move to the
31
+ # cached directory, we still have the original path to copy from.
32
+ @original_path = @path
33
+ end
34
+
35
+ def remote!
36
+ @allow_remote = true
37
+ end
38
+
39
+ def cached!
40
+ @allow_cached = true
41
+ end
42
+
43
+ def self.from_lock(options)
44
+ new(options.merge("path" => options.delete("remote")))
45
+ end
46
+
47
+ def to_lock
48
+ out = String.new("PATH\n")
49
+ out << " remote: #{relative_path}\n"
50
+ out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
51
+ out << " specs:\n"
52
+ end
53
+
54
+ def to_s
55
+ "source at `#{@path}`"
56
+ end
57
+
58
+ def hash
59
+ [self.class, expanded_path, version].hash
60
+ end
61
+
62
+ def eql?(other)
63
+ return unless other.class == Path || other.class == Gemspec
64
+ expanded_path == expand(other.path) &&
65
+ version == other.version
66
+ end
67
+
68
+ alias_method :==, :eql?
69
+
70
+ def name
71
+ File.basename(expanded_path.to_s)
72
+ end
73
+
74
+ def install(spec, force = false)
75
+ Bundler.ui.info "Using #{version_message(spec)} from #{self}"
76
+ generate_bin(spec, :disable_extensions)
77
+ nil # no post-install message
78
+ end
79
+
80
+ def cache(spec, custom_path = nil)
81
+ app_cache_path = app_cache_path(custom_path)
82
+ return unless Bundler.settings[:cache_all]
83
+ return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
84
+
85
+ unless @original_path.exist?
86
+ raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{self} is missing!"
87
+ end
88
+
89
+ FileUtils.rm_rf(app_cache_path)
90
+ FileUtils.cp_r("#{@original_path}/.", app_cache_path)
91
+ FileUtils.touch(app_cache_path.join(".bundlecache"))
92
+ end
93
+
94
+ def local_specs(*)
95
+ @local_specs ||= load_spec_files
96
+ end
97
+
98
+ def specs
99
+ if has_app_cache?
100
+ @path = app_cache_path
101
+ @expanded_path = nil # Invalidate
102
+ end
103
+ local_specs
104
+ end
105
+
106
+ def app_cache_dirname
107
+ name
108
+ end
109
+
110
+ def root
111
+ Bundler.root
112
+ end
113
+
114
+ def is_a_path?
115
+ instance_of?(Path)
116
+ end
117
+
118
+ private
119
+
120
+ def expanded_path
121
+ @expanded_path ||= expand(path)
122
+ end
123
+
124
+ def expand(somepath)
125
+ somepath.expand_path(root_path)
126
+ rescue ArgumentError => e
127
+ Bundler.ui.debug(e)
128
+ raise PathError, "There was an error while trying to use the path " \
129
+ "`#{somepath}`.\nThe error message was: #{e.message}."
130
+ end
131
+
132
+ def app_cache_path(custom_path = nil)
133
+ @app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
134
+ end
135
+
136
+ def has_app_cache?
137
+ SharedHelpers.in_bundle? && app_cache_path.exist?
138
+ end
139
+
140
+ def load_spec_files
141
+ index = Index.new
142
+
143
+ if File.directory?(expanded_path)
144
+ # We sort depth-first since `<<` will override the earlier-found specs
145
+ Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
146
+ next unless spec = Bundler.load_gemspec(file)
147
+ spec.source = self
148
+ Bundler.rubygems.set_installed_by_version(spec)
149
+ # Validation causes extension_dir to be calculated, which depends
150
+ # on #source, so we validate here instead of load_gemspec
151
+ Bundler.rubygems.validate(spec)
152
+ index << spec
153
+ end
154
+
155
+ if index.empty? && @name && @version
156
+ index << Gem::Specification.new do |s|
157
+ s.name = @name
158
+ s.source = self
159
+ s.version = Gem::Version.new(@version)
160
+ s.platform = Gem::Platform::RUBY
161
+ s.summary = "Fake gemspec for #{@name}"
162
+ s.relative_loaded_from = "#{@name}.gemspec"
163
+ s.authors = ["no one"]
164
+ if expanded_path.join("bin").exist?
165
+ executables = expanded_path.join("bin").children
166
+ executables.reject! {|p| File.directory?(p) }
167
+ s.executables = executables.map {|c| c.basename.to_s }
168
+ end
169
+ end
170
+ end
171
+ else
172
+ message = String.new("The path `#{expanded_path}` ")
173
+ message << if File.exist?(expanded_path)
174
+ "is not a directory."
175
+ else
176
+ "does not exist."
177
+ end
178
+ raise PathError, message
179
+ end
180
+
181
+ index
182
+ end
183
+
184
+ def relative_path
185
+ if path.to_s.start_with?(root_path.to_s)
186
+ return path.relative_path_from(root_path)
187
+ end
188
+ path
189
+ end
190
+
191
+ def generate_bin(spec, disable_extensions = false)
192
+ gem_dir = Pathname.new(spec.full_gem_path)
193
+
194
+ # Some gem authors put absolute paths in their gemspec
195
+ # and we have to save them from themselves
196
+ spec.files = spec.files.map do |p|
197
+ next p unless p =~ /\A#{Pathname::SEPARATOR_PAT}/
198
+ next if File.directory?(p)
199
+ begin
200
+ Pathname.new(p).relative_path_from(gem_dir).to_s
201
+ rescue ArgumentError
202
+ p
203
+ end
204
+ end.compact
205
+
206
+ SharedHelpers.chdir(gem_dir) do
207
+ installer = Path::Installer.new(spec, :env_shebang => false)
208
+ run_hooks(:pre_install, installer)
209
+ build_extensions(installer) unless disable_extensions
210
+ installer.generate_bin
211
+ run_hooks(:post_install, installer)
212
+ end
213
+ rescue Gem::InvalidSpecificationException => e
214
+ Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \
215
+ "This prevents bundler from installing bins or native extensions, but " \
216
+ "that may not affect its functionality."
217
+
218
+ if !spec.extensions.empty? && !spec.email.empty?
219
+ Bundler.ui.warn "If you need to use this package without installing it from a gem " \
220
+ "repository, please contact #{spec.email} and ask them " \
221
+ "to modify their .gemspec so it can work with `gem build`."
222
+ end
223
+
224
+ Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
225
+ end
226
+
227
+ def build_extensions(installer)
228
+ installer.build_extensions
229
+ run_hooks(:post_build, installer)
230
+ end
231
+
232
+ def run_hooks(type, installer)
233
+ hooks_meth = "#{type}_hooks"
234
+ return unless Gem.respond_to?(hooks_meth)
235
+ Gem.send(hooks_meth).each do |hook|
236
+ result = hook.call(installer)
237
+ next unless result == false
238
+ location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
239
+ message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
240
+ raise InstallHookError, message
241
+ end
242
+ end
243
+ end
244
+ end
245
+ end