bundler 2.2.29 → 2.2.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +79 -1
  3. data/README.md +1 -1
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/doctor.rb +3 -2
  6. data/lib/bundler/cli/gem.rb +69 -7
  7. data/lib/bundler/cli/info.rb +16 -4
  8. data/lib/bundler/cli/issue.rb +4 -3
  9. data/lib/bundler/cli/update.rb +2 -2
  10. data/lib/bundler/cli.rb +4 -1
  11. data/lib/bundler/compact_index_client/updater.rb +0 -5
  12. data/lib/bundler/compact_index_client.rb +2 -2
  13. data/lib/bundler/definition.rb +62 -124
  14. data/lib/bundler/digest.rb +71 -0
  15. data/lib/bundler/dsl.rb +18 -3
  16. data/lib/bundler/environment_preserver.rb +4 -1
  17. data/lib/bundler/errors.rb +18 -2
  18. data/lib/bundler/fetcher.rb +2 -1
  19. data/lib/bundler/friendly_errors.rb +5 -30
  20. data/lib/bundler/gem_helper.rb +5 -16
  21. data/lib/bundler/lazy_specification.rb +17 -1
  22. data/lib/bundler/lockfile_parser.rb +1 -0
  23. data/lib/bundler/man/bundle-add.1 +1 -1
  24. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  25. data/lib/bundler/man/bundle-cache.1 +1 -1
  26. data/lib/bundler/man/bundle-check.1 +1 -1
  27. data/lib/bundler/man/bundle-clean.1 +1 -1
  28. data/lib/bundler/man/bundle-config.1 +3 -3
  29. data/lib/bundler/man/bundle-config.1.ronn +2 -2
  30. data/lib/bundler/man/bundle-doctor.1 +1 -1
  31. data/lib/bundler/man/bundle-exec.1 +1 -1
  32. data/lib/bundler/man/bundle-gem.1 +14 -1
  33. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  34. data/lib/bundler/man/bundle-info.1 +1 -1
  35. data/lib/bundler/man/bundle-init.1 +1 -1
  36. data/lib/bundler/man/bundle-inject.1 +1 -1
  37. data/lib/bundler/man/bundle-install.1 +1 -1
  38. data/lib/bundler/man/bundle-list.1 +1 -1
  39. data/lib/bundler/man/bundle-lock.1 +1 -1
  40. data/lib/bundler/man/bundle-open.1 +1 -1
  41. data/lib/bundler/man/bundle-outdated.1 +1 -1
  42. data/lib/bundler/man/bundle-platform.1 +1 -1
  43. data/lib/bundler/man/bundle-pristine.1 +1 -1
  44. data/lib/bundler/man/bundle-remove.1 +1 -1
  45. data/lib/bundler/man/bundle-show.1 +1 -1
  46. data/lib/bundler/man/bundle-update.1 +1 -1
  47. data/lib/bundler/man/bundle-viz.1 +1 -1
  48. data/lib/bundler/man/bundle.1 +1 -1
  49. data/lib/bundler/man/gemfile.5 +27 -1
  50. data/lib/bundler/man/gemfile.5.ronn +8 -0
  51. data/lib/bundler/plugin/api/source.rb +1 -0
  52. data/lib/bundler/resolver.rb +2 -4
  53. data/lib/bundler/rubygems_ext.rb +4 -0
  54. data/lib/bundler/rubygems_gem_installer.rb +20 -4
  55. data/lib/bundler/rubygems_integration.rb +26 -9
  56. data/lib/bundler/runtime.rb +2 -2
  57. data/lib/bundler/shared_helpers.rb +2 -3
  58. data/lib/bundler/source/git/git_proxy.rb +7 -4
  59. data/lib/bundler/source/git.rb +3 -1
  60. data/lib/bundler/source/rubygems.rb +52 -84
  61. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  62. data/lib/bundler/source.rb +1 -1
  63. data/lib/bundler/source_list.rb +7 -29
  64. data/lib/bundler/spec_set.rb +1 -1
  65. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  66. data/lib/bundler/templates/newgem/Rakefile.tt +5 -1
  67. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
  68. data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -12
  69. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  70. data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
  71. data/lib/bundler/vendor/.document +1 -0
  72. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  73. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  74. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  75. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  76. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  77. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  78. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  79. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  80. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  81. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  82. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  83. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  84. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  85. data/lib/bundler/vendored_tsort.rb +4 -0
  86. data/lib/bundler/version.rb +1 -1
  87. data/lib/bundler/worker.rb +2 -2
  88. data/lib/bundler.rb +2 -1
  89. metadata +20 -7
  90. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CONFIG" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-CONFIG" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-config\fR \- Set bundler configuration options
