bundler 2.3.16 → 2.3.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/common.rb +1 -0
- data/lib/bundler/cli/install.rb +2 -0
- data/lib/bundler/cli.rb +6 -2
- data/lib/bundler/compact_index_client/updater.rb +16 -3
- data/lib/bundler/current_ruby.rb +1 -1
- data/lib/bundler/definition.rb +51 -18
- data/lib/bundler/dependency.rb +3 -2
- data/lib/bundler/dsl.rb +3 -3
- data/lib/bundler/friendly_errors.rb +5 -2
- data/lib/bundler/gem_helpers.rb +2 -0
- data/lib/bundler/incomplete_specification.rb +12 -0
- data/lib/bundler/index.rb +11 -17
- data/lib/bundler/installer/standalone.rb +29 -2
- data/lib/bundler/lazy_specification.rb +17 -8
- data/lib/bundler/lockfile_parser.rb +4 -0
- data/lib/bundler/man/bundle-add.1 +2 -2
- data/lib/bundler/man/bundle-add.1.ronn +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +13 -3
- data/lib/bundler/man/bundle-config.1.ronn +9 -2
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +2 -2
- data/lib/bundler/man/bundle-exec.1.ronn +1 -1
- data/lib/bundler/man/bundle-gem.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +5 -2
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +4 -1
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +3 -3
- data/lib/bundler/man/bundle.1.ronn +2 -2
- data/lib/bundler/man/gemfile.5 +77 -47
- data/lib/bundler/man/gemfile.5.ronn +75 -54
- data/lib/bundler/match_platform.rb +0 -1
- data/lib/bundler/remote_specification.rb +5 -4
- data/lib/bundler/resolver/spec_group.rb +5 -4
- data/lib/bundler/resolver.rb +11 -9
- data/lib/bundler/rubygems_ext.rb +6 -5
- data/lib/bundler/rubygems_gem_installer.rb +19 -12
- data/lib/bundler/runtime.rb +0 -1
- data/lib/bundler/settings.rb +1 -0
- data/lib/bundler/source/rubygems.rb +14 -6
- data/lib/bundler/spec_set.rb +31 -20
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +1 -0
- metadata +4 -3
data/lib/bundler/man/gemfile.5
CHANGED
@@ -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" "
|
4
|
+
.TH "GEMFILE" "5" "July 2022" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
|
@@ -15,8 +15,8 @@ Place the \fBGemfile\fR in the root of the directory containing the associated c
|
|
15
15
|
.SH "SYNTAX"
|
16
16
|
A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\.
|
17
17
|
.
|
18
|
-
.SH "GLOBAL
|
19
|
-
At the top of the \fBGemfile\fR, add a line for the \
|
18
|
+
.SH "GLOBAL SOURCE"
|
19
|
+
At the top of the \fBGemfile\fR, add a single line for the \fBRubyGems\fR source that contains the gems listed in the \fBGemfile\fR\.
|
20
20
|
.
|
21
21
|
.IP "" 4
|
22
22
|
.
|
@@ -29,10 +29,16 @@ source "https://rubygems\.org"
|
|
29
29
|
.IP "" 0
|
30
30
|
.
|
31
31
|
.P
|
32
|
-
|
32
|
+
You can add only one global source\. In Bundler 1\.13, adding multiple global sources was deprecated\. The \fBsource\fR \fBMUST\fR be a valid RubyGems repository\.
|
33
33
|
.
|
34
34
|
.P
|
35
|
-
|
35
|
+
To use more than one source of RubyGems, you should use \fI\fBsource\fR block\fR\.
|
36
|
+
.
|
37
|
+
.P
|
38
|
+
A source is checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\.
|
39
|
+
.
|
40
|
+
.P
|
41
|
+
\fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or \fBsource\fR block\.
|
36
42
|
.
|
37
43
|
.SS "CREDENTIALS"
|
38
44
|
Some gem sources require a username and password\. Use bundle config(1) \fIbundle\-config\.1\.html\fR to set the username and password for any of the sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\.
|
@@ -100,7 +106,7 @@ Each application \fImay\fR specify a Ruby engine version\. If an engine version
|
|
100
106
|
.
|
101
107
|
.nf
|
102
108
|
|
103
|
-
ruby "1\.8\.7", :
|
109
|
+
ruby "1\.8\.7", engine: "jruby", engine_version: "1\.6\.7"
|
104
110
|
.
|
105
111
|
.fi
|
106
112
|
.
|
@@ -113,7 +119,7 @@ Each application \fImay\fR specify a Ruby patchlevel\.
|
|
113
119
|
.
|
114
120
|
.nf
|
115
121
|
|
116
|
-
ruby "2\.0\.0", :
|
122
|
+
ruby "2\.0\.0", patchlevel: "247"
|
117
123
|
.
|
118
124
|
.fi
|
119
125
|
.
|
@@ -156,9 +162,9 @@ Each \fIgem\fR \fBMAY\fR specify files that should be used when autorequiring vi
|
|
156
162
|
.
|
157
163
|
.nf
|
158
164
|
|
159
|
-
gem "redis", :
|
160
|
-
gem "webmock", :
|
161
|
-
gem "byebug", :
|
165
|
+
gem "redis", require: ["redis/connection/hiredis", "redis"]
|
166
|
+
gem "webmock", require: false
|
167
|
+
gem "byebug", require: true
|
162
168
|
.
|
163
169
|
.fi
|
164
170
|
.
|
@@ -172,8 +178,8 @@ The argument defaults to the name of the gem\. For example, these are identical:
|
|
172
178
|
.nf
|
173
179
|
|
174
180
|
gem "nokogiri"
|
175
|
-
gem "nokogiri", :
|
176
|
-
gem "nokogiri", :
|
181
|
+
gem "nokogiri", require: "nokogiri"
|
182
|
+
gem "nokogiri", require: true
|
177
183
|
.
|
178
184
|
.fi
|
179
185
|
.
|
@@ -186,8 +192,8 @@ Each \fIgem\fR \fBMAY\fR specify membership in one or more groups\. Any \fIgem\f
|
|
186
192
|
.
|
187
193
|
.nf
|
188
194
|
|
189
|
-
gem "rspec", :
|
190
|
-
gem "wirble", :
|
195
|
+
gem "rspec", group: :test
|
196
|
+
gem "wirble", groups: [:development, :test]
|
191
197
|
.
|
192
198
|
.fi
|
193
199
|
.
|
@@ -320,9 +326,9 @@ As with groups, you can specify one or more platforms:
|
|
320
326
|
.
|
321
327
|
.nf
|
322
328
|
|
323
|
-
gem "weakling", :
|
324
|
-
gem "ruby\-debug", :
|
325
|
-
gem "nokogiri", :
|
329
|
+
gem "weakling", platforms: :jruby
|
330
|
+
gem "ruby\-debug", platforms: :mri_18
|
331
|
+
gem "nokogiri", platforms: [:mri_18, :jruby]
|
326
332
|
.
|
327
333
|
.fi
|
328
334
|
.
|
@@ -331,27 +337,51 @@ gem "nokogiri", :platforms => [:mri_18, :jruby]
|
|
331
337
|
.P
|
332
338
|
All operations involving groups (\fBbundle install\fR \fIbundle\-install\.1\.html\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\.
|
333
339
|
.
|
340
|
+
.SS "FORCE_RUBY_PLATFORM"
|
341
|
+
If you always want the pure ruby variant of a gem to be chosen over platform specific variants, you can use the \fBforce_ruby_platform\fR option:
|
342
|
+
.
|
343
|
+
.IP "" 4
|
344
|
+
.
|
345
|
+
.nf
|
346
|
+
|
347
|
+
gem "ffi", force_ruby_platform: true
|
348
|
+
.
|
349
|
+
.fi
|
350
|
+
.
|
351
|
+
.IP "" 0
|
352
|
+
.
|
353
|
+
.P
|
354
|
+
This can be handy (assuming the pure ruby variant works fine) when:
|
355
|
+
.
|
356
|
+
.IP "\(bu" 4
|
357
|
+
You\'re having issues with the platform specific variant\.
|
358
|
+
.
|
359
|
+
.IP "\(bu" 4
|
360
|
+
The platform specific variant does not yet support a newer ruby (and thus has a \fBrequired_ruby_version\fR upper bound), but you still want your Gemfile{\.lock} files to resolve under that ruby\.
|
361
|
+
.
|
362
|
+
.IP "" 0
|
363
|
+
.
|
334
364
|
.SS "SOURCE"
|
335
|
-
You can select an alternate
|
365
|
+
You can select an alternate RubyGems repository for a gem using the \':source\' option\.
|
336
366
|
.
|
337
367
|
.IP "" 4
|
338
368
|
.
|
339
369
|
.nf
|
340
370
|
|
341
|
-
gem "some_internal_gem", :
|
371
|
+
gem "some_internal_gem", source: "https://gems\.example\.com"
|
342
372
|
.
|
343
373
|
.fi
|
344
374
|
.
|
345
375
|
.IP "" 0
|
346
376
|
.
|
347
377
|
.P
|
348
|
-
This forces the gem to be loaded from this source and ignores
|
378
|
+
This forces the gem to be loaded from this source and ignores the global source declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\.
|
349
379
|
.
|
350
380
|
.P
|
351
|
-
Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on
|
381
|
+
Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on the global source\.
|
352
382
|
.
|
353
383
|
.P
|
354
|
-
Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL
|
384
|
+
\fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCE\fR\.
|
355
385
|
.
|
356
386
|
.P
|
357
387
|
Using the \fB:source\fR option for an individual gem will also make that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when adding gems with explicit sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources\.
|
@@ -361,15 +391,15 @@ If necessary, you can specify that a gem is located at a particular git reposito
|
|
361
391
|
.
|
362
392
|
.TP
|
363
393
|
\fBHTTP(S)\fR
|
364
|
-
gem "rails", :
|
394
|
+
gem "rails", git: "https://github\.com/rails/rails\.git"
|
365
395
|
.
|
366
396
|
.TP
|
367
397
|
\fBSSH\fR
|
368
|
-
gem "rails", :
|
398
|
+
gem "rails", git: "git@github\.com:rails/rails\.git"
|
369
399
|
.
|
370
400
|
.TP
|
371
401
|
\fBgit\fR
|
372
|
-
gem "rails", :
|
402
|
+
gem "rails", git: "git://github\.com/rails/rails\.git"
|
373
403
|
.
|
374
404
|
.P
|
375
405
|
If using SSH, the user that you use to run \fBbundle install\fR \fBMUST\fR have the appropriate keys available in their \fB$HOME/\.ssh\fR\.
|
@@ -393,7 +423,7 @@ If a git repository does have a \fB\.gemspec\fR for the gem you attached it to,
|
|
393
423
|
.
|
394
424
|
.nf
|
395
425
|
|
396
|
-
gem "rails", "2\.3\.8", :
|
426
|
+
gem "rails", "2\.3\.8", git: "https://github\.com/rails/rails\.git"
|
397
427
|
# bundle install will fail, because the \.gemspec in the rails
|
398
428
|
# repository\'s master branch specifies version 3\.0\.0
|
399
429
|
.
|
@@ -409,20 +439,20 @@ Git repositories support a number of additional options\.
|
|
409
439
|
.
|
410
440
|
.TP
|
411
441
|
\fBbranch\fR, \fBtag\fR, and \fBref\fR
|
412
|
-
You \fBMUST\fR only specify at most one of these options\. The default is \
|
442
|
+
You \fBMUST\fR only specify at most one of these options\. The default is \fBbranch: "master"\fR\. For example:
|
413
443
|
.
|
414
444
|
.IP
|
415
|
-
gem "rails", :
|
445
|
+
gem "rails", git: "https://github\.com/rails/rails\.git", branch: "5\-0\-stable"
|
416
446
|
.
|
417
447
|
.IP
|
418
|
-
gem "rails", :
|
448
|
+
gem "rails", git: "https://github\.com/rails/rails\.git", tag: "v5\.0\.0"
|
419
449
|
.
|
420
450
|
.IP
|
421
|
-
gem "rails", :
|
451
|
+
gem "rails", git: "https://github\.com/rails/rails\.git", ref: "4aded"
|
422
452
|
.
|
423
453
|
.TP
|
424
454
|
\fBsubmodules\fR
|
425
|
-
For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \
|
455
|
+
For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \fBsubmodules: true\fR to cause bundler to expand any submodules included in the git repository
|
426
456
|
.
|
427
457
|
.P
|
428
458
|
If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\.
|
@@ -454,7 +484,7 @@ A custom git source can be defined via the \fBgit_source\fR method\. Provide the
|
|
454
484
|
.nf
|
455
485
|
|
456
486
|
git_source(:stash){ |repo_name| "https://stash\.corp\.acme\.pl/#{repo_name}\.git" }
|
457
|
-
gem \'rails\', :
|
487
|
+
gem \'rails\', stash: \'forks/rails\'
|
458
488
|
.
|
459
489
|
.fi
|
460
490
|
.
|
@@ -467,7 +497,7 @@ In addition, if you wish to choose a specific branch:
|
|
467
497
|
.
|
468
498
|
.nf
|
469
499
|
|
470
|
-
gem "rails", :
|
500
|
+
gem "rails", stash: "forks/rails", branch: "branch_name"
|
471
501
|
.
|
472
502
|
.fi
|
473
503
|
.
|
@@ -483,8 +513,8 @@ If the git repository you want to use is hosted on GitHub and is public, you can
|
|
483
513
|
.
|
484
514
|
.nf
|
485
515
|
|
486
|
-
gem "rails", :
|
487
|
-
gem "rails", :
|
516
|
+
gem "rails", github: "rails/rails"
|
517
|
+
gem "rails", github: "rails"
|
488
518
|
.
|
489
519
|
.fi
|
490
520
|
.
|
@@ -497,7 +527,7 @@ Are both equivalent to
|
|
497
527
|
.
|
498
528
|
.nf
|
499
529
|
|
500
|
-
gem "rails", :
|
530
|
+
gem "rails", git: "git://github\.com/rails/rails\.git"
|
501
531
|
.
|
502
532
|
.fi
|
503
533
|
.
|
@@ -513,7 +543,7 @@ You can also directly pass a pull request URL:
|
|
513
543
|
.
|
514
544
|
.nf
|
515
545
|
|
516
|
-
gem "rails", :
|
546
|
+
gem "rails", github: "https://github\.com/rails/rails/pull/43753"
|
517
547
|
.
|
518
548
|
.fi
|
519
549
|
.
|
@@ -526,7 +556,7 @@ Which is equivalent to:
|
|
526
556
|
.
|
527
557
|
.nf
|
528
558
|
|
529
|
-
gem "rails", :
|
559
|
+
gem "rails", github: "rails/rails", branch: "refs/pull/43753/head"
|
530
560
|
.
|
531
561
|
.fi
|
532
562
|
.
|
@@ -539,7 +569,7 @@ If the git repository you want to use is hosted as a GitHub Gist and is public,
|
|
539
569
|
.
|
540
570
|
.nf
|
541
571
|
|
542
|
-
gem "the_hatch", :
|
572
|
+
gem "the_hatch", gist: "4815162342"
|
543
573
|
.
|
544
574
|
.fi
|
545
575
|
.
|
@@ -552,7 +582,7 @@ Is equivalent to:
|
|
552
582
|
.
|
553
583
|
.nf
|
554
584
|
|
555
|
-
gem "the_hatch", :
|
585
|
+
gem "the_hatch", git: "https://gist\.github\.com/4815162342\.git"
|
556
586
|
.
|
557
587
|
.fi
|
558
588
|
.
|
@@ -568,8 +598,8 @@ If the git repository you want to use is hosted on Bitbucket and is public, you
|
|
568
598
|
.
|
569
599
|
.nf
|
570
600
|
|
571
|
-
gem "rails", :
|
572
|
-
gem "rails", :
|
601
|
+
gem "rails", bitbucket: "rails/rails"
|
602
|
+
gem "rails", bitbucket: "rails"
|
573
603
|
.
|
574
604
|
.fi
|
575
605
|
.
|
@@ -582,7 +612,7 @@ Are both equivalent to
|
|
582
612
|
.
|
583
613
|
.nf
|
584
614
|
|
585
|
-
gem "rails", :
|
615
|
+
gem "rails", git: "https://rails@bitbucket\.org/rails/rails\.git"
|
586
616
|
.
|
587
617
|
.fi
|
588
618
|
.
|
@@ -604,7 +634,7 @@ Unlike \fB:git\fR, bundler does not compile C extensions for gems specified as p
|
|
604
634
|
.
|
605
635
|
.nf
|
606
636
|
|
607
|
-
gem "rails", :
|
637
|
+
gem "rails", path: "vendor/rails"
|
608
638
|
.
|
609
639
|
.fi
|
610
640
|
.
|
@@ -648,7 +678,7 @@ platforms :ruby do
|
|
648
678
|
gem "sqlite3"
|
649
679
|
end
|
650
680
|
|
651
|
-
group :development, :
|
681
|
+
group :development, optional: true do
|
652
682
|
gem "wirble"
|
653
683
|
gem "faker"
|
654
684
|
end
|
@@ -688,7 +718,7 @@ The \fB\.gemspec\fR \fIhttp://guides\.rubygems\.org/specification\-reference/\fR
|
|
688
718
|
If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\.
|
689
719
|
.
|
690
720
|
.P
|
691
|
-
The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\
|
721
|
+
The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\fBpath: \'\.\'\fR)\. In conjunction with \fBBundler\.setup\fR, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths\.
|
692
722
|
.
|
693
723
|
.P
|
694
724
|
The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: "{,\fI,\fR/*}\.gemspec"), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\.
|
@@ -706,7 +736,7 @@ The source explicitly attached to the gem (using \fB:source\fR, \fB:path\fR, or
|
|
706
736
|
For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR
|
707
737
|
.
|
708
738
|
.IP "3." 4
|
709
|
-
|
739
|
+
If neither of the above conditions are met, the global source will be used\. If multiple global sources are specified, they will be prioritized from last to first, but this is deprecated since Bundler 1\.13, so Bundler prints a warning and will abort with an error in the future\.
|
710
740
|
.
|
711
741
|
.IP "" 0
|
712
742
|
|
@@ -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
|
18
|
+
## GLOBAL SOURCE
|
19
19
|
|
20
|
-
At the top of the `Gemfile`, add a line for the `
|
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
|
-
|
26
|
-
|
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
|
-
|
29
|
-
|
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
|
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
|
|
@@ -91,13 +96,13 @@ Each application _may_ specify a Ruby engine version. If an engine version is
|
|
91
96
|
specified, an engine _must_ also be specified. If the engine is "ruby" the
|
92
97
|
engine version specified _must_ match the Ruby version.
|
93
98
|
|
94
|
-
ruby "1.8.7", :
|
99
|
+
ruby "1.8.7", engine: "jruby", engine_version: "1.6.7"
|
95
100
|
|
96
101
|
### PATCHLEVEL
|
97
102
|
|
98
103
|
Each application _may_ specify a Ruby patchlevel.
|
99
104
|
|
100
|
-
ruby "2.0.0", :
|
105
|
+
ruby "2.0.0", patchlevel: "247"
|
101
106
|
|
102
107
|
## GEMS
|
103
108
|
|
@@ -124,23 +129,23 @@ Each _gem_ `MAY` specify files that should be used when autorequiring via
|
|
124
129
|
you want `required` has the same name as _gem_ or `false` to
|
125
130
|
prevent any file from being autorequired.
|
126
131
|
|
127
|
-
gem "redis", :
|
128
|
-
gem "webmock", :
|
129
|
-
gem "byebug", :
|
132
|
+
gem "redis", require: ["redis/connection/hiredis", "redis"]
|
133
|
+
gem "webmock", require: false
|
134
|
+
gem "byebug", require: true
|
130
135
|
|
131
136
|
The argument defaults to the name of the gem. For example, these are identical:
|
132
137
|
|
133
138
|
gem "nokogiri"
|
134
|
-
gem "nokogiri", :
|
135
|
-
gem "nokogiri", :
|
139
|
+
gem "nokogiri", require: "nokogiri"
|
140
|
+
gem "nokogiri", require: true
|
136
141
|
|
137
142
|
### GROUPS
|
138
143
|
|
139
144
|
Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
|
140
145
|
not specify membership in any group is placed in the `default` group.
|
141
146
|
|
142
|
-
gem "rspec", :
|
143
|
-
gem "wirble", :
|
147
|
+
gem "rspec", group: :test
|
148
|
+
gem "wirble", groups: [:development, :test]
|
144
149
|
|
145
150
|
The Bundler runtime allows its two main methods, `Bundler.setup` and
|
146
151
|
`Bundler.require`, to limit their impact to particular groups.
|
@@ -223,32 +228,46 @@ The full list of platforms and supported versions includes:
|
|
223
228
|
|
224
229
|
As with groups, you can specify one or more platforms:
|
225
230
|
|
226
|
-
gem "weakling", :
|
227
|
-
gem "ruby-debug", :
|
228
|
-
gem "nokogiri", :
|
231
|
+
gem "weakling", platforms: :jruby
|
232
|
+
gem "ruby-debug", platforms: :mri_18
|
233
|
+
gem "nokogiri", platforms: [:mri_18, :jruby]
|
229
234
|
|
230
235
|
All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`,
|
231
236
|
`Bundler.require`) behave exactly the same as if any groups not
|
232
237
|
matching the current platform were explicitly excluded.
|
233
238
|
|
239
|
+
### FORCE_RUBY_PLATFORM
|
240
|
+
|
241
|
+
If you always want the pure ruby variant of a gem to be chosen over platform
|
242
|
+
specific variants, you can use the `force_ruby_platform` option:
|
243
|
+
|
244
|
+
gem "ffi", force_ruby_platform: true
|
245
|
+
|
246
|
+
This can be handy (assuming the pure ruby variant works fine) when:
|
247
|
+
|
248
|
+
* You're having issues with the platform specific variant.
|
249
|
+
* The platform specific variant does not yet support a newer ruby (and thus has
|
250
|
+
a `required_ruby_version` upper bound), but you still want your Gemfile{.lock}
|
251
|
+
files to resolve under that ruby.
|
252
|
+
|
234
253
|
### SOURCE
|
235
254
|
|
236
|
-
You can select an alternate
|
255
|
+
You can select an alternate RubyGems repository for a gem using the ':source'
|
237
256
|
option.
|
238
257
|
|
239
|
-
gem "some_internal_gem", :
|
258
|
+
gem "some_internal_gem", source: "https://gems.example.com"
|
240
259
|
|
241
|
-
This forces the gem to be loaded from this source and ignores
|
260
|
+
This forces the gem to be loaded from this source and ignores the global source
|
242
261
|
declared at the top level of the file. If the gem does not exist in this source,
|
243
262
|
it will not be installed.
|
244
263
|
|
245
264
|
Bundler will search for child dependencies of this gem by first looking in the
|
246
265
|
source selected for the parent, but if they are not found there, it will fall
|
247
|
-
back on
|
266
|
+
back on the global source.
|
248
267
|
|
268
|
+
**Note about a behavior of the feature deprecated in Bundler 1.13**:
|
249
269
|
Selecting a specific source repository this way also suppresses the ambiguous
|
250
|
-
gem warning described above in
|
251
|
-
[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
|
270
|
+
gem warning described above in [GLOBAL SOURCE](#GLOBAL-SOURCE).
|
252
271
|
|
253
272
|
Using the `:source` option for an individual gem will also make that source
|
254
273
|
available as a possible global source for any other gems which do not specify
|
@@ -263,11 +282,11 @@ git repository using the `:git` parameter. The repository can be accessed via
|
|
263
282
|
several protocols:
|
264
283
|
|
265
284
|
* `HTTP(S)`:
|
266
|
-
gem "rails", :
|
285
|
+
gem "rails", git: "https://github.com/rails/rails.git"
|
267
286
|
* `SSH`:
|
268
|
-
gem "rails", :
|
287
|
+
gem "rails", git: "git@github.com:rails/rails.git"
|
269
288
|
* `git`:
|
270
|
-
gem "rails", :
|
289
|
+
gem "rails", git: "git://github.com/rails/rails.git"
|
271
290
|
|
272
291
|
If using SSH, the user that you use to run `bundle install` `MUST` have the
|
273
292
|
appropriate keys available in their `$HOME/.ssh`.
|
@@ -295,7 +314,7 @@ to, a version specifier, if provided, means that the git repository is
|
|
295
314
|
only valid if the `.gemspec` specifies a version matching the version
|
296
315
|
specifier. If not, bundler will print a warning.
|
297
316
|
|
298
|
-
gem "rails", "2.3.8", :
|
317
|
+
gem "rails", "2.3.8", git: "https://github.com/rails/rails.git"
|
299
318
|
# bundle install will fail, because the .gemspec in the rails
|
300
319
|
# repository's master branch specifies version 3.0.0
|
301
320
|
|
@@ -307,18 +326,18 @@ Git repositories support a number of additional options.
|
|
307
326
|
|
308
327
|
* `branch`, `tag`, and `ref`:
|
309
328
|
You `MUST` only specify at most one of these options. The default
|
310
|
-
is
|
329
|
+
is `branch: "master"`. For example:
|
311
330
|
|
312
|
-
gem "rails", :
|
331
|
+
gem "rails", git: "https://github.com/rails/rails.git", branch: "5-0-stable"
|
313
332
|
|
314
|
-
gem "rails", :
|
333
|
+
gem "rails", git: "https://github.com/rails/rails.git", tag: "v5.0.0"
|
315
334
|
|
316
|
-
gem "rails", :
|
335
|
+
gem "rails", git: "https://github.com/rails/rails.git", ref: "4aded"
|
317
336
|
|
318
337
|
* `submodules`:
|
319
338
|
For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
|
320
339
|
lets you have another git repository within a subfolder of your repository.
|
321
|
-
Specify
|
340
|
+
Specify `submodules: true` to cause bundler to expand any
|
322
341
|
submodules included in the git repository
|
323
342
|
|
324
343
|
If a git repository contains multiple `.gemspecs`, each `.gemspec`
|
@@ -346,11 +365,11 @@ as an argument, and a block which receives a single argument and interpolates it
|
|
346
365
|
string to return the full repo address:
|
347
366
|
|
348
367
|
git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
|
349
|
-
gem 'rails', :
|
368
|
+
gem 'rails', stash: 'forks/rails'
|
350
369
|
|
351
370
|
In addition, if you wish to choose a specific branch:
|
352
371
|
|
353
|
-
gem "rails", :
|
372
|
+
gem "rails", stash: "forks/rails", branch: "branch_name"
|
354
373
|
|
355
374
|
### GITHUB
|
356
375
|
|
@@ -363,33 +382,33 @@ If the git repository you want to use is hosted on GitHub and is public, you can
|
|
363
382
|
trailing ".git"), separated by a slash. If both the username and repository name are the
|
364
383
|
same, you can omit one.
|
365
384
|
|
366
|
-
gem "rails", :
|
367
|
-
gem "rails", :
|
385
|
+
gem "rails", github: "rails/rails"
|
386
|
+
gem "rails", github: "rails"
|
368
387
|
|
369
388
|
Are both equivalent to
|
370
389
|
|
371
|
-
gem "rails", :
|
390
|
+
gem "rails", git: "git://github.com/rails/rails.git"
|
372
391
|
|
373
392
|
Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
374
393
|
|
375
394
|
You can also directly pass a pull request URL:
|
376
395
|
|
377
|
-
gem "rails", :
|
396
|
+
gem "rails", github: "https://github.com/rails/rails/pull/43753"
|
378
397
|
|
379
398
|
Which is equivalent to:
|
380
399
|
|
381
|
-
gem "rails", :
|
400
|
+
gem "rails", github: "rails/rails", branch: "refs/pull/43753/head"
|
382
401
|
|
383
402
|
### GIST
|
384
403
|
|
385
404
|
If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
|
386
405
|
the :gist shorthand to specify the gist identifier (without the trailing ".git").
|
387
406
|
|
388
|
-
gem "the_hatch", :
|
407
|
+
gem "the_hatch", gist: "4815162342"
|
389
408
|
|
390
409
|
Is equivalent to:
|
391
410
|
|
392
|
-
gem "the_hatch", :
|
411
|
+
gem "the_hatch", git: "https://gist.github.com/4815162342.git"
|
393
412
|
|
394
413
|
Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
395
414
|
|
@@ -400,12 +419,12 @@ If the git repository you want to use is hosted on Bitbucket and is public, you
|
|
400
419
|
trailing ".git"), separated by a slash. If both the username and repository name are the
|
401
420
|
same, you can omit one.
|
402
421
|
|
403
|
-
gem "rails", :
|
404
|
-
gem "rails", :
|
422
|
+
gem "rails", bitbucket: "rails/rails"
|
423
|
+
gem "rails", bitbucket: "rails"
|
405
424
|
|
406
425
|
Are both equivalent to
|
407
426
|
|
408
|
-
gem "rails", :
|
427
|
+
gem "rails", git: "https://rails@bitbucket.org/rails/rails.git"
|
409
428
|
|
410
429
|
Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
411
430
|
|
@@ -423,7 +442,7 @@ version that bundler should use.
|
|
423
442
|
Unlike `:git`, bundler does not compile C extensions for
|
424
443
|
gems specified as paths.
|
425
444
|
|
426
|
-
gem "rails", :
|
445
|
+
gem "rails", path: "vendor/rails"
|
427
446
|
|
428
447
|
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.
|
429
448
|
|
@@ -452,7 +471,7 @@ applied to a group of gems by using block form.
|
|
452
471
|
gem "sqlite3"
|
453
472
|
end
|
454
473
|
|
455
|
-
group :development, :
|
474
|
+
group :development, optional: true do
|
456
475
|
gem "wirble"
|
457
476
|
gem "faker"
|
458
477
|
end
|
@@ -495,8 +514,8 @@ the `.gemspec` file.
|
|
495
514
|
|
496
515
|
The `gemspec` method adds any runtime dependencies as gem requirements in the
|
497
516
|
default group. It also adds development dependencies as gem requirements in the
|
498
|
-
`development` group. Finally, it adds a gem requirement on your project (
|
499
|
-
|
517
|
+
`development` group. Finally, it adds a gem requirement on your project (`path:
|
518
|
+
'.'`). In conjunction with `Bundler.setup`, this allows you to require project
|
500
519
|
files in your test code as you would if the project were installed as a gem; you
|
501
520
|
need not manipulate the load path manually or require project files via relative
|
502
521
|
paths.
|
@@ -521,5 +540,7 @@ bundler uses the following priority order:
|
|
521
540
|
repository declared on the parent. This results in bundler prioritizing the
|
522
541
|
ActiveSupport gem from the Rails git repository over ones from
|
523
542
|
`rubygems.org`
|
524
|
-
3.
|
525
|
-
|
543
|
+
3. If neither of the above conditions are met, the global source will be used.
|
544
|
+
If multiple global sources are specified, they will be prioritized from
|
545
|
+
last to first, but this is deprecated since Bundler 1.13, so Bundler prints
|
546
|
+
a warning and will abort with an error in the future.
|
@@ -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
|