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,40 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+
4
+ module Bundler
5
+ class CLI::Binstubs
6
+ attr_reader :options, :gems
7
+ def initialize(options, gems)
8
+ @options = options
9
+ @gems = gems
10
+ end
11
+
12
+ def run
13
+ Bundler.definition.validate_ruby!
14
+ Bundler.settings[:bin] = options["path"] if options["path"]
15
+ Bundler.settings[:bin] = nil if options["path"] && options["path"].empty?
16
+ installer = Installer.new(Bundler.root, Bundler.definition)
17
+
18
+ if gems.empty?
19
+ Bundler.ui.error "`bundle binstubs` needs at least one gem to run."
20
+ exit 1
21
+ end
22
+
23
+ gems.each do |gem_name|
24
+ spec = installer.specs.find {|s| s.name == gem_name }
25
+ unless spec
26
+ raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(
27
+ gem_name, Bundler.definition.specs)
28
+ end
29
+
30
+ if spec.name == "bundler"
31
+ Bundler.ui.warn "Sorry, Bundler can only be run via Rubygems."
32
+ elsif options[:standalone]
33
+ installer.generate_standalone_bundler_executable_stubs(spec)
34
+ else
35
+ installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Cache
4
+ attr_reader :options
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ Bundler.definition.validate_ruby!
11
+ Bundler.definition.resolve_with_cache!
12
+ setup_cache_all
13
+ Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms")
14
+ Bundler.load.cache
15
+ Bundler.settings[:no_prune] = true if options["no-prune"]
16
+ Bundler.load.lock
17
+ rescue GemNotFound => e
18
+ Bundler.ui.error(e.message)
19
+ Bundler.ui.warn "Run `bundle install` to install missing gems."
20
+ exit 1
21
+ end
22
+
23
+ private
24
+
25
+ def setup_cache_all
26
+ Bundler.settings[:cache_all] = options[:all] if options.key?("all")
27
+
28
+ if Bundler.definition.has_local_dependencies? && !Bundler.settings[:cache_all]
29
+ Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
30
+ "to package them as well, please pass the --all flag. This will be the default " \
31
+ "on Bundler 2.0."
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Check
4
+ attr_reader :options
5
+
6
+ def initialize(options)
7
+ @options = options
8
+ end
9
+
10
+ def run
11
+ if options[:path]
12
+ Bundler.settings[:path] = File.expand_path(options[:path])
13
+ Bundler.settings[:disable_shared_gems] = true
14
+ end
15
+
16
+ begin
17
+ definition = Bundler.definition
18
+ definition.validate_ruby!
19
+ not_installed = definition.missing_specs
20
+ rescue GemNotFound, VersionConflict
21
+ Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
22
+ Bundler.ui.warn "Install missing gems with `bundle install`."
23
+ exit 1
24
+ end
25
+
26
+ if not_installed.any?
27
+ Bundler.ui.error "The following gems are missing"
28
+ not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" }
29
+ Bundler.ui.warn "Install missing gems with `bundle install`"
30
+ exit 1
31
+ elsif !Bundler.default_lockfile.exist? && Bundler.settings[:frozen]
32
+ Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present"
33
+ exit 1
34
+ else
35
+ Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"]
36
+ Bundler.ui.info "The Gemfile's dependencies are satisfied"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Clean
4
+ attr_reader :options
5
+
6
+ def initialize(options)
7
+ @options = options
8
+ end
9
+
10
+ def run
11
+ require_path_or_force
12
+ Bundler.load.clean(options[:"dry-run"])
13
+ end
14
+
15
+ protected
16
+
17
+ def require_path_or_force
18
+ if !Bundler.settings[:path] && !options[:force]
19
+ Bundler.ui.error "Cleaning all the gems on your system is dangerous! " \
20
+ "If you're sure you want to remove every system gem not in this " \
21
+ "bundle, run `bundle clean --force`."
22
+ exit 1
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ module CLI::Common
4
+ def self.without_groups_message
5
+ groups = Bundler.settings.without
6
+ group_list = [groups[0...-1].join(", "), groups[-1..-1]].
7
+ reject {|s| s.to_s.empty? }.join(" and ")
8
+ group_str = (groups.size == 1) ? "group" : "groups"
9
+ "Gems in the #{group_str} #{group_list} were not installed."
10
+ end
11
+
12
+ def self.select_spec(name, regex_match = nil)
13
+ specs = []
14
+ regexp = Regexp.new(name) if regex_match
15
+
16
+ Bundler.definition.specs.each do |spec|
17
+ return spec if spec.name == name
18
+ specs << spec if regexp && spec.name =~ regexp
19
+ end
20
+
21
+ case specs.count
22
+ when 0
23
+ raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
24
+ when 1
25
+ specs.first
26
+ else
27
+ ask_for_spec_from(specs)
28
+ end
29
+ rescue RegexpError
30
+ raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
31
+ end
32
+
33
+ def self.ask_for_spec_from(specs)
34
+ if !$stdout.tty? && ENV["BUNDLE_SPEC_RUN"].nil?
35
+ raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
36
+ end
37
+
38
+ specs.each_with_index do |spec, index|
39
+ Bundler.ui.info "#{index.succ} : #{spec.name}", true
40
+ end
41
+ Bundler.ui.info "0 : - exit -", true
42
+
43
+ num = Bundler.ui.ask("> ").to_i
44
+ num > 0 ? specs[num - 1] : nil
45
+ end
46
+
47
+ def self.gem_not_found_message(missing_gem_name, alternatives)
48
+ require "bundler/similarity_detector"
49
+ message = "Could not find gem '#{missing_gem_name}'."
50
+ alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
51
+ suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
52
+ message += "\nDid you mean #{suggestions}?" if suggestions
53
+ message
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Config
4
+ attr_reader :name, :options, :scope, :thor
5
+ attr_accessor :args
6
+
7
+ def initialize(options, args, thor)
8
+ @options = options
9
+ @args = args
10
+ @thor = thor
11
+ @name = peek = args.shift
12
+ @scope = "global"
13
+ return unless peek && peek.start_with?("--")
14
+ @name = args.shift
15
+ @scope = peek[2..-1]
16
+ end
17
+
18
+ def run
19
+ unless name
20
+ confirm_all
21
+ return
22
+ end
23
+
24
+ unless valid_scope?(scope)
25
+ Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
26
+ exit 1
27
+ end
28
+
29
+ if scope == "delete"
30
+ Bundler.settings.set_local(name, nil)
31
+ Bundler.settings.set_global(name, nil)
32
+ return
33
+ end
34
+
35
+ if args.empty?
36
+ confirm(name)
37
+ return
38
+ end
39
+
40
+ Bundler.ui.info(message) if message
41
+ Bundler.settings.send("set_#{scope}", name, new_value)
42
+ end
43
+
44
+ private
45
+
46
+ def confirm_all
47
+ Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
48
+ Bundler.settings.all.each do |setting|
49
+ Bundler.ui.confirm "#{setting}"
50
+ show_pretty_values_for(setting)
51
+ Bundler.ui.confirm ""
52
+ end
53
+ end
54
+
55
+ def confirm(name)
56
+ Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
57
+ show_pretty_values_for(name)
58
+ end
59
+
60
+ def new_value
61
+ pathname = Pathname.new(args.join(" "))
62
+ if name.start_with?("local.") && pathname.directory?
63
+ pathname.expand_path.to_s
64
+ else
65
+ args.join(" ")
66
+ end
67
+ end
68
+
69
+ def message
70
+ locations = Bundler.settings.locations(name)
71
+ if scope == "global"
72
+ if locations[:local]
73
+ "Your application has set #{name} to #{locations[:local].inspect}. " \
74
+ "This will override the global value you are currently setting"
75
+ elsif locations[:env]
76
+ "You have a bundler environment variable for #{name} set to " \
77
+ "#{locations[:env].inspect}. This will take precedence over the global value you are setting"
78
+ elsif locations[:global] && locations[:global] != args.join(" ")
79
+ "You are replacing the current global value of #{name}, which is currently " \
80
+ "#{locations[:global].inspect}"
81
+ end
82
+ elsif scope == "local" && locations[:local] != args.join(" ")
83
+ "You are replacing the current local value of #{name}, which is currently " \
84
+ "#{locations[:local].inspect}"
85
+ end
86
+ end
87
+
88
+ def show_pretty_values_for(setting)
89
+ thor.with_padding do
90
+ Bundler.settings.pretty_values_for(setting).each do |line|
91
+ Bundler.ui.info line
92
+ end
93
+ end
94
+ end
95
+
96
+ def valid_scope?(scope)
97
+ %w(delete local global).include?(scope)
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Console
4
+ attr_reader :options, :group
5
+ def initialize(options, group)
6
+ @options = options
7
+ @group = group
8
+ end
9
+
10
+ def run
11
+ group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
12
+ ARGV.clear
13
+
14
+ console = get_console(Bundler.settings[:console] || "irb")
15
+ console.start
16
+ end
17
+
18
+ def get_console(name)
19
+ require name
20
+ get_constant(name)
21
+ rescue LoadError
22
+ Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
23
+ require "irb"
24
+ get_constant("irb")
25
+ end
26
+
27
+ def get_constant(name)
28
+ const_name = {
29
+ "pry" => :Pry,
30
+ "ripl" => :Ripl,
31
+ "irb" => :IRB,
32
+ }[name]
33
+ Object.const_get(const_name)
34
+ rescue NameError
35
+ Bundler.ui.error "Could not find constant #{const_name}"
36
+ exit 1
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/current_ruby"
3
+
4
+ module Bundler
5
+ class CLI::Exec
6
+ attr_reader :options, :args, :cmd
7
+
8
+ def initialize(options, args)
9
+ @options = options
10
+ @cmd = args.shift
11
+ @args = args
12
+
13
+ if Bundler.current_ruby.ruby_2? && !Bundler.current_ruby.jruby?
14
+ @args << { :close_others => !options.keep_file_descriptors? }
15
+ elsif options.keep_file_descriptors?
16
+ Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
17
+ end
18
+ end
19
+
20
+ def run
21
+ validate_cmd!
22
+ SharedHelpers.set_bundle_environment
23
+ if bin_path = Bundler.which(cmd)
24
+ return kernel_load(bin_path, *args) if ruby_shebang?(bin_path)
25
+ # First, try to exec directly to something in PATH
26
+ kernel_exec([bin_path, cmd], *args)
27
+ else
28
+ # exec using the given command
29
+ kernel_exec(cmd, *args)
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def validate_cmd!
36
+ return unless cmd.nil?
37
+ Bundler.ui.error "bundler: exec needs a command to run"
38
+ exit 128
39
+ end
40
+
41
+ def kernel_exec(*args)
42
+ ui = Bundler.ui
43
+ Bundler.ui = nil
44
+ Kernel.exec(*args)
45
+ rescue Errno::EACCES, Errno::ENOEXEC
46
+ Bundler.ui = ui
47
+ Bundler.ui.error "bundler: not executable: #{cmd}"
48
+ exit 126
49
+ rescue Errno::ENOENT
50
+ Bundler.ui = ui
51
+ Bundler.ui.error "bundler: command not found: #{cmd}"
52
+ Bundler.ui.warn "Install missing gem executables with `bundle install`"
53
+ exit 127
54
+ end
55
+
56
+ def kernel_load(file, *args)
57
+ args.pop if args.last.is_a?(Hash)
58
+ ARGV.replace(args)
59
+ $0 = file
60
+ ui = Bundler.ui
61
+ Bundler.ui = nil
62
+ require "bundler/setup"
63
+ Kernel.load(file)
64
+ rescue SystemExit
65
+ raise
66
+ rescue Exception => e # rubocop:disable Lint/RescueException
67
+ Bundler.ui = ui
68
+ Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
69
+ backtrace = e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) }
70
+ abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
71
+ end
72
+
73
+ def ruby_shebang?(file)
74
+ possibilities = [
75
+ "#!/usr/bin/env ruby\n",
76
+ "#!#{Gem.ruby}\n",
77
+ ]
78
+ first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
79
+ possibilities.any? {|shebang| first_line.start_with?(shebang) }
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+ require "pathname"
3
+
4
+ module Bundler
5
+ class CLI::Gem
6
+ TEST_FRAMEWORK_VERSIONS = {
7
+ "rspec" => "3.0",
8
+ "minitest" => "5.0"
9
+ }.freeze
10
+
11
+ attr_reader :options, :gem_name, :thor, :name, :target
12
+
13
+ def initialize(options, gem_name, thor)
14
+ @options = options
15
+ @gem_name = resolve_name(gem_name)
16
+ @thor = thor
17
+
18
+ @name = @gem_name
19
+ @target = SharedHelpers.pwd.join(gem_name)
20
+
21
+ validate_ext_name if options[:ext]
22
+ end
23
+
24
+ def run
25
+ Bundler.ui.confirm "Creating gem '#{name}'..."
26
+
27
+ underscored_name = name.tr("-", "_")
28
+ namespaced_path = name.tr("-", "/")
29
+ constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
30
+ constant_array = constant_name.split("::")
31
+
32
+ git_user_name = `git config user.name`.chomp
33
+ git_user_email = `git config user.email`.chomp
34
+
35
+ config = {
36
+ :name => name,
37
+ :underscored_name => underscored_name,
38
+ :namespaced_path => namespaced_path,
39
+ :makefile_path => "#{underscored_name}/#{underscored_name}",
40
+ :constant_name => constant_name,
41
+ :constant_array => constant_array,
42
+ :author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
43
+ :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
44
+ :test => options[:test],
45
+ :ext => options[:ext],
46
+ :exe => options[:exe],
47
+ :bundler_version => bundler_dependency_version
48
+ }
49
+ ensure_safe_gem_name(name, constant_array)
50
+
51
+ templates = {
52
+ "Gemfile.tt" => "Gemfile",
53
+ "gitignore.tt" => ".gitignore",
54
+ "lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
55
+ "lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
56
+ "newgem.gemspec.tt" => "#{name}.gemspec",
57
+ "Rakefile.tt" => "Rakefile",
58
+ "README.md.tt" => "README.md",
59
+ "bin/console.tt" => "bin/console",
60
+ "bin/setup.tt" => "bin/setup"
61
+ }
62
+
63
+ executables = %w(
64
+ bin/console
65
+ bin/setup
66
+ )
67
+
68
+ if test_framework = ask_and_set_test_framework
69
+ config[:test] = test_framework
70
+ config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
71
+
72
+ templates.merge!(".travis.yml.tt" => ".travis.yml")
73
+
74
+ case test_framework
75
+ when "rspec"
76
+ templates.merge!(
77
+ "rspec.tt" => ".rspec",
78
+ "spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
79
+ "spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
80
+ )
81
+ when "minitest"
82
+ templates.merge!(
83
+ "test/test_helper.rb.tt" => "test/test_helper.rb",
84
+ "test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
85
+ )
86
+ end
87
+ end
88
+
89
+ config[:test_task] = config[:test] == "minitest" ? "test" : "spec"
90
+
91
+ if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
92
+ "This means that any other developer or company will be legally allowed to use your code " \
93
+ "for free as long as they admit you created it. You can read more about the MIT license " \
94
+ "at http://choosealicense.com/licenses/mit.")
95
+ config[:mit] = true
96
+ Bundler.ui.info "MIT License enabled in config"
97
+ templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
98
+ end
99
+
100
+ if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
101
+ "Codes of conduct can increase contributions to your project by contributors who " \
102
+ "prefer collaborative, safe spaces. You can read more about the code of conduct at " \
103
+ "contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
104
+ "of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
105
+ "address is specified as a contact in the generated code of conduct so that people know " \
106
+ "who to contact in case of a violation. For suggestions about " \
107
+ "how to enforce codes of conduct, see http://bit.ly/coc-enforcement.")
108
+ config[:coc] = true
109
+ Bundler.ui.info "Code of conduct enabled in config"
110
+ templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
111
+ end
112
+
113
+ templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
114
+
115
+ if options[:ext]
116
+ templates.merge!(
117
+ "ext/newgem/extconf.rb.tt" => "ext/#{name}/extconf.rb",
118
+ "ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h",
119
+ "ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c"
120
+ )
121
+ end
122
+
123
+ templates.each do |src, dst|
124
+ thor.template("newgem/#{src}", target.join(dst), config)
125
+ end
126
+
127
+ executables.each do |file|
128
+ path = target.join(file)
129
+ executable = (path.stat.mode | 0111)
130
+ path.chmod(executable)
131
+ end
132
+
133
+ Bundler.ui.info "Initializing git repo in #{target}"
134
+ Dir.chdir(target) do
135
+ `git init`
136
+ `git add .`
137
+ end
138
+
139
+ # Open gemspec in editor
140
+ open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
141
+ end
142
+
143
+ private
144
+
145
+ def resolve_name(name)
146
+ SharedHelpers.pwd.join(name).basename.to_s
147
+ end
148
+
149
+ def ask_and_set(key, header, message)
150
+ choice = options[key]
151
+ choice = Bundler.settings["gem.#{key}"] if choice.nil?
152
+
153
+ if choice.nil?
154
+ Bundler.ui.confirm header
155
+ choice = Bundler.ui.yes? "#{message} y/(n):"
156
+ Bundler.settings.set_global("gem.#{key}", choice)
157
+ end
158
+
159
+ choice
160
+ end
161
+
162
+ def validate_ext_name
163
+ return unless gem_name.index("-")
164
+
165
+ Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
166
+ "naming guidelines for C extensions. For more information, \n" \
167
+ "see the 'Extension Naming' section at the following URL:\n" \
168
+ "http://guides.rubygems.org/gems-with-extensions/\n"
169
+ exit 1
170
+ end
171
+
172
+ def ask_and_set_test_framework
173
+ test_framework = options[:test] || Bundler.settings["gem.test"]
174
+
175
+ if test_framework.nil?
176
+ Bundler.ui.confirm "Do you want to generate tests with your gem?"
177
+ result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \
178
+ "in the future. rspec/minitest/(none):"
179
+ if result =~ /rspec|minitest/
180
+ test_framework = result
181
+ else
182
+ test_framework = false
183
+ end
184
+ end
185
+
186
+ if Bundler.settings["gem.test"].nil?
187
+ Bundler.settings.set_global("gem.test", test_framework)
188
+ end
189
+
190
+ test_framework
191
+ end
192
+
193
+ def bundler_dependency_version
194
+ v = Gem::Version.new(Bundler::VERSION)
195
+ req = v.segments[0..1]
196
+ req << "a" if v.prerelease?
197
+ req.join(".")
198
+ end
199
+
200
+ def ensure_safe_gem_name(name, constant_array)
201
+ if name =~ /^\d/
202
+ Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
203
+ exit 1
204
+ elsif constant_array.inject(Object) {|c, s| (c.const_defined?(s) && c.const_get(s)) || break }
205
+ Bundler.ui.error "Invalid gem name #{name} constant #{constant_array.join("::")} is already in use. Please choose another gem name."
206
+ exit 1
207
+ end
208
+ end
209
+
210
+ def open_editor(editor, file)
211
+ thor.run(%(#{editor} "#{file}"))
212
+ end
213
+ end
214
+ end