rubygems-update 2.6.14 → 2.7.0

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 (347) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -7
  3. data/CONTRIBUTING.rdoc +53 -54
  4. data/History.txt +173 -9
  5. data/Manifest.txt +39 -11
  6. data/POLICIES.rdoc +3 -3
  7. data/README.md +72 -0
  8. data/Rakefile +30 -5
  9. data/appveyor.yml +29 -1
  10. data/bin/gem +1 -1
  11. data/bin/update_rubygems +2 -2
  12. data/bundler/CHANGELOG.md +269 -9
  13. data/bundler/CODE_OF_CONDUCT.md +1 -1
  14. data/bundler/CONTRIBUTING.md +10 -29
  15. data/bundler/README.md +22 -10
  16. data/bundler/exe/bundle +5 -7
  17. data/bundler/exe/bundle_ruby +4 -3
  18. data/bundler/lib/bundler.rb +94 -74
  19. data/bundler/lib/bundler/build_metadata.rb +36 -0
  20. data/bundler/lib/bundler/capistrano.rb +5 -0
  21. data/bundler/lib/bundler/cli.rb +229 -66
  22. data/bundler/lib/bundler/cli/add.rb +25 -0
  23. data/bundler/lib/bundler/cli/binstubs.rb +9 -7
  24. data/bundler/lib/bundler/cli/cache.rb +5 -4
  25. data/bundler/lib/bundler/cli/check.rb +3 -5
  26. data/bundler/lib/bundler/cli/clean.rb +5 -6
  27. data/bundler/lib/bundler/cli/common.rb +18 -2
  28. data/bundler/lib/bundler/cli/config.rb +26 -7
  29. data/bundler/lib/bundler/cli/console.rb +2 -1
  30. data/bundler/lib/bundler/cli/doctor.rb +1 -0
  31. data/bundler/lib/bundler/cli/exec.rb +3 -2
  32. data/bundler/lib/bundler/cli/gem.rb +36 -15
  33. data/bundler/lib/bundler/cli/info.rb +50 -0
  34. data/bundler/lib/bundler/cli/init.rb +20 -7
  35. data/bundler/lib/bundler/cli/inject.rb +13 -4
  36. data/bundler/lib/bundler/cli/install.rb +61 -77
  37. data/bundler/lib/bundler/cli/issue.rb +40 -0
  38. data/bundler/lib/bundler/cli/list.rb +22 -0
  39. data/bundler/lib/bundler/cli/lock.rb +4 -2
  40. data/bundler/lib/bundler/cli/open.rb +2 -2
  41. data/bundler/lib/bundler/cli/outdated.rb +30 -28
  42. data/bundler/lib/bundler/cli/package.rb +9 -6
  43. data/bundler/lib/bundler/cli/platform.rb +1 -0
  44. data/bundler/lib/bundler/cli/plugin.rb +1 -0
  45. data/bundler/lib/bundler/cli/pristine.rb +43 -0
  46. data/bundler/lib/bundler/cli/show.rb +1 -1
  47. data/bundler/lib/bundler/cli/update.rb +32 -11
  48. data/bundler/lib/bundler/cli/viz.rb +5 -1
  49. data/bundler/lib/bundler/compact_index_client.rb +1 -0
  50. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -2
  51. data/bundler/lib/bundler/compact_index_client/updater.rb +26 -7
  52. data/bundler/lib/bundler/compatibility_guard.rb +14 -0
  53. data/bundler/lib/bundler/constants.rb +1 -0
  54. data/bundler/lib/bundler/current_ruby.rb +8 -7
  55. data/bundler/lib/bundler/definition.rb +231 -159
  56. data/bundler/lib/bundler/dep_proxy.rb +2 -0
  57. data/bundler/lib/bundler/dependency.rb +6 -7
  58. data/bundler/lib/bundler/deployment.rb +1 -1
  59. data/bundler/lib/bundler/deprecate.rb +14 -3
  60. data/bundler/lib/bundler/dsl.rb +103 -62
  61. data/bundler/lib/bundler/endpoint_specification.rb +12 -2
  62. data/bundler/lib/bundler/env.rb +97 -36
  63. data/bundler/lib/bundler/environment_preserver.rb +27 -6
  64. data/bundler/lib/bundler/errors.rb +3 -1
  65. data/bundler/lib/bundler/feature_flag.rb +39 -4
  66. data/bundler/lib/bundler/fetcher.rb +15 -8
  67. data/bundler/lib/bundler/fetcher/base.rb +1 -0
  68. data/bundler/lib/bundler/fetcher/compact_index.rb +2 -12
  69. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  70. data/bundler/lib/bundler/fetcher/downloader.rb +4 -2
  71. data/bundler/lib/bundler/fetcher/index.rb +1 -0
  72. data/bundler/lib/bundler/friendly_errors.rb +5 -2
  73. data/bundler/lib/bundler/gem_helper.rb +23 -9
  74. data/bundler/lib/bundler/gem_helpers.rb +1 -0
  75. data/bundler/lib/bundler/gem_remote_fetcher.rb +1 -0
  76. data/bundler/lib/bundler/gem_tasks.rb +1 -0
  77. data/bundler/lib/bundler/gem_version_promoter.rb +1 -0
  78. data/bundler/lib/bundler/gemdeps.rb +1 -0
  79. data/bundler/lib/bundler/graph.rb +1 -0
  80. data/bundler/lib/bundler/index.rb +19 -11
  81. data/bundler/lib/bundler/injector.rb +51 -27
  82. data/bundler/lib/bundler/inline.rb +10 -10
  83. data/bundler/lib/bundler/installer.rb +104 -50
  84. data/bundler/lib/bundler/installer/gem_installer.rb +5 -2
  85. data/bundler/lib/bundler/installer/parallel_installer.rb +91 -42
  86. data/bundler/lib/bundler/installer/standalone.rb +1 -0
  87. data/bundler/lib/bundler/lazy_specification.rb +17 -4
  88. data/bundler/lib/bundler/lockfile_generator.rb +95 -0
  89. data/bundler/lib/bundler/lockfile_parser.rb +49 -35
  90. data/bundler/lib/bundler/match_platform.rb +1 -0
  91. data/bundler/lib/bundler/mirror.rb +8 -3
  92. data/bundler/lib/bundler/plugin.rb +6 -1
  93. data/bundler/lib/bundler/plugin/api/source.rb +16 -3
  94. data/bundler/lib/bundler/plugin/index.rb +2 -0
  95. data/bundler/lib/bundler/plugin/installer.rb +7 -6
  96. data/bundler/lib/bundler/plugin/source_list.rb +7 -8
  97. data/bundler/lib/bundler/process_lock.rb +24 -0
  98. data/bundler/lib/bundler/psyched_yaml.rb +10 -0
  99. data/bundler/lib/bundler/remote_specification.rb +25 -1
  100. data/bundler/lib/bundler/resolver.rb +171 -192
  101. data/bundler/lib/bundler/resolver/spec_group.rb +111 -0
  102. data/bundler/lib/bundler/retry.rb +1 -0
  103. data/bundler/lib/bundler/ruby_dsl.rb +1 -0
  104. data/bundler/lib/bundler/ruby_version.rb +6 -1
  105. data/bundler/lib/bundler/rubygems_ext.rb +18 -8
  106. data/bundler/lib/bundler/rubygems_gem_installer.rb +25 -2
  107. data/bundler/lib/bundler/rubygems_integration.rb +157 -66
  108. data/bundler/lib/bundler/runtime.rb +28 -18
  109. data/bundler/lib/bundler/settings.rb +202 -87
  110. data/bundler/lib/bundler/settings/validator.rb +79 -0
  111. data/bundler/lib/bundler/setup.rb +4 -7
  112. data/bundler/lib/bundler/shared_helpers.rb +129 -25
  113. data/bundler/lib/bundler/similarity_detector.rb +1 -0
  114. data/bundler/lib/bundler/source.rb +53 -1
  115. data/bundler/lib/bundler/source/gemspec.rb +1 -0
  116. data/bundler/lib/bundler/source/git.rb +49 -21
  117. data/bundler/lib/bundler/source/git/git_proxy.rb +17 -12
  118. data/bundler/lib/bundler/source/metadata.rb +63 -0
  119. data/bundler/lib/bundler/source/path.rb +38 -17
  120. data/bundler/lib/bundler/source/path/installer.rb +4 -2
  121. data/bundler/lib/bundler/source/rubygems.rb +154 -82
  122. data/bundler/lib/bundler/source/rubygems/remote.rb +8 -1
  123. data/bundler/lib/bundler/source_list.rb +75 -15
  124. data/bundler/lib/bundler/spec_set.rb +34 -21
  125. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  126. data/bundler/lib/bundler/stub_specification.rb +86 -2
  127. data/bundler/lib/bundler/templates/Executable +5 -1
  128. data/bundler/lib/bundler/templates/Executable.bundler +105 -0
  129. data/bundler/lib/bundler/templates/Executable.standalone +5 -5
  130. data/bundler/lib/bundler/templates/Gemfile +3 -0
  131. data/bundler/lib/bundler/templates/gems.rb +8 -0
  132. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -2
  133. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  134. data/bundler/lib/bundler/templates/newgem/README.md.tt +14 -8
  135. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  136. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  137. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  138. data/bundler/lib/bundler/templates/newgem/gitignore.tt +0 -1
  139. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
  140. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  141. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -10
  142. data/bundler/lib/bundler/templates/newgem/rspec.tt +1 -0
  143. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  144. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
  145. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  146. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  147. data/bundler/lib/bundler/ui.rb +1 -0
  148. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -0
  149. data/bundler/lib/bundler/ui/shell.rb +24 -10
  150. data/bundler/lib/bundler/ui/silent.rb +12 -1
  151. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -0
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  153. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  154. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  155. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +16 -5
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +10 -2
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +5 -4
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  170. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  171. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +501 -138
  172. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  173. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  174. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
  175. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +46 -21
  176. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
  177. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
  178. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  179. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  203. data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
  204. data/bundler/lib/bundler/vendored_molinillo.rb +1 -0
  205. data/bundler/lib/bundler/vendored_persistent.rb +35 -0
  206. data/bundler/lib/bundler/vendored_thor.rb +6 -2
  207. data/bundler/lib/bundler/version.rb +19 -2
  208. data/bundler/lib/bundler/version_ranges.rb +76 -0
  209. data/bundler/lib/bundler/vlad.rb +5 -0
  210. data/bundler/lib/bundler/worker.rb +3 -1
  211. data/bundler/lib/bundler/yaml_serializer.rb +3 -3
  212. data/bundler/man/bundle-add.ronn +29 -0
  213. data/bundler/man/bundle-binstubs.ronn +14 -0
  214. data/bundler/man/bundle-check.ronn +26 -0
  215. data/bundler/man/bundle-clean.ronn +18 -0
  216. data/bundler/man/bundle-config.ronn +180 -60
  217. data/bundler/man/bundle-exec.ronn +7 -0
  218. data/bundler/man/bundle-gem.ronn +3 -2
  219. data/bundler/man/bundle-info.ronn +17 -0
  220. data/bundler/man/bundle-init.ronn +18 -0
  221. data/bundler/man/bundle-inject.ronn +22 -0
  222. data/bundler/man/bundle-install.ronn +32 -32
  223. data/bundler/man/bundle-list.ronn +15 -0
  224. data/bundler/man/bundle-open.ronn +19 -0
  225. data/bundler/man/bundle-outdated.ronn +1 -1
  226. data/bundler/man/bundle-package.ronn +5 -0
  227. data/bundler/man/bundle-pristine.ronn +34 -0
  228. data/bundler/man/bundle-show.ronn +20 -0
  229. data/bundler/man/bundle-update.ronn +6 -3
  230. data/bundler/man/bundle-viz.ronn +30 -0
  231. data/bundler/man/bundle.ronn +11 -20
  232. data/bundler/man/gemfile.5.ronn +55 -64
  233. data/lib/rubygems.rb +79 -36
  234. data/lib/rubygems/basic_specification.rb +8 -4
  235. data/lib/rubygems/bundler_version_finder.rb +112 -0
  236. data/lib/rubygems/command.rb +1 -1
  237. data/lib/rubygems/command_manager.rb +3 -1
  238. data/lib/rubygems/commands/cert_command.rb +31 -6
  239. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  240. data/lib/rubygems/commands/help_command.rb +1 -1
  241. data/lib/rubygems/commands/owner_command.rb +3 -1
  242. data/lib/rubygems/commands/pristine_command.rb +11 -8
  243. data/lib/rubygems/commands/push_command.rb +2 -1
  244. data/lib/rubygems/commands/query_command.rb +13 -14
  245. data/lib/rubygems/commands/setup_command.rb +124 -69
  246. data/lib/rubygems/commands/signin_command.rb +33 -0
  247. data/lib/rubygems/commands/signout_command.rb +33 -0
  248. data/lib/rubygems/commands/uninstall_command.rb +4 -3
  249. data/lib/rubygems/commands/unpack_command.rb +16 -4
  250. data/lib/rubygems/commands/update_command.rb +1 -1
  251. data/lib/rubygems/commands/which_command.rb +1 -1
  252. data/lib/rubygems/commands/yank_command.rb +4 -11
  253. data/lib/rubygems/config_file.rb +13 -24
  254. data/lib/rubygems/core_ext/kernel_require.rb +10 -9
  255. data/lib/rubygems/dependency.rb +2 -0
  256. data/lib/rubygems/dependency_installer.rb +4 -0
  257. data/lib/rubygems/errors.rb +3 -0
  258. data/lib/rubygems/exceptions.rb +6 -0
  259. data/lib/rubygems/ext/builder.rb +1 -1
  260. data/lib/rubygems/ext/ext_conf_builder.rb +2 -4
  261. data/lib/rubygems/ext/rake_builder.rb +1 -1
  262. data/lib/rubygems/gem_runner.rb +5 -1
  263. data/lib/rubygems/install_update_options.rb +5 -28
  264. data/lib/rubygems/installer.rb +12 -7
  265. data/lib/rubygems/installer_test_case.rb +6 -3
  266. data/lib/rubygems/package/old.rb +1 -1
  267. data/lib/rubygems/request.rb +1 -1
  268. data/lib/rubygems/request_set.rb +20 -3
  269. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  270. data/lib/rubygems/requirement.rb +5 -1
  271. data/lib/rubygems/resolver.rb +24 -3
  272. data/lib/rubygems/resolver/installer_set.rb +4 -6
  273. data/lib/rubygems/safe_yaml.rb +4 -1
  274. data/lib/rubygems/security.rb +10 -3
  275. data/lib/rubygems/security_option.rb +43 -0
  276. data/lib/rubygems/server.rb +4 -12
  277. data/lib/rubygems/source.rb +7 -4
  278. data/lib/rubygems/source/git.rb +2 -1
  279. data/lib/rubygems/source/local.rb +38 -35
  280. data/lib/rubygems/source/lock.rb +4 -1
  281. data/lib/rubygems/source_local.rb +3 -1
  282. data/lib/rubygems/source_specific_file.rb +3 -2
  283. data/lib/rubygems/spec_fetcher.rb +7 -3
  284. data/lib/rubygems/specification.rb +281 -231
  285. data/lib/rubygems/stub_specification.rb +2 -3
  286. data/lib/rubygems/test_case.rb +14 -1
  287. data/lib/rubygems/user_interaction.rb +15 -13
  288. data/lib/rubygems/util.rb +6 -17
  289. data/lib/rubygems/version.rb +17 -3
  290. data/lib/rubygems/version_option.rb +6 -1
  291. data/setup.rb +1 -1
  292. data/test/rubygems/private3072_key.pem +40 -0
  293. data/test/rubygems/public3072_cert.pem +25 -0
  294. data/test/rubygems/test_config.rb +1 -1
  295. data/test/rubygems/test_gem.rb +72 -14
  296. data/test/rubygems/test_gem_bundler_version_finder.rb +125 -0
  297. data/test/rubygems/test_gem_command.rb +1 -1
  298. data/test/rubygems/test_gem_commands_build_command.rb +27 -1
  299. data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
  300. data/test/rubygems/test_gem_commands_install_command.rb +35 -2
  301. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  302. data/test/rubygems/test_gem_commands_query_command.rb +19 -0
  303. data/test/rubygems/test_gem_commands_setup_command.rb +17 -0
  304. data/test/rubygems/test_gem_commands_signin_command.rb +95 -0
  305. data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
  306. data/test/rubygems/test_gem_commands_sources_command.rb +1 -1
  307. data/test/rubygems/test_gem_commands_uninstall_command.rb +12 -0
  308. data/test/rubygems/test_gem_commands_update_command.rb +1 -1
  309. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  310. data/test/rubygems/test_gem_dependency.rb +28 -0
  311. data/test/rubygems/test_gem_ext_builder.rb +2 -2
  312. data/test/rubygems/test_gem_ext_rake_builder.rb +2 -2
  313. data/test/rubygems/test_gem_install_update_options.rb +2 -1
  314. data/test/rubygems/test_gem_installer.rb +29 -27
  315. data/test/rubygems/test_gem_package.rb +5 -5
  316. data/test/rubygems/test_gem_remote_fetcher.rb +2 -2
  317. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  318. data/test/rubygems/test_gem_requirement.rb +6 -0
  319. data/test/rubygems/test_gem_resolver.rb +26 -0
  320. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  321. data/test/rubygems/test_gem_security.rb +5 -0
  322. data/test/rubygems/test_gem_security_policy.rb +24 -24
  323. data/test/rubygems/test_gem_security_signer.rb +6 -6
  324. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  325. data/test/rubygems/test_gem_server.rb +18 -1
  326. data/test/rubygems/test_gem_source.rb +9 -0
  327. data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
  328. data/test/rubygems/test_gem_specification.rb +85 -10
  329. data/test/rubygems/test_gem_stream_ui.rb +6 -6
  330. data/test/rubygems/test_gem_stub_specification.rb +19 -1
  331. data/test/rubygems/test_gem_util.rb +1 -0
  332. data/test/rubygems/test_gem_version.rb +28 -7
  333. data/test/rubygems/test_gem_version_option.rb +15 -0
  334. data/test/rubygems/test_kernel.rb +30 -0
  335. data/test/rubygems/test_require.rb +44 -0
  336. metadata +47 -46
  337. data/README.rdoc +0 -54
  338. data/bundler/DEVELOPMENT.md +0 -150
  339. data/bundler/ISSUES.md +0 -117
  340. data/bundler/lib/bundler/postit_trampoline.rb +0 -73
  341. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  342. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  343. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  344. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  345. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  346. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
  347. data/bundler/man/index.txt +0 -8
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ # Represents metadata from when the Bundler gem was built.
5
+ module BuildMetadata
6
+ # begin ivars
7
+ @release = false
8
+ # end ivars
9
+
10
+ # A hash representation of the build metadata.
11
+ def self.to_h
12
+ {
13
+ "Built At" => built_at,
14
+ "Git SHA" => git_commit_sha,
15
+ "Released Version" => release?,
16
+ }
17
+ end
18
+
19
+ # A string representing the date the bundler gem was built.
20
+ def self.built_at
21
+ @built_at ||= Time.now.utc.strftime("%Y-%m-%d").freeze
22
+ end
23
+
24
+ # The SHA for the git commit the bundler gem was built from.
25
+ def self.git_commit_sha
26
+ @git_commit_sha ||= Dir.chdir(File.expand_path("..", __FILE__)) do
27
+ `git rev-parse --short HEAD`.strip.freeze
28
+ end
29
+ end
30
+
31
+ # Whether this is an official release build of Bundler.
32
+ def self.release?
33
+ @release
34
+ end
35
+ end
36
+ end
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require "bundler/shared_helpers"
4
+ Bundler::SharedHelpers.major_deprecation 2,
5
+ "The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"
6
+
2
7
  # Capistrano task for Bundler.
