rubygems-update 3.1.0.pre2 → 3.1.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/History.txt +23 -2
  4. data/Manifest.txt +7 -7
  5. data/README.md +1 -1
  6. data/Rakefile +29 -10
  7. data/bundler/CHANGELOG.md +18 -1
  8. data/bundler/UPGRADING.md +229 -0
  9. data/bundler/lib/bundler.rb +87 -24
  10. data/bundler/lib/bundler/cli.rb +55 -25
  11. data/bundler/lib/bundler/cli/add.rb +1 -0
  12. data/bundler/lib/bundler/cli/{package.rb → cache.rb} +2 -2
  13. data/bundler/lib/bundler/cli/exec.rb +0 -7
  14. data/bundler/lib/bundler/dsl.rb +1 -1
  15. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  16. data/bundler/lib/bundler/gem_helper.rb +0 -2
  17. data/bundler/lib/bundler/gem_helpers.rb +1 -1
  18. data/bundler/lib/bundler/inline.rb +7 -3
  19. data/bundler/lib/bundler/lockfile_parser.rb +1 -0
  20. data/bundler/lib/bundler/rubygems_ext.rb +1 -1
  21. data/bundler/lib/bundler/rubygems_integration.rb +0 -1
  22. data/bundler/lib/bundler/setup.rb +2 -9
  23. data/bundler/lib/bundler/shared_helpers.rb +12 -25
  24. data/bundler/lib/bundler/source/git.rb +1 -1
  25. data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
  26. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +132 -109
  27. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +1 -1
  28. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -2
  29. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -0
  30. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +6 -16
  31. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +5 -5
  32. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +18 -7
  33. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +10 -8
  34. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  35. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +14 -18
  36. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  37. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  38. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  39. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  40. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +8 -6
  41. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -3
  42. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  43. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -0
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  45. data/bundler/lib/bundler/version.rb +1 -1
  46. data/bundler/man/bundle-add.1 +1 -1
  47. data/bundler/man/bundle-add.1.txt +1 -1
  48. data/bundler/man/bundle-binstubs.1 +1 -1
  49. data/bundler/man/bundle-binstubs.1.txt +1 -1
  50. data/bundler/man/bundle-cache.1 +55 -0
  51. data/bundler/man/bundle-cache.1.txt +78 -0
  52. data/bundler/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
  53. data/bundler/man/bundle-check.1 +1 -1
  54. data/bundler/man/bundle-check.1.txt +1 -1
  55. data/bundler/man/bundle-clean.1 +1 -1
  56. data/bundler/man/bundle-clean.1.txt +1 -1
  57. data/bundler/man/bundle-config.1 +1 -1
  58. data/bundler/man/bundle-config.1.txt +1 -1
  59. data/bundler/man/bundle-doctor.1 +1 -1
  60. data/bundler/man/bundle-doctor.1.txt +1 -1
  61. data/bundler/man/bundle-exec.1 +1 -1
  62. data/bundler/man/bundle-exec.1.txt +1 -1
  63. data/bundler/man/bundle-gem.1 +1 -1
  64. data/bundler/man/bundle-gem.1.txt +1 -1
  65. data/bundler/man/bundle-info.1 +1 -1
  66. data/bundler/man/bundle-info.1.txt +1 -1
  67. data/bundler/man/bundle-init.1 +1 -1
  68. data/bundler/man/bundle-init.1.txt +1 -1
  69. data/bundler/man/bundle-inject.1 +1 -1
  70. data/bundler/man/bundle-inject.1.txt +1 -1
  71. data/bundler/man/bundle-install.1 +1 -1
  72. data/bundler/man/bundle-install.1.txt +1 -1
  73. data/bundler/man/bundle-list.1 +1 -1
  74. data/bundler/man/bundle-list.1.txt +1 -1
  75. data/bundler/man/bundle-lock.1 +1 -1
  76. data/bundler/man/bundle-lock.1.txt +1 -1
  77. data/bundler/man/bundle-open.1 +1 -1
  78. data/bundler/man/bundle-open.1.txt +1 -1
  79. data/bundler/man/bundle-outdated.1 +1 -1
  80. data/bundler/man/bundle-outdated.1.txt +1 -1
  81. data/bundler/man/bundle-platform.1 +1 -1
  82. data/bundler/man/bundle-platform.1.txt +1 -1
  83. data/bundler/man/bundle-pristine.1 +1 -1
  84. data/bundler/man/bundle-pristine.1.txt +1 -1
  85. data/bundler/man/bundle-remove.1 +1 -1
  86. data/bundler/man/bundle-remove.1.txt +1 -1
  87. data/bundler/man/bundle-show.1 +1 -1
  88. data/bundler/man/bundle-show.1.txt +1 -1
  89. data/bundler/man/bundle-update.1 +1 -1
  90. data/bundler/man/bundle-update.1.txt +1 -1
  91. data/bundler/man/bundle-viz.1 +1 -1
  92. data/bundler/man/bundle-viz.1.txt +1 -1
  93. data/bundler/man/bundle.1 +1 -1
  94. data/bundler/man/bundle.1.txt +1 -1
  95. data/bundler/man/gemfile.5 +1 -1
  96. data/bundler/man/gemfile.5.txt +1 -1
  97. data/bundler/man/index.txt +1 -1
  98. data/lib/rubygems.rb +14 -11
  99. data/lib/rubygems/basic_specification.rb +9 -9
  100. data/lib/rubygems/bundler_version_finder.rb +2 -2
  101. data/lib/rubygems/commands/pristine_command.rb +0 -5
  102. data/lib/rubygems/config_file.rb +1 -1
  103. data/lib/rubygems/core_ext/kernel_gem.rb +7 -3
  104. data/lib/rubygems/core_ext/kernel_require.rb +20 -2
  105. data/lib/rubygems/installer.rb +3 -5
  106. data/lib/rubygems/name_tuple.rb +1 -1
  107. data/lib/rubygems/package.rb +1 -1
  108. data/lib/rubygems/path_support.rb +1 -1
  109. data/lib/rubygems/request_set.rb +1 -1
  110. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  111. data/lib/rubygems/request_set/lockfile.rb +3 -1
  112. data/lib/rubygems/source.rb +1 -1
  113. data/lib/rubygems/specification.rb +6 -6
  114. data/lib/rubygems/stub_specification.rb +1 -1
  115. data/lib/rubygems/test_case.rb +6 -6
  116. data/lib/rubygems/version.rb +23 -15
  117. data/rubygems-update.gemspec +1 -1
  118. data/test/rubygems/test_gem.rb +14 -10
  119. data/test/rubygems/test_gem_command_manager.rb +1 -1
  120. data/test/rubygems/test_gem_commands_pristine_command.rb +49 -0
  121. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +3 -3
  122. data/test/rubygems/test_gem_installer.rb +8 -5
  123. data/test/rubygems/test_gem_package.rb +4 -4
  124. data/test/rubygems/test_gem_specification.rb +17 -16
  125. data/test/rubygems/test_gem_version.rb +7 -0
  126. data/test/rubygems/test_project_sanity.rb +58 -0
  127. data/test/rubygems/test_require.rb +11 -13
  128. data/tmp/.keep +0 -0
  129. data/util/ci.sh +14 -2
  130. metadata +10 -10
  131. data/.travis.yml +0 -22
  132. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  133. data/bundler/man/bundle-package.1 +0 -55
  134. data/bundler/man/bundle-package.1.txt +0 -79
  135. data/test/rubygems/test_rake_package.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12c655396b1a51084dcafe66034d401555499af6244eb36898acd718b7e4747f