@@ -462,13 +462,13 @@ export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x\-oauth\-basic
462
462
  .IP "" 0
463
463
  .
464
464
  .P
465
- Note that any configured credentials will be redacted by informative commands such as \fBbundle config list\fR or \fBbundle config get\fR, unless you use the \fB\-\-parseable\fR flag\. This is to avoid unintentially leaking credentials when copy\-pasting bundler output\.
465
+ Note that any configured credentials will be redacted by informative commands such as \fBbundle config list\fR or \fBbundle config get\fR, unless you use the \fB\-\-parseable\fR flag\. This is to avoid unintentionally leaking credentials when copy\-pasting bundler output\.
466
466
  .
467
467
  .P
468
468
  Also note that to guarantee a sane mapping between valid environment variable names and valid host names, bundler makes the following transformations:
469
469
  .
470
470
  .IP "\(bu" 4
471
- Any \fB\-\fR characters in a host name are mapped to a triple dash (\fB___\fR) in the corresponding enviroment variable\.
471
+ Any \fB\-\fR characters in a host name are mapped to a triple dash (\fB___\fR) in the corresponding environment variable\.
472
472
  .
473
473
  .IP "\(bu" 4
474
474
  Any \fB\.\fR characters in a host name are mapped to a double dash (\fB__\fR) in the corresponding environment variable\.
@@ -367,14 +367,14 @@ where you can use personal OAuth tokens:
367
367
 
368
368
  Note that any configured credentials will be redacted by informative commands
369
369
  such as `bundle config list` or `bundle config get`, unless you use the
370
- `--parseable` flag. This is to avoid unintentially leaking credentials when
370
+ `--parseable` flag. This is to avoid unintentionally leaking credentials when
371
371
  copy-pasting bundler output.
372
372
 
373
373
  Also note that to guarantee a sane mapping between valid environment variable
374
374
  names and valid host names, bundler makes the following transformations:
375
375
 
376
376
  * Any `-` characters in a host name are mapped to a triple dash (`___`) in the
377
- corresponding enviroment variable.
377
+ corresponding environment variable.
378
378
 
379
379
  * Any `.` characters in a host name are mapped to a double dash (`__`) in the
380
380
  corresponding environment variable.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-DOCTOR" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-DOCTOR" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-doctor\fR \- Checks the bundle for common problems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-EXEC" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-EXEC" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-exec\fR \- Execute a command in the context of the bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-GEM" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-GEM" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
@@ -90,6 +90,19 @@ When Bundler is configured to not generate CI files, an interactive prompt will
90
90
  When Bundler is unconfigured, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
91
91
  .
92
92
  .TP
93
+ \fB\-\-linter\fR, \fB\-\-linter=rubocop\fR, \fB\-\-linter=standard\fR
94
+ Specify the linter and code formatter that Bundler should add to the project\'s development dependencies\. Acceptable values are \fBrubocop\fR and \fBstandard\fR\. A configuration file will be generated in the project directory\. Given no option is specified:
95
+ .
96
+ .IP
97
+ When Bundler is configured to add a linter, this defaults to Bundler\'s global config setting \fBgem\.linter\fR\.
98
+ .
99
+ .IP
100
+ When Bundler is configured not to add a linter, an interactive prompt will be displayed and the answer will be used for the current rubygem project\.
101
+ .
102
+ .IP
103
+ When Bundler is unconfigured, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
104
+ .
105
+ .TP
93
106
  \fB\-e\fR, \fB\-\-edit[=EDITOR]\fR
94
107
  Open the resulting GEM_NAME\.gemspec in EDITOR, or the default editor if not specified\. The default is \fB$BUNDLER_EDITOR\fR, \fB$VISUAL\fR, or \fB$EDITOR\fR\.
95
108
  .
@@ -92,6 +92,22 @@ configuration file using the following names:
92
92
  the answer will be saved in Bundler's global config for future `bundle gem`
93
93
  use.
94
94
 