3
8
  #
4
9
  # Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
@@ -1,11 +1,18 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler"
3
4
  require "bundler/vendored_thor"
4
5
 
5
6
  module Bundler
6
7
  class CLI < Thor
7
- include Thor::Actions
8
- AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean).freeze
8
+ require "bundler/cli/common"
9
+
10
+ package_name "Bundler"
11
+
12
+ AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
13
+ PARSEABLE_COMMANDS = %w[
14
+ check config help exec platform show version
15
+ ].freeze
9
16
 
10
17
  def self.start(*)
11
18
  super
@@ -17,17 +24,22 @@ module Bundler
17
24
  end
18
25
 
19
26
  def self.dispatch(*)
20
- super {|i| i.send(:print_command) }
27
+ super do |i|
28
+ i.send(:print_command)
29
+ i.send(:warn_on_outdated_bundler)
30
+ end
21
31
  end
22
32
 
23
33
  def initialize(*args)
24
34
  super
25
- Bundler.reset!
26
35
 
27
36
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
28
- ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty?
37
+ if custom_gemfile && !custom_gemfile.empty?
38
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
39
+ Bundler.reset_paths!
40
+ end
29
41
 
30
- Bundler.settings[:retry] = options[:retry] if options[:retry]
42
+ Bundler.settings.set_command_option_if_given :retry, options[:retry]
31
43
 