4
- data.tar.gz: 1ccf2e1b53df91037dc9ae294717261226dd1681241e8dbdad1bc76255abb57a
3
+ metadata.gz: 885ce9aa3a1ce8a73c527c618dcc435c8dce91f9d7108c192449704e9c4d5f19
4
+ data.tar.gz: c2d2369619e4933747732d5895594c5c4413ca8e98db51fc1bd277a7a51f400b
5
5
  SHA512:
6
- metadata.gz: 4b4819b33be36c276db078c5cee97968870091c58b19db4dff609d370e26f55fb7675aa1b18429a60024fffd200d33b647e59bc91574720be049313ec9d1fd61
7
- data.tar.gz: cc26746cc527a6aa96dea72c2c5660f4295b96e5bc4af6e5bad6d04e4ad9b799a0080b7a5650e9562b3a479639f3bce611882c9f1498172d3d587a0780165213
6
+ metadata.gz: 68dcc17b3a24684351615370e30d772fa847126e71e7e3b27982f5a81d287fe9b3b80d2982302aa37c9956de18375791c0e397329863910d8db42b5421fcfe09
7
+ data.tar.gz: 62834f1044ea634ea0cf952abb117023c01745b367a4746075e13b98d37059854849dafdf63efea93ee51a00d644d008e6e6c34b34917f907dc359ddd03838b0
@@ -4,6 +4,7 @@ AllCops:
4
4
  - 'bundler/**/*'
5
5
  - 'lib/rubygems/resolver/molinillo/**/*'
6
6
  - 'pkg/**/*'