95
+ * `--linter`, `--linter=rubocop`, `--linter=standard`:
96
+ Specify the linter and code formatter that Bundler should add to the
97
+ project's development dependencies. Acceptable values are `rubocop` and
98
+ `standard`. A configuration file will be generated in the project directory.
99
+ Given no option is specified:
100
+
101
+ When Bundler is configured to add a linter, this defaults to Bundler's
102
+ global config setting `gem.linter`.
103
+
104
+ When Bundler is configured not to add a linter, an interactive prompt
105
+ will be displayed and the answer will be used for the current rubygem project.
106
+
107
+ When Bundler is unconfigured, an interactive prompt will be displayed and
108
+ the answer will be saved in Bundler's global config for future `bundle gem`
109
+ use.
110
+
95
111
  * `-e`, `--edit[=EDITOR]`:
96
112
  Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not
97
113
  specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INFO" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-INFO" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-info\fR \- Show information for the given gem in your bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INIT" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-INIT" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-init\fR \- Generates a Gemfile into the current working directory
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INJECT" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-INJECT" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INSTALL" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-INSTALL" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-LIST" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-LIST" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-list\fR \- List all the gems in the bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-LOCK" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-LOCK" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-OPEN" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-OPEN" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-OUTDATED" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-OUTDATED" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-outdated\fR \- List installed gems with newer versions available
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-PLATFORM" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-PLATFORM" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-platform\fR \- Displays platform compatibility information
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-PRISTINE" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-PRISTINE" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-REMOVE" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-REMOVE" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-SHOW" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-SHOW" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-UPDATE" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-UPDATE" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-update\fR \- Update your gems to the latest available versions
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-VIZ" "1" "June 2021" "" ""
4
+ .TH "BUNDLE\-VIZ" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE" "1" "June 2021" "" ""
4
+ .TH "BUNDLE" "1" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\fR \- Ruby Dependency Management
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GEMFILE" "5" "June 2021" "" ""
4
+ .TH "GEMFILE" "5" "December 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -506,6 +506,32 @@ gem "rails", :git => "git://github\.com/rails/rails\.git"
506
506
  .P
507
507
  Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
508
508
  .
509
+ .P
510
+ You can also directly pass a pull request URL:
511
+ .
512
+ .IP "" 4
513
+ .
514
+ .nf
515
+
516
+ gem "rails", :github => "https://github\.com/rails/rails/pull/43753"
517
+ .
518
+ .fi
519
+ .
520
+ .IP "" 0
521
+ .
522
+ .P
523
+ Which is equivalent to:
524
+ .
525
+ .IP "" 4
526
+ .
527
+ .nf
528
+
529
+ gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head"
530
+ .
531
+ .fi
532
+ .
533
+ .IP "" 0
534
+ .
509
535
  .SS "GIST"
510
536
  If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
511
537
  .
@@ -372,6 +372,14 @@ Are both equivalent to
372
372
 
373
373
  Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
374
374
 
375
+ You can also directly pass a pull request URL:
376
+
377
+ gem "rails", :github => "https://github.com/rails/rails/pull/43753"
378
+
379
+ Which is equivalent to:
380
+
381
+ gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head"
382
+
375
383
  ### GIST
376
384
 
377
385
  If the git repository you want to use is hosted as a Github Gist and is public, you can use
@@ -283,6 +283,7 @@ module Bundler
283
283
  def to_s
284
284
  "plugin source for #{@type} with uri #{@uri}"
285
285
  end
286
+ alias_method :identifier, :to_s
286
287
 
287
288
  # Note: Do not override if you don't know what you are doing.
288
289
  def include?(other)
@@ -30,10 +30,8 @@ module Bundler
30
30
  @resolver = Molinillo::Resolver.new(self, self)
31
31
  @search_for = {}
32
32
  @base_dg = Molinillo::DependencyGraph.new
33
- aggregate_global_source = @source_requirements[:default].is_a?(Source::RubygemsAggregate)
34
33
  @base.each do |ls|
35
34
  dep = Dependency.new(ls.name, ls.version)
36
- ls.source = source_for(ls.name) unless aggregate_global_source
37
35
  @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
38
36
  end
39
37
  additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
@@ -272,7 +270,7 @@ module Bundler
272
270
  rescue GemfileNotFound
273
271
  nil
274
272
  end
275
- message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source.to_err}#{cache_message}.\n")
273
+ message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
276
274
  message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
277
275
  end
278
276
  raise GemNotFound, message