32
44
  current_cmd = args.last[:current_command].name
33
45
  auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
@@ -35,7 +47,6 @@ module Bundler
35
47
  raise InvalidOption, e.message
36
48
  ensure
37
49
  self.options ||= {}
38
- Bundler.settings.cli_flags_given = !options.empty?
39
50
  unprinted_warnings = Bundler.ui.unprinted_warnings
40
51
  Bundler.ui = UI::Shell.new(options)
41
52
  Bundler.ui.level = "debug" if options["verbose"]
@@ -50,10 +61,41 @@ module Bundler
50
61
  end
51
62
  end
52
63
 
64
+ def self.deprecated_option(*args, &blk)
65
+ return if Bundler.feature_flag.forget_cli_options?
66
+ method_option(*args, &blk)
67
+ end
68
+
53
69
  check_unknown_options!(:except => [:config, :exec])
54
70
  stop_on_unknown_option! :exec
55
71
 
56
- default_task :install
72
+ desc "cli_help", "Prints a summary of bundler commands", :hide => true
73
+ def cli_help
74
+ version
75
+ Bundler.ui.info "\n"
76
+
77
+ primary_commands = ["install", "update",
78
+ Bundler.feature_flag.cache_command_is_package? ? "cache" : "package",
79
+ "exec", "config", "help"]
80
+
81
+ list = self.class.printable_commands(true)
82
+ by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
83
+ utilities = by_name.keys.sort - primary_commands
84
+ primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first }
85
+ utilities.map! {|name| by_name[name].first }
86
+
87
+ shell.say "Bundler commands:\n\n"
88
+
89
+ shell.say " Primary commands:\n"
90
+ shell.print_table(primary_commands, :indent => 4, :truncate => true)
91
+ shell.say
92
+ shell.say " Utilities:\n"
93
+ shell.print_table(utilities, :indent => 4, :truncate => true)
94
+ shell.say
95
+ self.class.send(:class_options_help, shell)
96
+ end
97
+ default_task(Bundler.feature_flag.default_cli_command)
98
+
57
99
  class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