7
+ - 'tmp/**/*'
7
8
  TargetRubyVersion: 2.3
8
9
 
9
10
  Layout/AccessModifierIndentation:
@@ -1,6 +1,27 @@
1
1
  # coding: UTF-8
2
2
 
3
- === 3.1.0.pre2 / 2018-12-19
3
+ === 3.1.0.pre3 / 2019-11-11
4
+
5
+ Minor enhancements:
6
+
7
+ * Fix gem pristine not accounting for user installed gems. Pull request
8
+ #2914 by Luis Sagastume.
9
+ * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by
10
+ SHIBATA Hiroshi.
11
+ * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi
12
+ Nakada.
13
+ * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans.
14
+ * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez.
15
+ * Clarify symlink conditionals in tests. Pull request #2962 by David
16
+ Rodríguez.
17
+ * Update command line parsing to work under ps. Pull request #2966 by
18
+ David Rodríguez.
19
+ * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by
20
+ David Rodríguez.
21
+ * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request
22
+ #2985 by MSP-Greg.
23
+
24
+ === 3.1.0.pre2 / 2019-10-15
4
25
 
5
26
  Minor enhancements:
6
27
 
@@ -9,7 +30,7 @@ Minor enhancements:
9
30
  * Time comparison around date boundary. Pull request #2944 by Nobuyoshi
10
31
  Nakada.
11
32
 
12
- === 3.1.0.pre1 / 2018-12-19
33
+ === 3.1.0.pre1 / 2019-10-08
13
34
 
14
35
  Major enhancements:
15
36
 
@@ -1,5 +1,4 @@
1
1
  .rubocop.yml
2
- .travis.yml
3
2
  CODE_OF_CONDUCT.md
4
3
  CONTRIBUTING.md
5
4
  History.txt
@@ -17,6 +16,7 @@ bundler/CHANGELOG.md
17
16
  bundler/CODE_OF_CONDUCT.md
18
17
  bundler/LICENSE.md
19
18
  bundler/README.md
19
+ bundler/UPGRADING.md
20
20
  bundler/bundler.gemspec
21
21
  bundler/exe/bundle
22
22
  bundler/exe/bundler
@@ -26,6 +26,7 @@ bundler/lib/bundler/capistrano.rb
26
26
  bundler/lib/bundler/cli.rb
27
27
  bundler/lib/bundler/cli/add.rb
28
28
  bundler/lib/bundler/cli/binstubs.rb
29
+ bundler/lib/bundler/cli/cache.rb
29
30
  bundler/lib/bundler/cli/check.rb
30
31
  bundler/lib/bundler/cli/clean.rb
31
32
  bundler/lib/bundler/cli/common.rb
@@ -43,7 +44,6 @@ bundler/lib/bundler/cli/list.rb
43
44
  bundler/lib/bundler/cli/lock.rb
44
45
  bundler/lib/bundler/cli/open.rb
45
46
  bundler/lib/bundler/cli/outdated.rb
46
- bundler/lib/bundler/cli/package.rb
47
47
  bundler/lib/bundler/cli/platform.rb
48
48
  bundler/lib/bundler/cli/plugin.rb
49
49
  bundler/lib/bundler/cli/pristine.rb
@@ -207,7 +207,6 @@ bundler/lib/bundler/vendor/thor/lib/thor/base.rb
207
207
  bundler/lib/bundler/vendor/thor/lib/thor/command.rb
208
208
  bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb
209
209
  bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb
210
- bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb
211
210
  bundler/lib/bundler/vendor/thor/lib/thor/error.rb
212
211
  bundler/lib/bundler/vendor/thor/lib/thor/group.rb
213
212
  bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb
@@ -242,6 +241,9 @@ bundler/man/bundle-add.ronn
242
241
  bundler/man/bundle-binstubs.1
243
242
  bundler/man/bundle-binstubs.1.txt
244
243
  bundler/man/bundle-binstubs.ronn
244
+ bundler/man/bundle-cache.1
245
+ bundler/man/bundle-cache.1.txt
246
+ bundler/man/bundle-cache.ronn
245
247
  bundler/man/bundle-check.1
246
248
  bundler/man/bundle-check.1.txt
247
249
  bundler/man/bundle-check.ronn
@@ -284,9 +286,6 @@ bundler/man/bundle-open.ronn
284
286
  bundler/man/bundle-outdated.1
285
287
  bundler/man/bundle-outdated.1.txt
286
288
  bundler/man/bundle-outdated.ronn
287
- bundler/man/bundle-package.1
288
- bundler/man/bundle-package.1.txt
289
- bundler/man/bundle-package.ronn
290
289
  bundler/man/bundle-platform.1
