bundler 2.2.26 → 2.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +501 -1
  3. data/README.md +1 -1
  4. data/bundler.gemspec +6 -8
  5. data/exe/bundle +7 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -3
  9. data/lib/bundler/cli/check.rb +1 -1
  10. data/lib/bundler/cli/common.rb +3 -2
  11. data/lib/bundler/cli/config.rb +10 -1
  12. data/lib/bundler/cli/doctor.rb +12 -3
  13. data/lib/bundler/cli/gem.rb +98 -9
  14. data/lib/bundler/cli/info.rb +27 -6
  15. data/lib/bundler/cli/init.rb +5 -1
  16. data/lib/bundler/cli/install.rb +13 -30
  17. data/lib/bundler/cli/issue.rb +4 -3
  18. data/lib/bundler/cli/outdated.rb +12 -3
  19. data/lib/bundler/cli/platform.rb +2 -2
  20. data/lib/bundler/cli/remove.rb +1 -2
  21. data/lib/bundler/cli/show.rb +1 -1
  22. data/lib/bundler/cli/update.rb +8 -4
  23. data/lib/bundler/cli.rb +23 -19
  24. data/lib/bundler/compact_index_client/cache.rb +0 -9
  25. data/lib/bundler/compact_index_client/updater.rb +16 -8
  26. data/lib/bundler/compact_index_client.rb +2 -8
  27. data/lib/bundler/current_ruby.rb +16 -6
  28. data/lib/bundler/definition.rb +204 -217
  29. data/lib/bundler/dependency.rb +23 -71
  30. data/lib/bundler/digest.rb +71 -0
  31. data/lib/bundler/dsl.rb +28 -45
  32. data/lib/bundler/endpoint_specification.rb +19 -13
  33. data/lib/bundler/env.rb +1 -1
  34. data/lib/bundler/environment_preserver.rb +4 -1
  35. data/lib/bundler/errors.rb +28 -2
  36. data/lib/bundler/feature_flag.rb +0 -1
  37. data/lib/bundler/fetcher/base.rb +6 -8
  38. data/lib/bundler/fetcher/compact_index.rb +9 -14
  39. data/lib/bundler/fetcher/index.rb +0 -26
  40. data/lib/bundler/fetcher.rb +20 -22
  41. data/lib/bundler/friendly_errors.rb +26 -34
  42. data/lib/bundler/gem_helper.rb +7 -18
  43. data/lib/bundler/gem_helpers.rb +9 -2
  44. data/lib/bundler/gem_version_promoter.rb +14 -25
  45. data/lib/bundler/index.rb +10 -40
  46. data/lib/bundler/injector.rb +16 -2
  47. data/lib/bundler/inline.rb +2 -12
  48. data/lib/bundler/installer/gem_installer.rb +13 -5
  49. data/lib/bundler/installer/standalone.rb +30 -3
  50. data/lib/bundler/installer.rb +18 -29
  51. data/lib/bundler/lazy_specification.rb +52 -35
  52. data/lib/bundler/lockfile_generator.rb +2 -2
  53. data/lib/bundler/lockfile_parser.rb +12 -10
  54. data/lib/bundler/man/bundle-add.1 +21 -5
  55. data/lib/bundler/man/bundle-add.1.ronn +16 -4
  56. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  57. data/lib/bundler/man/bundle-cache.1 +7 -1
  58. data/lib/bundler/man/bundle-cache.1.ronn +7 -0
  59. data/lib/bundler/man/bundle-check.1 +1 -1
  60. data/lib/bundler/man/bundle-clean.1 +2 -2
  61. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  62. data/lib/bundler/man/bundle-config.1 +33 -14
  63. data/lib/bundler/man/bundle-config.1.ronn +30 -18
  64. data/lib/bundler/man/bundle-console.1 +53 -0
  65. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  66. data/lib/bundler/man/bundle-doctor.1 +1 -1
  67. data/lib/bundler/man/bundle-exec.1 +2 -2
  68. data/lib/bundler/man/bundle-exec.1.ronn +1 -1
  69. data/lib/bundler/man/bundle-gem.1 +14 -1
  70. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  71. data/lib/bundler/man/bundle-help.1 +13 -0
  72. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  73. data/lib/bundler/man/bundle-info.1 +1 -1
  74. data/lib/bundler/man/bundle-init.1 +1 -1
  75. data/lib/bundler/man/bundle-inject.1 +5 -2
  76. data/lib/bundler/man/bundle-inject.1.ronn +3 -1
  77. data/lib/bundler/man/bundle-install.1 +6 -2
  78. data/lib/bundler/man/bundle-install.1.ronn +8 -2
  79. data/lib/bundler/man/bundle-list.1 +1 -1
  80. data/lib/bundler/man/bundle-lock.1 +1 -1
  81. data/lib/bundler/man/bundle-open.1 +1 -1
  82. data/lib/bundler/man/bundle-outdated.1 +3 -10
  83. data/lib/bundler/man/bundle-outdated.1.ronn +1 -10
  84. data/lib/bundler/man/bundle-platform.1 +16 -6
  85. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  86. data/lib/bundler/man/bundle-plugin.1 +81 -0
  87. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  88. data/lib/bundler/man/bundle-pristine.1 +1 -1
  89. data/lib/bundler/man/bundle-remove.1 +1 -1
  90. data/lib/bundler/man/bundle-show.1 +1 -1
  91. data/lib/bundler/man/bundle-update.1 +2 -2
  92. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  93. data/lib/bundler/man/bundle-version.1 +35 -0
  94. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  95. data/lib/bundler/man/bundle-viz.1 +4 -1
  96. data/lib/bundler/man/bundle-viz.1.ronn +2 -0
  97. data/lib/bundler/man/bundle.1 +15 -10
  98. data/lib/bundler/man/bundle.1.ronn +12 -7
  99. data/lib/bundler/man/gemfile.5 +117 -80
  100. data/lib/bundler/man/gemfile.5.ronn +105 -84
  101. data/lib/bundler/man/index.txt +4 -0
  102. data/lib/bundler/match_metadata.rb +13 -0
  103. data/lib/bundler/match_platform.rb +0 -1
  104. data/lib/bundler/match_remote_metadata.rb +29 -0
  105. data/lib/bundler/plugin/api/source.rb +4 -9
  106. data/lib/bundler/plugin/installer/git.rb +0 -4
  107. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  108. data/lib/bundler/plugin/installer.rb +3 -1
  109. data/lib/bundler/plugin.rb +25 -6
  110. data/lib/bundler/process_lock.rb +1 -1
  111. data/lib/bundler/remote_specification.rb +10 -4
  112. data/lib/bundler/resolver/base.rb +50 -0
  113. data/lib/bundler/resolver/spec_group.rb +31 -49
  114. data/lib/bundler/resolver.rb +183 -192
  115. data/lib/bundler/ruby_dsl.rb +1 -1
  116. data/lib/bundler/ruby_version.rb +5 -18
  117. data/lib/bundler/rubygems_ext.rb +138 -20
  118. data/lib/bundler/rubygems_gem_installer.rb +42 -16
  119. data/lib/bundler/rubygems_integration.rb +42 -90
  120. data/lib/bundler/runtime.rb +2 -3
  121. data/lib/bundler/self_manager.rb +168 -0
  122. data/lib/bundler/settings.rb +13 -4
  123. data/lib/bundler/shared_helpers.rb +15 -24
  124. data/lib/bundler/source/git/git_proxy.rb +7 -4
  125. data/lib/bundler/source/git.rb +29 -13
  126. data/lib/bundler/source/metadata.rb +3 -3
  127. data/lib/bundler/source/path.rb +1 -1
  128. data/lib/bundler/source/rubygems.rb +148 -161
  129. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  130. data/lib/bundler/source.rb +6 -5
  131. data/lib/bundler/source_list.rb +15 -29
  132. data/lib/bundler/source_map.rb +15 -2
  133. data/lib/bundler/spec_set.rb +52 -32
  134. data/lib/bundler/stub_specification.rb +5 -3
  135. data/lib/bundler/templates/Executable +2 -4
  136. data/lib/bundler/templates/Executable.bundler +2 -2
  137. data/lib/bundler/templates/Executable.standalone +2 -4
  138. data/lib/bundler/templates/Gemfile +0 -2
  139. data/lib/bundler/templates/gems.rb +0 -3
  140. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  141. data/lib/bundler/templates/newgem/README.md.tt +3 -9
  142. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  143. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +5 -4
  144. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
  145. data/lib/bundler/templates/newgem/newgem.gemspec.tt +16 -16
  146. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  147. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  148. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  149. data/lib/bundler/ui/shell.rb +1 -1
  150. data/lib/bundler/vendor/.document +1 -0
  151. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  152. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  153. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  154. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  155. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  156. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  157. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  158. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -3
  159. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +32 -26
  160. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  161. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  162. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  163. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  164. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  165. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  166. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  167. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  168. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  169. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  170. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  171. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  172. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  173. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  174. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  175. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  176. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  177. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  178. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  179. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  180. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  181. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  182. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  183. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  184. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  185. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  186. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  187. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  188. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  189. data/lib/bundler/vendored_tsort.rb +4 -0
  190. data/lib/bundler/version.rb +1 -1
  191. data/lib/bundler/worker.rb +2 -2
  192. data/lib/bundler.rb +40 -29
  193. metadata +37 -12
  194. data/lib/bundler/dep_proxy.rb +0 -55
  195. data/lib/bundler/gemdeps.rb +0 -29
  196. data/lib/bundler/psyched_yaml.rb +0 -22
  197. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -15,23 +15,28 @@ directory as the `Rakefile`.