58
100
  class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM",
59
101
  :desc => "Specify the number of times you wish to attempt network commands"
@@ -100,7 +142,7 @@ module Bundler
100
142
  Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
101
143
  dependency listed in the gemspec file to the newly created Gemfile.
102
144
  D
103
- method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
145
+ deprecated_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
104
146
  def init
105
147
  require "bundler/cli/init"
106
148
  Init.new(options.dup).run
@@ -117,7 +159,7 @@ module Bundler
117
159
  method_option "gemfile", :type => :string, :banner =>
118
160
  "Use the specified gemfile instead of Gemfile"
119
161
  method_option "path", :type => :string, :banner =>
120
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
162
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
121
163
  map "c" => "check"
122
164
  def check
123
165
  require "bundler/cli/check"
@@ -135,13 +177,13 @@ module Bundler
135
177
 
136
178
  If the bundle has already been installed, bundler will tell you so and then exit.
137
179
  D
138
- method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
180
+ deprecated_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
139
181
  "Generate bin stubs for bundled gems to ./bin"
140
- method_option "clean", :type => :boolean, :banner =>
182
+ deprecated_option "clean", :type => :boolean, :banner =>
141
183
  "Run bundle clean automatically after install"
142
- method_option "deployment", :type => :boolean, :banner =>
184
+ deprecated_option "deployment", :type => :boolean, :banner =>
143
185
  "Install using defaults tuned for deployment environments"