@@ -371,7 +369,7 @@ module Bundler
371
369
  o << if metadata_requirement
372
370
  "is not available in #{relevant_source}"
373
371
  else
374
- "in #{relevant_source.to_err}.\n"
372
+ "in #{relevant_source}.\n"
375
373
  end
376
374
  end
377
375
  end,
@@ -85,6 +85,10 @@ module Gem
85
85
  dependencies - development_dependencies
86
86
  end
87
87
 
88
+ def deleted_gem?
89
+ !default_gem? && !File.directory?(full_gem_path)
90
+ end
91
+
88
92
  private
89
93
 
90
94
  def dependencies_to_gemfile(dependencies, group = nil)
@@ -16,10 +16,12 @@ module Bundler
16
16
  spec.loaded_from = spec_file
17
17
 
18
18
  # Completely remove any previous gem files
19
- FileUtils.rm_rf gem_dir
20
- FileUtils.rm_rf spec.extension_dir
19
+ strict_rm_rf gem_dir
20
+ strict_rm_rf spec.extension_dir
21
21
 
22
- FileUtils.mkdir_p gem_dir, :mode => 0o755
22
+ SharedHelpers.filesystem_access(gem_dir, :create) do
23
+ FileUtils.mkdir_p gem_dir, :mode => 0o755
24
+ end
23
25
 
24
26
  extract_files
25
27
 
@@ -31,7 +33,10 @@ module Bundler
31
33
  generate_plugins
32
34
 
33
35
  write_spec
34
- write_cache_file
36
+
37
+ SharedHelpers.filesystem_access("#{gem_home}/cache", :write) do
38
+ write_cache_file
39
+ end
35
40
 
36
41
  say spec.post_install_message unless spec.post_install_message.nil?
37
42
 
@@ -87,6 +92,17 @@ module Bundler
87
92
 
88
93
  private
89
94
 
95
+ def strict_rm_rf(dir)
96
+ # FileUtils.rm_rf should probably rise in case of permission issues like
97
+ # `rm -rf` does. However, it fails to delete the folder silently due to
98
+ # https://github.com/ruby/fileutils/issues/57. It should probably be fixed
99
+ # inside `fileutils` but for now I`m checking whether the folder was
100
+ # removed after it completes, and raising otherwise.
101
+ FileUtils.rm_rf dir
102
+
103
+ raise PermissionError.new(dir, :delete) if File.directory?(dir)
104
+ end
105
+
90
106
  def validate_bundler_checksum(checksum)
91
107
  return true if Bundler.settings[:disable_checksum_validation]
92
108
  return true unless checksum
@@ -86,16 +86,12 @@ module Bundler
86
86
  def spec_missing_extensions?(spec, default = true)
87
87
  return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)
88
88
 
89
- return false if spec_default_gem?(spec)
89
+ return false if spec.default_gem?
90
90
  return false if spec.extensions.empty?
91
91
 
92
92
  default
93
93
  end
94
94
 
95
- def spec_default_gem?(spec)
96
- spec.respond_to?(:default_gem?) && spec.default_gem?
97
- end
98
-
99
95
  def spec_matches_for_glob(spec, glob)
100
96
  return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
101
97
 
@@ -504,14 +500,15 @@ module Bundler
504
500
  end
505
501
 
506
502
  def fetch_specs(remote, name)
503
+ require "rubygems/remote_fetcher"
507
504
  path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
508
505
  fetcher = gem_remote_fetcher
509
506
  fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
510
507
  string = fetcher.fetch_path(path)
511
508
  Bundler.load_marshal(string)
512
- rescue Gem::RemoteFetcher::FetchError => e
509
+ rescue Gem::RemoteFetcher::FetchError
513
510
  # it's okay for prerelease to fail
514
- raise e unless name == "prerelease_specs"
511
+ raise unless name == "prerelease_specs"
515
512
  end
516
513
 
517
514
  def fetch_all_remote_specs(remote)
@@ -521,12 +518,32 @@ module Bundler
521
518
  specs.concat(pres)
522
519
  end
523
520
 
524
- def download_gem(spec, uri, path)
521
+ def download_gem(spec, uri, cache_dir)
522
+ require "rubygems/remote_fetcher"
525
523
  uri = Bundler.settings.mirror_for(uri)
526
524
  fetcher = gem_remote_fetcher
527
525
  fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