15
15
  A `Gemfile` is evaluated as Ruby code, in a context which makes available
16
16
  a number of methods used to describe the gem requirements.
17
17
 
18
- ## GLOBAL SOURCES
18
+ ## GLOBAL SOURCE
19
19
 
20
- At the top of the `Gemfile`, add a line for the `Rubygems` source that contains
21
- the gems listed in the `Gemfile`.
20
+ At the top of the `Gemfile`, add a single line for the `RubyGems` source that
21
+ contains the gems listed in the `Gemfile`.
22
22
 
23
23
  source "https://rubygems.org"
24
24
 
25
- It is possible, but not recommended as of Bundler 1.7, to add multiple global
26
- `source` lines. Each of these `source`s `MUST` be a valid Rubygems repository.
25
+ You can add only one global source. In Bundler 1.13, adding multiple global
26
+ sources was deprecated. The `source` `MUST` be a valid RubyGems repository.
27
27
 
28
- Sources are checked for gems following the heuristics described in
29
- [SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler
28
+ To use more than one source of RubyGems, you should use [`source` block
29
+ ](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
30
+
31
+ A source is checked for gems following the heuristics described in
32
+ [SOURCE PRIORITY][].
33
+
34
+ **Note about a behavior of the feature deprecated in Bundler 1.13**:
35
+ If a gem is found in more than one global source, Bundler
30
36
  will print a warning after installing the gem indicating which source was used,
31
37
  and listing the other sources where the gem is available. A specific source can
32
38
  be selected for gems that need to use a non-standard repository, suppressing
33
- this warning, by using the [`:source` option](#SOURCE) or a
34
- [`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
39
+ this warning, by using the [`:source` option](#SOURCE) or `source` block.
35
40
 
36
41
  ### CREDENTIALS
37
42
 
@@ -59,10 +64,10 @@ All parameters are `OPTIONAL` unless otherwise specified.
59
64
  ### VERSION (required)
60
65
 
61
66
  The version of Ruby that your application requires. If your application
62
- requires an alternate Ruby engine, such as JRuby, Rubinius or TruffleRuby, this
67
+ requires an alternate Ruby engine, such as JRuby, TruffleRuby, etc., this
63
68
  should be the Ruby version that the engine is compatible with.
64
69
 
65
- ruby "1.9.3"
70
+ ruby "3.1.2"
66
71
 
67
72
  ### ENGINE
68
73
 
@@ -81,9 +86,10 @@ What exactly is an Engine?
81
86
 
82
87
  - [Other implementations](https://www.ruby-lang.org/en/about/) of Ruby exist.
83
88
  Some of the more well-known implementations include
84
- [Rubinius](https://rubinius.com/), and [JRuby](http://jruby.org/).
89
+ [JRuby](http://jruby.org/) and [TruffleRuby](https://www.graalvm.org/ruby/).
85
90
  Rubinius is an alternative implementation of Ruby written in Ruby.
86
91
  JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine.
92
+ TruffleRuby is a Ruby implementation on the GraalVM, a language toolkit built on the JVM.
87
93
 
88
94
  ### ENGINE VERSION
89
95
 
@@ -91,13 +97,17 @@ Each application _may_ specify a Ruby engine version. If an engine version is
91
97
  specified, an engine _must_ also be specified. If the engine is "ruby" the
92
98
  engine version specified _must_ match the Ruby version.
93
99
 
94
- ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
100
+ ruby "2.6.8", engine: "jruby", engine_version: "9.3.8.0"
95
101
 
96
102
  ### PATCHLEVEL
97
103
 
98
- Each application _may_ specify a Ruby patchlevel.
104
+ Each application _may_ specify a Ruby patchlevel. Specifying the patchlevel has
105
+ been meaningless since Ruby 2.1.0 was released as the patchlevel is now
106
+ uniquely determined by a combination of major, minor, and teeny version numbers.
107
+
108
+ This option was implemented in Bundler 1.4.0 for Ruby 2.0 or earlier.
99
109
 
100
- ruby "2.0.0", :patchlevel => "247"
110
+ ruby "3.1.2", patchlevel: "20"
101
111
 
102
112
  ## GEMS
103
113
 
@@ -124,23 +134,23 @@ Each _gem_ `MAY` specify files that should be used when autorequiring via
124
134
  you want `required` has the same name as _gem_ or `false` to
125
135
  prevent any file from being autorequired.
126
136
 
127
- gem "redis", :require => ["redis/connection/hiredis", "redis"]
128
- gem "webmock", :require => false
129
- gem "byebug", :require => true
137
+ gem "redis", require: ["redis/connection/hiredis", "redis"]
138
+ gem "webmock", require: false
139
+ gem "byebug", require: true
130
140
 
131
141
  The argument defaults to the name of the gem. For example, these are identical:
132
142
 
133
143
  gem "nokogiri"
134
- gem "nokogiri", :require => "nokogiri"
135
- gem "nokogiri", :require => true
144
+ gem "nokogiri", require: "nokogiri"
145
+ gem "nokogiri", require: true
136
146
 
137
147
  ### GROUPS
138
148
 
139
149
  Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
140
150
  not specify membership in any group is placed in the `default` group.
141
151
 
142
- gem "rspec", :group => :test
143
- gem "wirble", :groups => [:development, :test]
152
+ gem "rspec", group: :test
153
+ gem "wirble", groups: [:development, :test]
144
154
 
145
155
  The Bundler runtime allows its two main methods, `Bundler.setup` and
146
156
  `Bundler.require`, to limit their impact to particular groups.
@@ -185,70 +195,71 @@ platforms.
185
195
  There are a number of `Gemfile` platforms:
186
196
 
187
197
  * `ruby`:
188
- C Ruby (MRI), Rubinius or TruffleRuby, but `NOT` Windows
198
+ C Ruby (MRI), Rubinius, or TruffleRuby, but not Windows
189
199
  * `mri`:
190
- Same as _ruby_, but only C Ruby (MRI)
191
- * `mingw`:
192
- Windows 32 bit 'mingw32' platform (aka RubyInstaller)
193
- * `x64_mingw`:
194
- Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
200
+ C Ruby (MRI) only, but not Windows
201
+ * `windows`:
202
+ Windows C Ruby (MRI), including RubyInstaller 32-bit and 64-bit versions
203
+ * `mswin`:
204
+ Windows C Ruby (MRI), including RubyInstaller 32-bit versions
205
+ * `mswin64`:
206
+ Windows C Ruby (MRI), including RubyInstaller 64-bit versions
195
207
  * `rbx`:
196
208
  Rubinius
197
209
  * `jruby`:
198
210
  JRuby
199
211
  * `truffleruby`:
200
212
  TruffleRuby
201
- * `mswin`:
202
- Windows
203
213
 
204
- You can restrict further by platform and version for all platforms *except* for
205
- `rbx`, `jruby`, `truffleruby` and `mswin`.
214
+ On platforms `ruby`, `mri`, `mswin`, `mswin64`, and `windows`, you may
215
+ additionally specify a version by appending the major and minor version numbers
216
+ without a delimiter. For example, to specify that a gem should only be used on
217
+ platform `ruby` version 3.1, use:
206
218
 
207
- To specify a version in addition to a platform, append the version number without
208
- the delimiter to the platform. For example, to specify that a gem should only be
209
- used on platforms with Ruby 2.3, use:
210
-
211
- ruby_23
212
-
213
- The full list of platforms and supported versions includes:
214
-
215
- * `ruby`:
216
- 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
217
- * `mri`:
218
- 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
219
- * `mingw`:
220
- 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
221
- * `x64_mingw`:
222
- 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
219
+ ruby_31
223
220
 
224
- As with groups, you can specify one or more platforms:
221
+ As with groups (above), you may specify one or more platforms:
225
222
 
226
- gem "weakling", :platforms => :jruby
227
- gem "ruby-debug", :platforms => :mri_18
228
- gem "nokogiri", :platforms => [:mri_18, :jruby]
223
+ gem "weakling", platforms: :jruby
224
+ gem "ruby-debug", platforms: :mri_31
225
+ gem "nokogiri", platforms: [:windows_31, :jruby]
229
226
 
230
227
  All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`,
231
228
  `Bundler.require`) behave exactly the same as if any groups not
232
229
  matching the current platform were explicitly excluded.
233
230
 
231
+ ### FORCE_RUBY_PLATFORM
232
+
233
+ If you always want the pure ruby variant of a gem to be chosen over platform
234
+ specific variants, you can use the `force_ruby_platform` option:
235
+
236
+ gem "ffi", force_ruby_platform: true
237
+
238
+ This can be handy (assuming the pure ruby variant works fine) when:
239
+
240
+ * You're having issues with the platform specific variant.
241
+ * The platform specific variant does not yet support a newer ruby (and thus has
242
+ a `required_ruby_version` upper bound), but you still want your Gemfile{.lock}
243
+ files to resolve under that ruby.
244
+
234
245
  ### SOURCE
235
246
 
236
- You can select an alternate Rubygems repository for a gem using the ':source'
247
+ You can select an alternate RubyGems repository for a gem using the ':source'
237
248
  option.
238
249
 
239
- gem "some_internal_gem", :source => "https://gems.example.com"
250
+ gem "some_internal_gem", source: "https://gems.example.com"
240
251
 
241
- This forces the gem to be loaded from this source and ignores any global sources
252
+ This forces the gem to be loaded from this source and ignores the global source
242
253
  declared at the top level of the file. If the gem does not exist in this source,
243
254
  it will not be installed.
244
255
 
245
256
  Bundler will search for child dependencies of this gem by first looking in the
246
257
  source selected for the parent, but if they are not found there, it will fall
247
- back on global sources using the ordering described in [SOURCE PRIORITY][].
258
+ back on the global source.
248
259
 
260
+ **Note about a behavior of the feature deprecated in Bundler 1.13**:
249
261
  Selecting a specific source repository this way also suppresses the ambiguous
250
- gem warning described above in
251
- [GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
262
+ gem warning described above in [GLOBAL SOURCE](#GLOBAL-SOURCE).
252
263
 
253
264
  Using the `:source` option for an individual gem will also make that source
254
265
  available as a possible global source for any other gems which do not specify
@@ -263,11 +274,11 @@ git repository using the `:git` parameter. The repository can be accessed via
263
274
  several protocols:
264
275
 
265
276
  * `HTTP(S)`:
266
- gem "rails", :git => "https://github.com/rails/rails.git"
277
+ gem "rails", git: "https://github.com/rails/rails.git"
267
278
  * `SSH`:
268
- gem "rails", :git => "git@github.com:rails/rails.git"
279
+ gem "rails", git: "git@github.com:rails/rails.git"
269
280
  * `git`:
270
- gem "rails", :git => "git://github.com/rails/rails.git"
281
+ gem "rails", git: "git://github.com/rails/rails.git"
271
282
 
272
283
  If using SSH, the user that you use to run `bundle install` `MUST` have the
273
284
  appropriate keys available in their `$HOME/.ssh`.
@@ -295,7 +306,7 @@ to, a version specifier, if provided, means that the git repository is
295
306
  only valid if the `.gemspec` specifies a version matching the version
296
307
  specifier. If not, bundler will print a warning.
297
308
 
298
- gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
309
+ gem "rails", "2.3.8", git: "https://github.com/rails/rails.git"
299
310
  # bundle install will fail, because the .gemspec in the rails
300
311
  # repository's master branch specifies version 3.0.0
301
312
 
@@ -307,18 +318,18 @@ Git repositories support a number of additional options.
307
318
 
308
319
  * `branch`, `tag`, and `ref`:
309
320
  You `MUST` only specify at most one of these options. The default
310
- is `:branch => "master"`. For example:
321
+ is `branch: "master"`. For example:
311
322
 
312
- gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-0-stable"
323
+ gem "rails", git: "https://github.com/rails/rails.git", branch: "5-0-stable"
313
324
 
314
- gem "rails", :git => "https://github.com/rails/rails.git", :tag => "v5.0.0"
325
+ gem "rails", git: "https://github.com/rails/rails.git", tag: "v5.0.0"
315
326
 
316
- gem "rails", :git => "https://github.com/rails/rails.git", :ref => "4aded"
327
+ gem "rails", git: "https://github.com/rails/rails.git", ref: "4aded"
317
328
 
318
329
  * `submodules`:
319
330
  For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
320
331
  lets you have another git repository within a subfolder of your repository.
321
- Specify `:submodules => true` to cause bundler to expand any
332
+ Specify `submodules: true` to cause bundler to expand any
322
333
  submodules included in the git repository
323
334
 
324
335
  If a git repository contains multiple `.gemspecs`, each `.gemspec`
@@ -346,11 +357,11 @@ as an argument, and a block which receives a single argument and interpolates it
346
357
  string to return the full repo address:
347
358
 
348
359
  git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
349
- gem 'rails', :stash => 'forks/rails'
360
+ gem 'rails', stash: 'forks/rails'
350
361
 
351
362
  In addition, if you wish to choose a specific branch:
352
363
 
353
- gem "rails", :stash => "forks/rails", :branch => "branch_name"
364
+ gem "rails", stash: "forks/rails", branch: "branch_name"
354
365
 
355
366
  ### GITHUB
356
367
 
@@ -363,25 +374,33 @@ If the git repository you want to use is hosted on GitHub and is public, you can
363
374
  trailing ".git"), separated by a slash. If both the username and repository name are the
364
375
  same, you can omit one.
365
376
 
366
- gem "rails", :github => "rails/rails"
367
- gem "rails", :github => "rails"
377
+ gem "rails", github: "rails/rails"
378
+ gem "rails", github: "rails"
368
379
 
369
380
  Are both equivalent to
370
381
 
371
- gem "rails", :git => "git://github.com/rails/rails.git"
382
+ gem "rails", git: "https://github.com/rails/rails.git"
372
383
 
373
384
  Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
374
385
 
386
+ You can also directly pass a pull request URL:
387
+
388
+ gem "rails", github: "https://github.com/rails/rails/pull/43753"
389
+
390
+ Which is equivalent to:
391
+
392
+ gem "rails", github: "rails/rails", branch: "refs/pull/43753/head"
393
+
375
394
  ### GIST
376
395
 
377
- If the git repository you want to use is hosted as a Github Gist and is public, you can use
396
+ If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
378
397
  the :gist shorthand to specify the gist identifier (without the trailing ".git").
379
398
 
380
- gem "the_hatch", :gist => "4815162342"
399
+ gem "the_hatch", gist: "4815162342"
381
400
 
382
401
  Is equivalent to:
383
402
 
384
- gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
403
+ gem "the_hatch", git: "https://gist.github.com/4815162342.git"
385
404
 
386
405
  Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument.
387
406
 
@@ -392,12 +411,12 @@ If the git repository you want to use is hosted on Bitbucket and is public, you
392
411
  trailing ".git"), separated by a slash. If both the username and repository name are the
393
412
  same, you can omit one.
394
413
 
395
- gem "rails", :bitbucket => "rails/rails"
396
- gem "rails", :bitbucket => "rails"
414
+ gem "rails", bitbucket: "rails/rails"
415
+ gem "rails", bitbucket: "rails"
397
416
 
398
417
  Are both equivalent to
399
418
 
400
- gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
419
+ gem "rails", git: "https://rails@bitbucket.org/rails/rails.git"
401
420
 
402
421
  Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument.
403
422
 
@@ -415,7 +434,7 @@ version that bundler should use.
415
434
  Unlike `:git`, bundler does not compile C extensions for
416
435
  gems specified as paths.
417
436
 
418
- gem "rails", :path => "vendor/rails"
437
+ gem "rails", path: "vendor/rails"
419
438
 
420
439
  If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories.
421
440
 
@@ -444,7 +463,7 @@ applied to a group of gems by using block form.
444
463
  gem "sqlite3"
445
464
  end
446
465
 
447
- group :development, :optional => true do
466
+ group :development, optional: true do
448
467
  gem "wirble"
449
468
  gem "faker"
450
469
  end
@@ -487,8 +506,8 @@ the `.gemspec` file.
487
506
 
488
507
  The `gemspec` method adds any runtime dependencies as gem requirements in the
489
508
  default group. It also adds development dependencies as gem requirements in the
490
- `development` group. Finally, it adds a gem requirement on your project (`:path
491
- => '.'`). In conjunction with `Bundler.setup`, this allows you to require project
509
+ `development` group. Finally, it adds a gem requirement on your project (`path:
510
+ '.'`). In conjunction with `Bundler.setup`, this allows you to require project
492
511
  files in your test code as you would if the project were installed as a gem; you
493
512
  need not manipulate the load path manually or require project files via relative
494
513
  paths.
@@ -513,5 +532,7 @@ bundler uses the following priority order:
513
532
  repository declared on the parent. This results in bundler prioritizing the
514
533
  ActiveSupport gem from the Rails git repository over ones from
515
534
  `rubygems.org`
516
- 3. The sources specified via global `source` lines, searching each source in
517
- your `Gemfile` from last added to first added.
535
+ 3. If neither of the above conditions are met, the global source will be used.
536
+ If multiple global sources are specified, they will be prioritized from
537
+ last to first, but this is deprecated since Bundler 1.13, so Bundler prints
538
+ a warning and will abort with an error in the future.
@@ -6,9 +6,11 @@ bundle-cache(1) bundle-cache.1
6
6
  bundle-check(1) bundle-check.1
7
7
  bundle-clean(1) bundle-clean.1
8
8
  bundle-config(1) bundle-config.1
9
+ bundle-console(1) bundle-console.1
9
10
  bundle-doctor(1) bundle-doctor.1
10
11
  bundle-exec(1) bundle-exec.1
11
12
  bundle-gem(1) bundle-gem.1
13
+ bundle-help(1) bundle-help.1
12
14
  bundle-info(1) bundle-info.1
13
15
  bundle-init(1) bundle-init.1
14
16
  bundle-inject(1) bundle-inject.1
@@ -18,8 +20,10 @@ bundle-lock(1) bundle-lock.1
18
20
  bundle-open(1) bundle-open.1
19
21
  bundle-outdated(1) bundle-outdated.1
20
22
  bundle-platform(1) bundle-platform.1
23
+ bundle-plugin(1) bundle-plugin.1
21
24
  bundle-pristine(1) bundle-pristine.1
22
25
  bundle-remove(1) bundle-remove.1
23
26
  bundle-show(1) bundle-show.1
24
27
  bundle-update(1) bundle-update.1
28
+ bundle-version(1) bundle-version.1
25
29
  bundle-viz(1) bundle-viz.1
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module MatchMetadata
5
+ def matches_current_ruby?
6
+ @required_ruby_version.satisfied_by?(Gem.ruby_version)
7
+ end
8
+
9
+ def matches_current_rubygems?
10
+ @required_rubygems_version.satisfied_by?(Gem.rubygems_version)
11
+ end
12
+ end
13
+ end
@@ -15,7 +15,6 @@ module Bundler
15
15
  return true if Gem::Platform::RUBY == gemspec_platform
16
16
  return true if local_platform == gemspec_platform
17
17
  gemspec_platform = Gem::Platform.new(gemspec_platform)
18
- return true if GemHelpers.generic(gemspec_platform) === local_platform
19
18
  return true if gemspec_platform === local_platform
20
19
 
21
20
  false
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module FetchMetadata
5
+ # A fallback is included because the original version of the specification
6
+ # API didn't include that field, so some marshalled specs in the index have it
7
+ # set to +nil+.
8
+ def matches_current_ruby?
9
+ @required_ruby_version ||= _remote_specification.required_ruby_version || Gem::Requirement.default
10
+
11
+ super
12
+ end
13
+
14
+ def matches_current_rubygems?
15
+ # A fallback is included because the original version of the specification
16
+ # API didn't include that field, so some marshalled specs in the index have it
17
+ # set to +nil+.
18
+ @required_rubygems_version ||= _remote_specification.required_rubygems_version || Gem::Requirement.default
19
+
20
+ super
21
+ end
22
+ end
23
+
24
+ module MatchRemoteMetadata
25
+ include MatchMetadata
26
+
27
+ prepend FetchMetadata
28
+ end
29
+ end
@@ -258,7 +258,7 @@ module Bundler
258
258
  @dependencies |= Array(names)
259
259
  end
260
260
 
261
- # Note: Do not override if you don't know what you are doing.
261
+ # NOTE: Do not override if you don't know what you are doing.
262
262
  def can_lock?(spec)
263
263
  spec.source == self
264
264
  end
@@ -283,8 +283,9 @@ 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
- # Note: Do not override if you don't know what you are doing.
288
+ # NOTE: Do not override if you don't know what you are doing.
288
289
  def include?(other)
289
290
  other == self
290
291
  end
@@ -293,7 +294,7 @@ module Bundler
293
294
  SharedHelpers.digest(:SHA1).hexdigest(uri)
294
295
  end
295
296
 
296
- # Note: Do not override if you don't know what you are doing.
297
+ # NOTE: Do not override if you don't know what you are doing.
297
298
  def gem_install_dir
298
299
  Bundler.install_path
299
300
  end
@@ -307,12 +308,6 @@ module Bundler
307
308
  Bundler.root
308
309
  end
309
310
 
310
- # @private
311
- # Returns true
312
- def bundler_plugin_api_source?
313
- true
314
- end
315
-
316
311
  # @private
317
312
  # This API on source might not be stable, and for now we expect plugins
318
313
  # to download all specs in `#specs`, so we implement the method for
@@ -20,10 +20,6 @@ module Bundler
20
20
  end
21
21
  end
22
22
 
23
- def version_message(spec)
24
- "#{spec.name} #{spec.version}"
25
- end
26
-
27
23
  def root
28
24
  Plugin.root
29
25
  end
@@ -4,10 +4,6 @@ module Bundler
4
4
  module Plugin
5
5
  class Installer
6
6
  class Rubygems < Bundler::Source::Rubygems
7
- def version_message(spec)
8
- "#{spec.name} #{spec.version}"
9
- end
10
-
11
7
  private
12
8
 
13
9
  def requires_sudo?
@@ -21,7 +21,7 @@ module Bundler
21
21
  elsif options[:local_git]
22
22
  install_local_git(names, version, options)
23
23
  else
24
- sources = options[:source] || Bundler.rubygems.sources
24
+ sources = options[:source] || Gem.sources
25
25
  install_rubygems(names, version, sources)
26
26
  end
27
27
  end
@@ -81,6 +81,8 @@ module Bundler
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
84
+ Bundler.configure_gem_home_and_path(Plugin.root)
85
+
84
86
  definition = Definition.new(nil, deps, source_list, true)
85
87
  install_definition(definition)
86
88
  end
@@ -13,6 +13,7 @@ module Bundler
13
13
  class MalformattedPlugin < PluginError; end
14
14
  class UndefinedCommandError < PluginError; end
15
15
  class UnknownSourceError < PluginError; end
16
+ class PluginInstallError < PluginError; end
16
17
 
17
18
  PLUGIN_FILE_NAME = "plugins.rb".freeze
18
19
 
@@ -35,15 +36,16 @@ module Bundler
35
36
  # @param [Hash] options various parameters as described in description.
36
37
  # Refer to cli/plugin for available options
37
38
  def install(names, options)
39
+ raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
40
+
38
41
  specs = Installer.new.install(names, options)
39
42
 
40
43
  save_plugins names, specs
41
- rescue PluginError => e
44
+ rescue PluginError
42
45
  specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
43
46
  specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
44
47
 
45
- names_list = names.map {|name| "`#{name}`" }.join(", ")
46
- Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
48
+ raise
47
49
  end
48
50
 
49
51
  # Uninstalls plugins by the given names
@@ -245,10 +247,11 @@ module Bundler
245
247
  # @param [Array<String>] names of inferred source plugins that can be ignored
246
248
  def save_plugins(plugins, specs, optional_plugins = [])
247
249
  plugins.each do |name|
250
+ next if index.installed?(name)
251
+
248
252
  spec = specs[name]
249
- validate_plugin! Pathname.new(spec.full_gem_path)
250
- installed = register_plugin(name, spec, optional_plugins.include?(name))
251
- Bundler.ui.info "Installed plugin #{name}" if installed
253
+
254
+ save_plugin(name, spec, optional_plugins.include?(name))
252
255
  end
253
256
  end
254
257
 
@@ -263,6 +266,22 @@ module Bundler
263
266
  raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
264
267
  end
265
268
 
269
+ # Validates and registers a plugin.
270
+ #
271
+ # @param [String] name the name of the plugin
272
+ # @param [Specification] spec of installed plugin
273
+ # @param [Boolean] optional_plugin, removed if there is conflict with any
274
+ # other plugin (used for default source plugins)
275
+ #
276
+ # @raise [PluginInstallError] if validation or registration raises any error
277
+ def save_plugin(name, spec, optional_plugin = false)
278
+ validate_plugin! Pathname.new(spec.full_gem_path)
279
+ installed = register_plugin(name, spec, optional_plugin)
280
+ Bundler.ui.info "Installed plugin #{name}" if installed
281
+ rescue PluginError => e
282
+ raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
283
+ end
284
+
266
285
  # Runs the plugins.rb file in an isolated namespace, records the plugin
267
286
  # actions it registers for and then passes the data to index to be stored.
268
287
  #
@@ -12,7 +12,7 @@ module Bundler
12
12
  yield
13
13
  f.flock(File::LOCK_UN)
14
14
  end
15
- rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
15
+ rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM, Errno::EROFS
16
16
  # In the case the user does not have access to
17
17
  # create the lock file or is using NFS where
18
18
  # locks are not available we skip locking.
@@ -6,6 +6,7 @@ module Bundler
6
6
  # be seeded with what we're given from the source's abbreviated index - the
7
7
  # full specification will only be fetched when necessary.
8
8
  class RemoteSpecification
9
+ include MatchRemoteMetadata
9
10
  include MatchPlatform
10
11
  include Comparable
11
12
 
@@ -16,7 +17,8 @@ module Bundler
16
17
  def initialize(name, version, platform, spec_fetcher)
17
18
  @name = name
18
19
  @version = Gem::Version.create version
19
- @platform = platform
20
+ @original_platform = platform || Gem::Platform::RUBY
21
+ @platform = Gem::Platform.new(platform)
20
22
  @spec_fetcher = spec_fetcher
21
23
  @dependencies = nil
22
24
  end
@@ -27,11 +29,15 @@ module Bundler
27
29
  @platform = _remote_specification.platform
28
30
  end
29
31
 
32
+ def identifier
33
+ @__identifier ||= [name, version, @platform.to_s]
34
+ end
35
+
30
36
  def full_name
31
- if platform == Gem::Platform::RUBY || platform.nil?
37
+ if @platform == Gem::Platform::RUBY
32
38
  "#{@name}-#{@version}"
33
39
  else
34
- "#{@name}-#{@version}-#{platform}"
40
+ "#{@name}-#{@version}-#{@platform}"
35
41
  end
36
42
  end
37
43
 
@@ -98,7 +104,7 @@ module Bundler
98
104
  end
99
105
 
100
106
  def _remote_specification
101
- @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
107
+ @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
102
108
  @_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
103
109
  " missing from the server! Try installing with `--full-index` as a workaround.")
104
110
  end