144
- method_option "frozen", :type => :boolean, :banner =>
186
+ deprecated_option "frozen", :type => :boolean, :banner =>
145
187
  "Do not allow the Gemfile.lock to be updated after this install"
146
188
  method_option "full-index", :type => :boolean, :banner =>
147
189
  "Fall back to using the single-file index of all gems"
@@ -151,28 +193,29 @@ module Bundler
151
193
  "Specify the number of jobs to run in parallel"
152
194
  method_option "local", :type => :boolean, :banner =>
153
195
  "Do not attempt to fetch gems remotely and use the gem cache instead"
154
- method_option "no-cache", :type => :boolean, :banner =>
196
+ deprecated_option "no-cache", :type => :boolean, :banner =>
155
197
  "Don't update the existing gem cache."
156
- method_option "force", :type => :boolean, :banner =>
198
+ method_option "redownload", :type => :boolean, :aliases =>
199
+ [Bundler.feature_flag.forget_cli_options? ? nil : "--force"].compact, :banner =>
157
200
  "Force downloading every gem."
158
- method_option "no-prune", :type => :boolean, :banner =>
201
+ deprecated_option "no-prune", :type => :boolean, :banner =>
159
202
  "Don't remove stale gems from the cache."
160
- method_option "path", :type => :string, :banner =>
203
+ deprecated_option "path", :type => :string, :banner =>
161
204
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
162
205
  method_option "quiet", :type => :boolean, :banner =>