291
290
  bundler/man/bundle-platform.1.txt
292
291
  bundler/man/bundle-platform.ronn
@@ -681,11 +680,12 @@ test/rubygems/test_gem_validator.rb
681
680
  test/rubygems/test_gem_version.rb
682
681
  test/rubygems/test_gem_version_option.rb
683
682
  test/rubygems/test_kernel.rb
684
- test/rubygems/test_rake_package.rb
683
+ test/rubygems/test_project_sanity.rb
685
684
  test/rubygems/test_remote_fetch_error.rb
686
685
  test/rubygems/test_require.rb
687
686
  test/rubygems/wrong_key_cert.pem
688
687
  test/rubygems/wrong_key_cert_32.pem
688
+ tmp/.keep
689
689
  util/CL2notes
690
690
  util/bisect
691
691
  util/ci.sh
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RubyGems [![Travis Build Status](https://secure.travis-ci.org/rubygems/rubygems.svg?branch=master)](http://travis-ci.org/rubygems/rubygems) [![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/rubygems/rubygems?branch=master&svg=true)](https://ci.appveyor.com/project/rubygems/rubygems?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/30f913e9c2dd932132c1/maintainability)](https://codeclimate.com/github/rubygems/rubygems/maintainability)
1
+ # RubyGems [![Maintainability](https://api.codeclimate.com/v1/badges/30f913e9c2dd932132c1/maintainability)](https://codeclimate.com/github/rubygems/rubygems/maintainability)
2
2
 
3
3
  RubyGems is a package management framework for Ruby.
4
4
 
data/Rakefile CHANGED
@@ -20,9 +20,10 @@ task :git_hooks do
20
20
  end
21
21
 
22
22
  Rake::TestTask.new do |t|
23
- t.ruby_opts = %w[--disable-gems -w]
23
+ t.ruby_opts = %w[-w]
24
24
  t.ruby_opts << '-rdevkit' if Gem.win_platform?
25
25
 
26
+ t.libs << "libs"
26
27
  t.libs << "test"
27
28
  t.libs << "bundler/lib"
28
29
 
@@ -376,18 +377,36 @@ end
376
377
 
377
378
  # Misc Tasks ---------------------------------------------------------
378
379
 
380
+ module Rubygems
381
+ class ProjectFiles
382
+
383
+ def self.all
384
+ files = []
385
+ exclude = %r[\.git|\./bundler/(?!lib|man|exe|[^/]+\.md|bundler.gemspec)]ox
386
+ tracked_files = `git ls-files --recurse-submodules`.split("\n").map {|f| "./#{f}" }
387
+
388
+ tracked_files.each do |path|
389
+ next unless File.file?(path)
390
+ next if path =~ exclude
391
+ files << path[2..-1]
392
+ end
393
+
394
+ files
395
+ end
396
+
397
+ end
398
+ end
399
+
379
400
  desc "Update the manifest to reflect what's on disk"
380
401
  task :update_manifest do
381
- files = []
382
- exclude = %r[\.git|\./bundler/(?!lib|man|exe|[^/]+\.md|bundler.gemspec)]ox
383
- tracked_files = `git ls-files --recurse-submodules`.split("\n").map {|f| "./#{f}" }
384
-
385
- tracked_files.each do |path|
386
- next unless File.file?(path)
387
- next if path =~ exclude
388
- files << path[2..-1]
402
+ File.open('Manifest.txt', 'w') {|f| f.puts(Rubygems::ProjectFiles.all.sort) }
403
+ end
404
+
405
+ desc "Check the manifest is up to date"
406
+ task :check_manifest do
407
+ if File.read("Manifest.txt").split.sort != Rubygems::ProjectFiles.all.sort
408
+ abort "Manifest is out of date. Run `rake update_manifest` to sync it"
389
409
  end
390
- File.open('Manifest.txt', 'w') {|f| f.puts(files.sort) }
391
410
  end
392
411
 
393
412
  namespace :bundler do
@@ -1,4 +1,21 @@
1
- ## 2.1.0.pre.2
1
+ ## 2.1.0.pre.3 (November 12, 2019)
2
+
3
+ Features:
4
+
5
+ - Add caller information to some deprecation messages to make them easier to fix [#7361](https://github.com/bundler/bundler/pull/7361)
6
+ - Reconcile `bundle cache` vs `bundle package` everywhere. Now in docs, CLI help and everywhere else `bundle cache` is the preferred version and `bundle package` remains as an alias [#7389](https://github.com/bundler/bundler/pull/7389)
7
+ - Display some basic `bundler` documentation together with ruby's RDoc based documentation [#7394](https://github.com/bundler/bundler/pull/7394)
8
+
9
+ Bugfixes:
10
+
11
+ - Fix typos deprecation message and upgrading docs [#7374](https://github.com/bundler/bundler/pull/7374)
12
+ - Deprecation warnings about `taint` usage on ruby 2.7 [#7385](https://github.com/bundler/bundler/pull/7385)
13
+ - Fix `--help` flag not correctly delegating to `man` when used with command aliases [#7388](https://github.com/bundler/bundler/pull/7388)
14
+ - `bundle add` should cache newly added gems if an application cache exists [#7393](https://github.com/bundler/bundler/pull/7393)
15
+ - Stop using an insecure folder as a "fallback home" when user home is not defined [#7416](https://github.com/bundler/bundler/pull/7416)
16
+ - Fix `bundler/inline` warning about `Bundler.root` redefinition [#7417](https://github.com/bundler/bundler/pull/7417)
17
+
18
+ ## 2.1.0.pre.2 (September 15, 2019)
2
19
 
3
20
  Bugfixes:
4
21
 
@@ -0,0 +1,229 @@
1
+ # Upgrading
2
+
3
+ ## Bundler 3
4
+
5
+ The following is a summary of the changes that we plan to introduce in Bundler
6
+ 3, why we will be making those changes, and what the deprecation process will
7
+ look like. All these deprecations will be printed by default in the upcoming
8
+ Bundler 2.1 release.
9
+
10
+ If you don't want to deal with deprecations right now and want to toggle them
11
+ off, you can do it through configuration. Set the `BUNDLE_SILENCE_DEPRECATIONS`
12
+ environment variable to "true", or configure it through `bundle config` either
13
+ globally through `bundle config set silence_deprecations true` command, or
14
+ locally through `bundle config set --local silence_deprecations true`. From now
15
+ on in this document we will assume that all three of these configuration options
16
+ are available, but will only mention `bundle config set <option> <value>`.
17
+
18
+ As a general note, these changes are intended to improve the experience using
19
+ bundler for _new_ users, who have no existing usage routines nor possibly biased
20
+ opinions about how the tool should work based on how it has historically worked.
21
+ We do understand that changing behaviour that have been existing for years can
22
+ be annoying for old users, that's why we intend to make this process as smooth
23
+ as possible for everyone.
24
+
25
+ I'll be dividing the deprecations into three groups: CLI deprecations, DSL
26
+ deprecations, and misc deprecations. Let's dive into each of them.
27
+
28
+ #### CLI deprecations
29
+
30
+ The CLI defines a set of commands and options that can be used by our users to
31
+ create command lines that bundler can understand. There's a number of changes
32
+ that we plan to make to this set of commands and options.
33
+
34
+ * Flags passed to `bundle install` that relied on being remembered across invocations have been deprecated.
35
+
36
+ In particular, the `--clean`, `--deployment`, `--frozen`, `--no-cache`,
37
+ `--no-prune`, `--path`, `--shebang`, `--system`, `--without`, and `--with`
38
+ options to `bundle install`.
39
+
40
+ Remembering CLI options has been a source of historical confusion and bug
41
+ reports, not only for beginners but also for experienced users. A CLI tool
42
+ should not behave differently across exactly the same invocations _unless_
43
+ explicitly configured to do so. This is what configuration is about after all,
44
+ and things should never be silently configured without the user knowing about
45
+ it.
46
+
47
+ The problem with changing this behavior is that very common workflows are
48
+ relying on it. For example, when you run `bundle install --without
49
+ development:test` in production, those flags are persisted in the app's
50
+ configuration file and further `bundle` invocations will happily ignore
51
+ development and test gems. This magic will disappear from bundler 3, and
52
+ you will explicitly need to configure it, either through environment
53
+ variables, application configuration, or machine configuration. For example,
54
+ with `bundle config set without development test`.
55
+
56
+ The removal of this kind of flag also applies to analogous commands, for
57
+ example, to `bundle check --path`.
58
+
59
+ * The `--force` flag to `bundle install` and `bundle update` has been renamed to `--redownload`.
60
+
61
+ This is just a simple rename of the flag, to make more apparent what it
62
+ actually does. This flag forces redownloading every gem, it doesn't "force"
63
+ anything else.
64
+
65
+ * `bundle viz` will be removed and extracted to a plugin.
66
+
67
+ This is the only bundler command requiring external dependencies, both an OS
68
+ dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
69
+ gem). Removing these dependencies will make development easier and it was also
70
+ seen by the bundler team as an opportunity to develop a [bundler
71
+ plugin](https://github.com/bundler/bundle-viz) that it's officially maintained
72
+ by the bundler team, and that users can take as a reference to develop their
73
+ own plugins. The plugin contains the same code as the old core command, the
74
+ only difference being that the command is now implemented as `bundle graph`
75
+ hich is much easier to understand. Have a look at the plugin's repo for more
76
+ information about how to install and use the new plugin.
77
+
78
+ * The `bundle console` will be removed and replaced with `bin/console`.
79
+
80
+ Over time we found `bundle console` hard to maintain because every user would
81
+ want to add her own specific tweaks to it. In order to ease maintenance and
82
+ reduce bikeshedding discussions, we're removing the `bundle console` command
83
+ in favor of a `bin/console` script created by `bundle gem` on gem generation
84
+ that users can tweak to their needs.
85
+
86
+ * The `bundle update` command will no longer update all gems, you'll need to pass `--all` to it.
87
+
88
+ The bundler team considers that updating all gems at once should not be the
89
+ main use case for this command, and that it's better to upgrade gems one at a
90
+ time (or in groups of related gems). You can still upgrade all gems at once,
91
+ but now you need the `--all` flag.
92
+
93
+ * The `bundle install` command will no longer accept a `--binstubs` flag.
94
+
95
+ The `--binstubs` option has been removed from `bundle install` and replaced
96
+ with the `bundle binstubs` command. The `--binstubs` flag would create
97
+ binstubs for all executables present inside the gems in the project. This was
98
+ hardly useful since most users will only use a subset of all the binstubs
99
+ available to them. Also, it would force the introduction of a bunch of most
100
+ likely unused files into source control. Because of this, binstubs now must
101
+ must be created and checked into version control individually.
102
+
103
+ * The `bundle config` command has a new subcommand-based interface.
104
+
105
+ We believe the old interface where the kind of operation was guessed from the
106
+ combination of flags and number of arguments being passed to the command was
107
+ confusing. Instead we have introduced a compulsory subcommand argument that
108
+ can be either `list`, `get`, `set` or `unset`. We believe this will make the
109
+ `config` command much easier to interact with. The old interface is
110
+ deprecated, but we are giving suggestions about the new commands that should
111
+ be used along with the deprecation messages.
112
+
113
+ * The `bundle inject` command is deprecated and replaced with `bundle add`.
114
+
115
+ We believe the new command fits the user's mental model better and it supports
116
+ a wider set of use cases. The interface supported by `bundle inject` works
117
+ exactly the same in `bundle add`, so it should be easy to migrate to the new
118
+ command.
119
+
120
+ #### Helper deprecations
121
+
122
+ * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` are deprecated.
123
+
124
+ All of these helpers ultimately use `Bundler.clean_env` under the hood, which
125
+ makes sure all bundler-related environment are removed inside the block it
126
+ yields.
127
+
128
+ After quite a lot user reports, we noticed that users don't usually want this
129
+ but instead want the bundler environment as it was before the current process
130
+ was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
131
+ `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
132
+ under the hood.
133
+
134
+ There's however some specific cases where the good old `Bundler.clean_env`
135
+ behavior can be useful. For example, when testing Rails generators, you really
136
+ want an environment where `bundler` is out of the picture. This is why we
137
+ decided to keep the old behavior under a new more clear name, because we
138
+ figured the word "clean" was too ambiguous. So we have introduced
139
+ `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
140
+ `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
141
+
142
+ * `Bundler.environment` is deprecated in favor of `Bundler.load`.
143
+
144
+ We're not sure how people might be using this directly but we have removed the
145
+ `Bundler::Environment` class which was instantiated by `Bundler.environment`
146
+ since we realized the `Bundler::Runtime` class was the same thing. During the
147
+ transition `Bundler.environment` will delegate to `Bundler.load`, which holds
148
+ the reference to the `Bundler::Environment`.
149
+
150
+ #### DSL deprecations
151
+
152
+ The following deprecations in bundler's DSL are meant to prepare for the strict
153
+ source pinning in bundler 3, where the source for every dependency will be
154
+ unambiguously defined.
155
+
156
+ * Multiple global Gemfile sources will no longer be supported.
157
+
158
+ Instead of something like this:
159
+
160
+ ```ruby
161
+ source "https://main_source"
162
+ source "https://another_source"
163
+
164
+ gem "dependency1"
165
+ gem "dependency2"
166
+ ```
167
+
168
+ do something like this:
169
+
170
+ ```ruby
171
+ source "https://main_source"
172
+
173
+ gem "dependency1"
174
+
175
+ source "https://another_source" do
176
+ gem "dependency2"
177
+ end
178
+ ```
179
+
180
+ * Global `path` and `git` sources will no longer be supported.
181
+
182
+ Instead of something like this:
183
+
184
+ ```ruby
185
+ path "/my/path/with/gems"
186
+ git "https://my_git_repo_with_gems"
187
+
188
+ gem "dependency1"
189
+ gem "dependency2"
190
+ ```
191
+
192
+ do something like this:
193
+
194
+ ```ruby
195
+ gem "dependency1", path: "/my/path/with/gems"
196
+ gem "dependency2", git: "https://my_git_repo_with_gems"
197
+ ```
198
+
199
+ or use the block forms if you have multiple gems for each source and you want
200
+ to be a bit DRYer:
201
+
202
+
203
+ ```ruby
204
+ path "/my/path/with/gems" do
205
+ # gem "dependency1"
206
+ # ...
207
+ # gem "dependencyn"
208
+ end
209
+
210
+ git "https://my_git_repo_with_gems" do
211
+ # gem "dependency1"
212
+ # ...
213
+ # gem "dependencyn"
214
+ end
215
+ ```
216
+
217
+ #### Misc deprecations
218
+
219
+ * Deployment helpers for `vlad` and `capistrano` are being removed.
220
+
221
+ These are natural deprecations since the `vlad` tool has had no activity for
222
+ years whereas `capistrano` 3 has built-in Bundler integration in the form of
223
+ the `capistrano-bundler` gem, and everyone using Capistrano 3 should be
224
+ already using that instead. If for some reason, you are still using Capistrano
225
+ 2, feel free to copy the Capistrano tasks out of the Bundler 2 file
226
+ `bundler/deployment.rb` and put them into your app.
227
+
228
+ In general, we don't want to maintain integrations for every deployment system
229
+ out there, so that's why we are removing these.
@@ -14,6 +14,25 @@ require_relative "bundler/constants"
14
14
  require_relative "bundler/current_ruby"
15
15
  require_relative "bundler/build_metadata"
16
16
 
17
+ # Bundler provides a consistent environment for Ruby projects by
18
+ # tracking and installing the exact gems and versions that are needed.
19
+ #
20
+ # Since Ruby 2.6, Bundler is a part of Ruby's standard library.
21
+ #
22
+ # Bunder is used by creating _gemfiles_ listing all the project dependencies
23
+ # and (optionally) their versions and then using
24
+ #
25
+ # require 'bundler/setup'
26
+ #
27
+ # or Bundler.setup to setup environment where only specified gems and their
28
+ # specified versions could be used.
29
+ #
30
+ # See {Bundler website}[https://bundler.io/docs.html] for extensive documentation
31
+ # on gemfiles creation and Bundler usage.
32
+ #
33
+ # As a standard library inside project, Bundler could be used for introspection
34
+ # of loaded and required modules.
35
+ #
17
36
  module Bundler
18
37
  environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
19
38
  ORIGINAL_ENV = environment_preserver.restore
@@ -64,11 +83,11 @@ module Bundler
64
83
  end
65
84
 
66
85
  def ui
67
- (defined?(@ui) && @ui) || (self.ui = UI::Silent.new)
86
+ (defined?(@ui) && @ui) || (self.ui = UI::Shell.new)
68
87
  end
69
88
 
70
89
  def ui=(ui)
71
- Bundler.rubygems.ui = ui ? UI::RGProxy.new(ui) : nil
90
+ Bundler.rubygems.ui = UI::RGProxy.new(ui)
72
91
  @ui = ui
73
92
  end
74
93
 
@@ -91,6 +110,33 @@ module Bundler
91
110
  end
92
111
  end
93
112
 
113
+ # Turns on the Bundler runtime. After +Bundler.setup+ call, all +load+ or
114
+ # +require+ of the gems would be allowed only if they are part of
115
+ # the Gemfile or Ruby's standard library. If the versions specified
116
+ # in Gemfile, only those versions would be loaded.
117
+ #
118
+ # Assuming Gemfile
119
+ #
120
+ # gem 'first_gem', '= 1.0'
121
+ # group :test do
122
+ # gem 'second_gem', '= 1.0'
123
+ # end
124
+ #
125
+ # The code using Bundler.setup works as follows:
126
+ #
127
+ # require 'third_gem' # allowed, required from global gems
128
+ # require 'first_gem' # allowed, loads the last installed version
129
+ # Bundler.setup
130
+ # require 'fourth_gem' # fails with LoadError
131
+ # require 'second_gem' # loads exactly version 1.0
132
+ #
133
+ # +Bundler.setup+ can be called only once, all subsequent calls are no-op.
134
+ #
135
+ # If _groups_ list is provided, only gems from specified groups would
136
+ # be allowed (gems specified outside groups belong to special +:default+ group).
137
+ #
138
+ # To require all gems from Gemfile (or only some groups), see Bundler.require.
139
+ #
94
140
  def setup(*groups)
95
141
  # Return if all groups are already loaded
96
142
  return @setup if defined?(@setup) && @setup
@@ -107,6 +153,24 @@ module Bundler
107
153
  end
108
154
  end
109
155
 
156
+ # Setups Bundler environment (see Bundler.setup) if it is not already set,
157
+ # and loads all gems from groups specified. Unlike ::setup, can be called
158
+ # multiple times with different groups (if they were allowed by setup).
159
+ #
160
+ # Assuming Gemfile
161
+ #
162
+ # gem 'first_gem', '= 1.0'
163
+ # group :test do
164
+ # gem 'second_gem', '= 1.0'
165
+ # end
166
+ #
167
+ # The code will work as follows:
168
+ #
169
+ # Bundler.setup # allow all groups
170
+ # Bundler.require(:default) # requires only first_gem
171
+ # # ...later
172
+ # Bundler.require(:test) # requires second_gem
173
+ #
110
174
  def require(*groups)
111
175
  setup(*groups).require(*groups)
112
176
  end
@@ -116,7 +180,7 @@ module Bundler
116
180
  end
117
181
 
118
182
  def environment
119
- SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
183
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", :print_caller_location => true
120
184
  load
121
185
  end
122
186
 
@@ -167,8 +231,7 @@ module Bundler
167
231
  end
168
232
 
169
233
  if warning
170
- Kernel.send(:require, "etc")
171
- user_home = tmp_home_path(Etc.getlogin, warning)
234
+ user_home = tmp_home_path(warning)
172
235
  Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
173
236
  user_home
174
237
  else
@@ -177,21 +240,6 @@ module Bundler
177
240
  end
178
241
  end
179
242
 
180
- def tmp_home_path(login, warning)
181
- login ||= "unknown"
182
- Kernel.send(:require, "tmpdir")
183
- path = Pathname.new(Dir.tmpdir).join("bundler", "home")
184
- SharedHelpers.filesystem_access(path) do |tmp_home_path|
185
- unless tmp_home_path.exist?
186
- tmp_home_path.mkpath
187
- tmp_home_path.chmod(0o777)
188
- end
189
- tmp_home_path.join(login).tap(&:mkpath)
190
- end
191
- rescue RuntimeError => e
192
- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
193
- end
194
-
195
243
  def user_bundle_path(dir = "home")
196
244
  env_var, fallback = case dir
197
245
  when "home"
@@ -282,7 +330,8 @@ EOF
282
330
  Bundler::SharedHelpers.major_deprecation(
283
331
  2,
284
332
  "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
285
- "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
333
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`",
334
+ :print_caller_location => true
286
335
  )
287
336
 
288
337
  unbundled_env
@@ -321,7 +370,8 @@ EOF
321
370
  Bundler::SharedHelpers.major_deprecation(
322
371
  2,
323
372
  "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
324
- "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
373
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`",
374
+ :print_caller_location => true
325
375
  )
326
376
 
327
377
  with_env(unbundled_env) { yield }
@@ -342,7 +392,8 @@ EOF
342
392
  Bundler::SharedHelpers.major_deprecation(
343
393
  2,
344
394
  "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
345
- "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
395
+ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`",
396
+ :print_caller_location => true
346
397
  )
347
398
 
348
399
  with_env(unbundled_env) { Kernel.system(*args) }
@@ -363,7 +414,8 @@ EOF
363
414
  Bundler::SharedHelpers.major_deprecation(
364
415
  2,
365
416
  "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
366
- "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
417
+ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`",
418
+ :print_caller_location => true
367
419
  )
368
420
 
369
421
  with_env(unbundled_env) { Kernel.exec(*args) }
@@ -608,6 +660,17 @@ EOF
608
660
  Bundler.rubygems.clear_paths
609
661
  end
610
662
 
663
+ def tmp_home_path(warning)
664
+ Kernel.send(:require, "tmpdir")
665
+ SharedHelpers.filesystem_access(Dir.tmpdir) do
666
+ path = Bundler.tmp
667
+ at_exit { Bundler.rm_rf(path) }
668
+ path
669
+ end
670
+ rescue RuntimeError => e
671
+ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
672
+ end
673
+
611
674
  # @param env [Hash]
612
675
  def with_env(env)
613
676
  backup = ENV.to_hash