528
526
  Bundler::Retry.new("download gem from #{uri}").attempts do
529
- fetcher.download(spec, uri, path)
527
+ gem_file_name = spec.file_name
528
+ local_gem_path = File.join cache_dir, gem_file_name
529
+ return if File.exist? local_gem_path
530
+
531
+ begin
532
+ remote_gem_path = uri + "gems/#{gem_file_name}"
533
+ remote_gem_path = remote_gem_path.to_s if provides?("< 3.2.0.rc.1")
534
+
535
+ SharedHelpers.filesystem_access(local_gem_path) do
536
+ fetcher.cache_update_path remote_gem_path, local_gem_path
537
+ end
538
+ rescue Gem::RemoteFetcher::FetchError
539
+ raise if spec.original_platform == spec.platform
540
+
541
+ original_gem_file_name = "#{spec.original_name}.gem"
542
+ raise if gem_file_name == original_gem_file_name
543
+
544
+ gem_file_name = original_gem_file_name
545
+ retry
546
+ end
530
547
  end
531
548
  rescue Gem::RemoteFetcher::FetchError => e
532
549
  raise Bundler::HTTPError, "Could not download gem from #{uri} due to underlying error <#{e.message}>"
@@ -265,7 +265,7 @@ module Bundler
265
265
 
266
266
  return if manuals.empty?
267
267
  Bundler::SharedHelpers.set_env "MANPATH", manuals.concat(
268
- ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR)
268
+ ENV["MANPATH"] ? ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR) : [""]
269
269
  ).uniq.join(File::PATH_SEPARATOR)
270
270
  end
271
271
 
@@ -291,7 +291,7 @@ module Bundler
291
291
  return unless activated_spec = Bundler.rubygems.loaded_specs(spec.name)
292
292
  return if activated_spec.version == spec.version
293
293
 
294
- suggestion = if Bundler.rubygems.spec_default_gem?(activated_spec)
294
+ suggestion = if activated_spec.default_gem?
295
295
  "Since #{spec.name} is a default gem, you can either remove your dependency on it" \
296
296
  " or try updating to a newer version of bundler that supports #{spec.name} as a default gem."
297
297
  else
@@ -320,12 +320,11 @@ module Bundler
320
320
  end
321
321
 
322
322
  def clean_load_path
323
- bundler_lib = bundler_ruby_lib
324
-
325
323
  loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
326
324
 
327
325
  $LOAD_PATH.reject! do |p|
328
- next if resolve_path(p).start_with?(bundler_lib)
326
+ resolved_path = resolve_path(p)
327
+ next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
329
328
  loaded_gem_paths.delete(p)
330
329
  end
331
330
  $LOAD_PATH.uniq!
@@ -56,7 +56,6 @@ module Bundler
56
56
  @ref = ref
57
57
  @revision = revision
58
58
  @git = git
59
- raise GitNotInstalledError.new if allow? && !Bundler.git_present?
60
59
  end
61
60
 
62
61
  def revision
@@ -96,12 +95,12 @@ module Bundler
96
95
  SharedHelpers.filesystem_access(path.dirname) do |p|
97
96
  FileUtils.mkdir_p(p)
98
97
  end
99
- git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
98
+ git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
100
99
  return unless extra_ref
101
100
  end
102
101
 
103
102
  with_path do
104
- git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
103
+ git_retry(*["fetch", "--force", "--quiet", "--tags", "--", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
105
104
  end
106
105
  end
107
106
 
@@ -208,7 +207,11 @@ module Bundler
208
207
  end
209
208
 
210
209
  def allow?
211
- @git ? @git.allow_git_ops? : true
210
+ allowed = @git ? @git.allow_git_ops? : true
211
+
212
+ raise GitNotInstalledError.new if allowed && !Bundler.git_present?
213
+
214
+ allowed
212
215
  end
213
216
 
214
217
  def with_path(&blk)
@@ -307,7 +307,9 @@ module Bundler
307
307
  # If there is no URI scheme, assume it is an ssh/git URI
308
308
  input = uri
309
309
  end
310
- SharedHelpers.digest(:SHA1).hexdigest(input)
310
+ # We use SHA1 here for historical reason and to preserve backward compatibility.
311
+ # But a transition to a simpler mangling algorithm would be welcome.
312
+ Bundler::Digest.sha1(input)
311
313
  end
312
314
 
313
315
  def cached_revision