163
206
  "Only output warnings and errors."
164
- method_option "shebang", :type => :string, :banner =>
207
+ deprecated_option "shebang", :type => :string, :banner =>
165
208
  "Specify a different shebang executable name than the default (usually 'ruby')"
166
209
  method_option "standalone", :type => :array, :lazy_default => [], :banner =>
167
210
  "Make a bundle that can work without the Bundler runtime"
168
- method_option "system", :type => :boolean, :banner =>
211
+ deprecated_option "system", :type => :boolean, :banner =>
169
212
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
170
213
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
171
214
  "Gem trust policy (like gem install -P). Must be one of " +
172
215
  Bundler.rubygems.security_policy_keys.join("|")
173
- method_option "without", :type => :array, :banner =>
216
+ deprecated_option "without", :type => :array, :banner =>
174
217
  "Exclude gems that are part of the specified named group."
175
- method_option "with", :type => :array, :banner =>
218
+ deprecated_option "with", :type => :array, :banner =>
176
219
  "Include gems that are part of the specified named group."
177
220
  map "i" => "install"
178
221
  def install
@@ -182,7 +225,7 @@ module Bundler
182
225
  end
183
226
  end
184
227
 
185
- desc "update [OPTIONS]", "update the current environment"
228
+ desc "update [OPTIONS]", "Update the current environment"
186
229
  long_desc <<-D
187
230
  Update will install the newest versions of the gems listed in the Gemfile. Use
188
231
  update when you have changed the Gemfile, or if you want to get the newest
@@ -216,6 +259,8 @@ module Bundler
216
259
  "Do not allow any gem to be updated past latest --patch | --minor | --major"
217
260
  method_option "conservative", :type => :boolean, :banner =>
218
261
  "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
262
+ method_option "all", :type => :boolean, :banner =>
263
+ "Update everything."
219
264
  def update(*gems)
220
265
  require "bundler/cli/update"
221
266
  Update.new(options, gems).run
@@ -231,12 +276,31 @@ module Bundler
231
276
  method_option "outdated", :type => :boolean,
232
277
  :banner => "Show verbose output including whether gems are outdated."
233
278
  def show(gem_name = nil)
234
- Bundler::SharedHelpers.major_deprecation("use `bundle show` instead of `bundle list`") if ARGV[0] == "list"
279
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle list` instead of `bundle show`") if ARGV[0] == "show"
235
280
  require "bundler/cli/show"
236
281
  Show.new(options, gem_name).run
237
282
  end
238
- # TODO: 2.0 remove `bundle list`
239
- map %w(list) => "show"
283
+ # TODO: 2.0 remove `bundle show`
284
+
285
+ if Bundler.feature_flag.list_command?
286
+ desc "list", "List all gems in the bundle"
287
+ method_option "name-only", :type => :boolean, :banner => "print only the gem names"
288
+ def list
289
+ require "bundler/cli/list"
290
+ List.new(options).run
291
+ end
292
+
293
+ map %w[ls] => "list"
294
+ else
295
+ map %w[list] => "show"
296
+ end
297
+
298
+ desc "info GEM [OPTIONS]", "Show information for the given gem"
299
+ method_option "path", :type => :boolean, :banner => "Print full path to gem"
300
+ def info(gem_name)
301
+ require "bundler/cli/info"
302
+ Info.new(options, gem_name).run
303
+ end
240
304
 
241
305
  desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem"
242
306
  long_desc <<-D
@@ -248,6 +312,8 @@ module Bundler
248
312
  "Overwrite existing binstubs if they exist"
249
313
  method_option "path", :type => :string, :lazy_default => "bin", :banner =>
250
314
  "Binstub destination directory (default bin)"
315
+ method_option "shebang", :type => :string, :banner =>
316
+ "Specify a different shebang executable name than the default (usually 'ruby')"
251
317
  method_option "standalone", :type => :boolean, :banner =>
252
318
  "Make binstubs that can work without the Bundler runtime"
253
319
  def binstubs(*gems)
@@ -255,7 +321,20 @@ module Bundler
255
321
  Binstubs.new(options, gems).run
256
322
  end
257
323
 
258
- desc "outdated GEM [OPTIONS]", "list installed gems with newer versions available"
324
+ desc "add GEM VERSION", "Add gem to Gemfile and run bundle install"
325
+ long_desc <<-D
326
+ Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
327
+ D
328
+ method_option "version", :aliases => "-v", :type => :string
329
+ method_option "group", :aliases => "-g", :type => :string
330
+ method_option "source", :aliases => "-s", :type => :string
331
+
332
+ def add(gem_name)
333
+ require "bundler/cli/add"
334
+ Add.new(options.dup, gem_name).run
335
+ end
336
+
337
+ desc "outdated GEM [OPTIONS]", "List installed gems with newer versions available"
259
338
  long_desc <<-D
260
339
  Outdated lists the names and versions of gems that have a newer version available
261
340
  in the given source. Calling outdated with [GEM [GEM]] will only check for newer
@@ -265,8 +344,8 @@ module Bundler
265
344
  For more information on patch level options (--major, --minor, --patch,
266
345
  --update-strict) see documentation on the same options on the update command.
267
346
  D
268
- method_option "group", :aliases => "--group", :type => :string, :banner => "List gems from a specific group"
269
- method_option "groups", :aliases => "--groups", :type => :boolean, :banner => "List gems organized by groups"
347
+ method_option "group", :type => :string, :banner => "List gems from a specific group"
348
+ method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
270
349
  method_option "local", :type => :boolean, :banner =>
271
350
  "Do not attempt to fetch gems remotely and use the gem cache instead"
272
351
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
@@ -288,17 +367,27 @@ module Bundler
288
367
  Outdated.new(options, gems).run
289
368
  end
290
369
 
291
- desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
292
- method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
293
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
294
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
295
- def cache
296
- require "bundler/cli/cache"
297
- Cache.new(options).run
370
+ if Bundler.feature_flag.cache_command_is_package?
371
+ map %w[cache] => :package
372
+ else
373
+ desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
374
+ unless Bundler.feature_flag.cache_command_is_package?
375
+ method_option "all", :type => :boolean,
376
+ :banner => "Include all sources (including path and git)."
377
+ end
378
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
379
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
380
+ def cache
381
+ require "bundler/cli/cache"
382
+ Cache.new(options).run
383
+ end
298
384
  end
299
385
 
300
- desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
301
- method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
386
+ desc "#{Bundler.feature_flag.cache_command_is_package? ? :cache : :package} [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
387
+ unless Bundler.feature_flag.cache_command_is_package?
388
+ method_option "all", :type => :boolean,
389
+ :banner => "Include all sources (including path and git)."
390
+ end
302
391
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
303
392
  method_option "cache-path", :type => :string, :banner =>
304
393
  "Specify a different cache path than the default (vendor/cache)."
@@ -320,14 +409,14 @@ module Bundler
320
409
  require "bundler/cli/package"
321
410
  Package.new(options).run
322
411
  end
323
- map %w(pack) => :package
412
+ map %w[pack] => :package
324
413
 
325
414
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
326
415
  method_option :keep_file_descriptors, :type => :boolean, :default => false
327
416
  long_desc <<-D
328
417
  Exec runs a command, providing it access to the gems in the bundle. While using
329
418
  bundle exec you can require and call the bundled gems as if they were installed
330
- into the system wide Rubygems repository.
419
+ into the system wide RubyGems repository.
331
420
  D
332
421
  map "e" => "exec"
333
422
  def exec(*args)
@@ -335,7 +424,7 @@ module Bundler
335
424
  Exec.new(options, args).run
336
425
  end
337
426
 
338
- desc "config NAME [VALUE]", "retrieve or set a configuration value"
427
+ desc "config NAME [VALUE]", "Retrieve or set a configuration value"
339
428
  long_desc <<-D
340
429
  Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
341
430
  existing value with the newly provided one.
@@ -347,6 +436,7 @@ module Bundler
347
436
  will show the current value, as well as any superceded values and
348
437
  where they were specified.
349
438
  D
439
+ method_option "parseable", :type => :boolean, :banner => "Use minimal formatting for more parseable output"
350
440
  def config(*args)
351
441
  require "bundler/cli/config"
352
442
  Config.new(options, args, self).run
@@ -358,18 +448,28 @@ module Bundler
358
448
  Open.new(options, name).run
359
449
  end
360
450
 
361
- desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
362
- def console(group = nil)
363
- # TODO: Remove for 2.0
364
- require "bundler/cli/console"
365
- Console.new(options, group).run
451
+ if Bundler.feature_flag.console_command?
452
+ desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
453
+ def console(group = nil)
454
+ require "bundler/cli/console"
455
+ Console.new(options, group).run
456
+ end
366
457
  end
367
458
 
368
459
  desc "version", "Prints the bundler's version information"
369
460
  def version
370
- Bundler.ui.info "Bundler version #{Bundler::VERSION}"
461
+ cli_help = current_command.name == "cli_help"
462
+ if cli_help || ARGV.include?("version")
463
+ build_info = " (#{BuildMetadata.built_at} commit #{BuildMetadata.git_commit_sha})"
464
+ end
465
+
466
+ if !cli_help && Bundler.feature_flag.print_only_version_number?
467
+ Bundler.ui.info "#{Bundler::VERSION}#{build_info}"
468
+ else
469
+ Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
470
+ end
371
471
  end
372
- map %w(-v --version) => :version
472
+ map %w[-v --version] => :version
373
473
 
374
474
  desc "licenses", "Prints the license of all gems in the bundle"
375
475
  def licenses
@@ -385,7 +485,7 @@ module Bundler
385
485
  end
386
486
  end
387
487
 
388
- desc "viz [OPTIONS]", "Generates a visual dependency graph"
488
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
389
489
  long_desc <<-D
390
490
  Viz generates a PNG file of the current Gemfile as a dependency graph.
391
491
  Viz requires the ruby-graphviz gem (and its dependencies).
@@ -403,7 +503,7 @@ module Bundler
403
503
 
404
504
  old_gem = instance_method(:gem)
405
505
 
406
- desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
506
+ desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
407
507
  method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
408
508
  method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
409
509
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
@@ -442,7 +542,7 @@ module Bundler
442
542
  File.expand_path(File.join(File.dirname(__FILE__), "templates"))
443
543
  end
444
544
 
445
- desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
545
+ desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
446
546
  method_option "dry-run", :type => :boolean, :default => false, :banner =>
447
547
  "Only print out changes, do not clean gems"
448
548
  method_option "force", :type => :boolean, :default => false, :banner =>
@@ -460,11 +560,15 @@ module Bundler
460
560
  Platform.new(options).run
461
561
  end
462
562
 
463
- desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile"
464
- def inject(name, version, *gems)
465
- SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command"
563
+ desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true
564
+ method_option "source", :type => :string, :banner =>
565
+ "Install gem from the given source"
566
+ method_option "group", :type => :string, :banner =>
567
+ "Install gem into a bundler group"
568
+ def inject(name, version)
569
+ SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
466
570
  require "bundler/cli/inject"
467
- Inject.new(options, name, version, gems).run
571
+ Inject.new(options.dup, name, version).run
468
572
  end
469
573
 
470
574
  desc "lock", "Creates a lockfile without installing"
@@ -499,7 +603,7 @@ module Bundler
499
603
 
500
604
  desc "env", "Print information about the environment Bundler is running under"
501
605
  def env
502
- Env.new.write($stdout)
606
+ Env.write($stdout)
503
607
  end
504
608
 
505
609
  desc "doctor [OPTIONS]", "Checks the bundle for common problems"
@@ -517,9 +621,26 @@ module Bundler
517
621
  Doctor.new(options).run
518
622
  end
519
623
 
624
+ desc "issue", "Learn how to report an issue in Bundler"
625
+ def issue
626
+ require "bundler/cli/issue"
627
+ Issue.new.run
628
+ end
629
+
630
+ desc "pristine [GEMS...]", "Restores installed gems to pristine condition"
631
+ long_desc <<-D
632
+ Restores installed gems to pristine condition from files located in the
633
+ gem cache. Gems installed from a git repository will be issued `git
634
+ checkout --force`.
635
+ D
636
+ def pristine(*gems)
637
+ require "bundler/cli/pristine"
638
+ Pristine.new(gems).run
639
+ end
640
+
520
641
  if Bundler.feature_flag.plugins?
521
642
  require "bundler/cli/plugin"
522
- desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins"
643
+ desc "plugin", "Manage the bundler plugins"
523
644
  subcommand "plugin", Plugin
524
645
  end
525
646
 
@@ -527,14 +648,14 @@ module Bundler
527
648
  # into the corresponding `bundle help #{command}` call
528
649
  def self.reformatted_help_args(args)
529
650
  bundler_commands = all_commands.keys
530
- help_flags = %w(--help -h)
531
- exec_commands = %w(e ex exe exec)
651
+ help_flags = %w[--help -h]
652
+ exec_commands = %w[e ex exe exec]
532
653
  help_used = args.index {|a| help_flags.include? a }
533
654
  exec_used = args.index {|a| exec_commands.include? a }
534
655
  command = args.find {|a| bundler_commands.include? a }
535
656
  if exec_used && help_used
536
657
  if exec_used + help_used == 1
537
- %w(help exec)
658
+ %w[help exec]
538
659
  else
539
660
  args
540
661
  end
@@ -569,15 +690,57 @@ module Bundler
569
690
  end
570
691
  end
571
692
 
572
- def print_command
573
- return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug?
693
+ def current_command
574
694
  _, _, config = @_initializer
575
- current_command = config[:current_command].name
576
- return if %w(exec version check platform show help).include?(current_command)
577
- command = ["bundle", current_command] + args
578
- command << Thor::Options.to_switches(options)
695
+ config[:current_command]
696
+ end
697
+
698
+ def print_command
699
+ return unless Bundler.ui.debug?
700
+ cmd = current_command
701
+ command_name = cmd.name
702
+ return if PARSEABLE_COMMANDS.include?(command_name)
703
+ command = ["bundle", command_name] + args
704
+ options_to_print = options.dup
705
+ options_to_print.delete_if do |k, v|
706
+ next unless o = cmd.options[k]
707
+ o.default == v
708
+ end
709
+ command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
579
710
  command.reject!(&:empty?)
580
711
  Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
581
712
  end
713
+
714
+ def warn_on_outdated_bundler
715
+ return if Bundler.settings[:disable_version_check]
716
+
717
+ command_name = current_command.name
718
+ return if PARSEABLE_COMMANDS.include?(command_name)
719
+
720
+ latest = Fetcher::CompactIndex.
721
+ new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
722
+ send(:compact_index_client).
723
+ instance_variable_get(:@cache).
724
+ dependencies("bundler").
725
+ map {|d| Gem::Version.new(d.first) }.
726
+ max
727
+ return unless latest
728
+
729
+ current = Gem::Version.new(VERSION)
730
+ return if current >= latest
731
+ latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
732
+
733
+ installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
734
+ if latest_installed && latest_installed > current
735
+ suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
736
+ suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
737
+ else
738
+ suggestion = installation
739
+ end
740
+
741
+ Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
742
+ rescue
743
+ nil
744
+ end
582
745
  end
583
746
  end