bundler 2.2.9 → 2.2.14
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/gem.rb +23 -17
- data/lib/bundler/compact_index_client/updater.rb +1 -1
- data/lib/bundler/definition.rb +43 -26
- data/lib/bundler/dsl.rb +36 -25
- data/lib/bundler/inline.rb +1 -0
- data/lib/bundler/installer.rb +2 -0
- data/lib/bundler/installer/parallel_installer.rb +6 -8
- data/lib/bundler/lockfile_parser.rb +3 -13
- data/lib/bundler/man/bundle-config.1 +4 -4
- data/lib/bundler/man/bundle-config.1.ronn +8 -7
- data/lib/bundler/plugin.rb +1 -0
- data/lib/bundler/plugin/api/source.rb +7 -0
- data/lib/bundler/plugin/installer.rb +8 -10
- data/lib/bundler/plugin/source_list.rb +4 -0
- data/lib/bundler/resolver.rb +36 -38
- data/lib/bundler/rubygems_gem_installer.rb +47 -0
- data/lib/bundler/source.rb +6 -0
- data/lib/bundler/source/metadata.rb +0 -4
- data/lib/bundler/source/rubygems.rb +20 -4
- data/lib/bundler/source_list.rb +27 -20
- data/lib/bundler/spec_set.rb +2 -0
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/lib/bundler/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31f2f45fcc46844af7ae85151dd04e9ddd20b8daaee6999b735813bc632b5e28
|
4
|
+
data.tar.gz: 9fe8d309077af1c3d82794d8e020037b788995038c90674885ccb61ff595d4da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55a040289f2f69a734b222d30fdd716e1789c8a2d18519dd225d16fa4e418748cab1f850888b290f92305fc8e07b02e30a8816ed756d0877ef7f286e6ec2393b
|
7
|
+
data.tar.gz: c810e53e037eec801da65b145ff9ef34d556df32b128086c5f6242b228dc9a6df3595d23aae8f1513a410e54666adc23be8d152a3790346fa4ca97feb51c394b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,52 @@
|
|
1
|
+
# 2.2.14 (March 8, 2021)
|
2
|
+
|
3
|
+
## Security fixes:
|
4
|
+
|
5
|
+
- Lock GEM sources separately and fix locally installed specs confusing bundler [#4381](https://github.com/rubygems/rubygems/pull/4381)
|
6
|
+
|
7
|
+
## Bug fixes:
|
8
|
+
|
9
|
+
- Make `rake` available to other gems' installers right after it's installed [#4428](https://github.com/rubygems/rubygems/pull/4428)
|
10
|
+
- Fix encoding issue on compact index updater [#4362](https://github.com/rubygems/rubygems/pull/4362)
|
11
|
+
|
12
|
+
# 2.2.13 (March 3, 2021)
|
13
|
+
|
14
|
+
## Enhancements:
|
15
|
+
|
16
|
+
- Respect user configured default branch in README links in new generated gems [#4303](https://github.com/rubygems/rubygems/pull/4303)
|
17
|
+
|
18
|
+
## Bug fixes:
|
19
|
+
|
20
|
+
- Fix gems sometimes being pulled from irrelevant sources [#4418](https://github.com/rubygems/rubygems/pull/4418)
|
21
|
+
|
22
|
+
# 2.2.12 (March 1, 2021)
|
23
|
+
|
24
|
+
## Bug fixes:
|
25
|
+
|
26
|
+
- Fix sporadic warnings about `nil` gemspec on install/update and make those faster [#4409](https://github.com/rubygems/rubygems/pull/4409)
|
27
|
+
- Fix deployment install with duplicate path gems added to Gemfile [#4410](https://github.com/rubygems/rubygems/pull/4410)
|
28
|
+
|
29
|
+
# 2.2.11 (February 17, 2021)
|
30
|
+
|
31
|
+
## Bug fixes:
|
32
|
+
|
33
|
+
- Revert disable_multisource changes [#4385](https://github.com/rubygems/rubygems/pull/4385)
|
34
|
+
|
35
|
+
# 2.2.10 (February 15, 2021)
|
36
|
+
|
37
|
+
## Security fixes:
|
38
|
+
|
39
|
+
- Fix source priority for transitive dependencies and split lockfile rubygems source sections [#3655](https://github.com/rubygems/rubygems/pull/3655)
|
40
|
+
|
41
|
+
## Bug fixes:
|
42
|
+
|
43
|
+
- Fix adding platforms to lockfile sometimes conflicting on ruby requirements [#4371](https://github.com/rubygems/rubygems/pull/4371)
|
44
|
+
- Fix bundler sometimes choosing ruby variants over java ones [#4367](https://github.com/rubygems/rubygems/pull/4367)
|
45
|
+
|
46
|
+
## Documentation:
|
47
|
+
|
48
|
+
- Update man pages to reflect to new default for bundle install jobs [#4188](https://github.com/rubygems/rubygems/pull/4188)
|
49
|
+
|
1
50
|
# 2.2.9 (February 8, 2021)
|
2
51
|
|
3
52
|
## Enhancements:
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2021-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-03-08".freeze
|
8
|
+
@git_commit_sha = "3a169d80c1".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -39,11 +39,11 @@ module Bundler
|
|
39
39
|
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
40
40
|
constant_array = constant_name.split("::")
|
41
41
|
|
42
|
-
|
42
|
+
use_git = Bundler.git_present? && options[:git]
|
43
43
|
|
44
|
-
git_author_name =
|
45
|
-
github_username =
|
46
|
-
git_user_email =
|
44
|
+
git_author_name = use_git ? `git config user.name`.chomp : ""
|
45
|
+
github_username = use_git ? `git config github.user`.chomp : ""
|
46
|
+
git_user_email = use_git ? `git config user.email`.chomp : ""
|
47
47
|
|
48
48
|
config = {
|
49
49
|
:name => name,
|
@@ -58,6 +58,7 @@ module Bundler
|
|
58
58
|
:ext => options[:ext],
|
59
59
|
:exe => options[:exe],
|
60
60
|
:bundler_version => bundler_dependency_version,
|
61
|
+
:git => use_git,
|
61
62
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
62
63
|
:required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
|
63
64
|
}
|
@@ -79,7 +80,7 @@ module Bundler
|
|
79
80
|
bin/setup
|
80
81
|
]
|
81
82
|
|
82
|
-
templates.merge!("gitignore.tt" => ".gitignore") if
|
83
|
+
templates.merge!("gitignore.tt" => ".gitignore") if use_git
|
83
84
|
|
84
85
|
if test_framework = ask_and_set_test_framework
|
85
86
|
config[:test] = test_framework
|
@@ -175,24 +176,31 @@ module Bundler
|
|
175
176
|
)
|
176
177
|
end
|
177
178
|
|
179
|
+
if File.exist?(target) && !File.directory?(target)
|
180
|
+
Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
|
181
|
+
exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
|
182
|
+
end
|
183
|
+
|
184
|
+
if use_git
|
185
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
186
|
+
`git init #{target}`
|
187
|
+
|
188
|
+
config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
|
189
|
+
end
|
190
|
+
|
178
191
|
templates.each do |src, dst|
|
179
192
|
destination = target.join(dst)
|
180
|
-
|
181
|
-
thor.template("newgem/#{src}", destination, config)
|
182
|
-
end
|
193
|
+
thor.template("newgem/#{src}", destination, config)
|
183
194
|
end
|
184
195
|
|
185
196
|
executables.each do |file|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
197
|
+
path = target.join(file)
|
198
|
+
executable = (path.stat.mode | 0o111)
|
199
|
+
path.chmod(executable)
|
190
200
|
end
|
191
201
|
|
192
|
-
if
|
193
|
-
Bundler.ui.info "Initializing git repo in #{target}"
|
202
|
+
if use_git
|
194
203
|
Dir.chdir(target) do
|
195
|
-
`git init`
|
196
204
|
`git add .`
|
197
205
|
end
|
198
206
|
end
|
@@ -202,8 +210,6 @@ module Bundler
|
|
202
210
|
|
203
211
|
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
204
212
|
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
205
|
-
rescue Errno::EEXIST => e
|
206
|
-
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
207
213
|
end
|
208
214
|
|
209
215
|
private
|
@@ -54,7 +54,7 @@ module Bundler
|
|
54
54
|
if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
|
55
55
|
local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
|
56
56
|
else
|
57
|
-
local_temp_path.open("
|
57
|
+
local_temp_path.open("wb") {|f| f << content }
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
data/lib/bundler/definition.rb
CHANGED
@@ -106,6 +106,17 @@ module Bundler
|
|
106
106
|
@locked_platforms = []
|
107
107
|
end
|
108
108
|
|
109
|
+
@locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
110
|
+
@disable_multisource = @locked_gem_sources.all?(&:disable_multisource?)
|
111
|
+
|
112
|
+
unless @disable_multisource
|
113
|
+
msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. You should run `bundle update` or generate your lockfile from scratch."
|
114
|
+
|
115
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
116
|
+
|
117
|
+
@sources.merged_gem_lockfile_sections!
|
118
|
+
end
|
119
|
+
|
109
120
|
@unlock[:gems] ||= []
|
110
121
|
@unlock[:sources] ||= []
|
111
122
|
@unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
|
@@ -145,6 +156,10 @@ module Bundler
|
|
145
156
|
end
|
146
157
|
end
|
147
158
|
|
159
|
+
def disable_multisource?
|
160
|
+
@disable_multisource
|
161
|
+
end
|
162
|
+
|
148
163
|
def resolve_with_cache!
|
149
164
|
raise "Specs already loaded" if @specs
|
150
165
|
sources.cached!
|
@@ -264,7 +279,7 @@ module Bundler
|
|
264
279
|
# Run a resolve against the locally available gems
|
265
280
|
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
266
281
|
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
|
267
|
-
Resolver.resolve(expanded_dependencies,
|
282
|
+
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
268
283
|
end
|
269
284
|
end
|
270
285
|
end
|
@@ -530,6 +545,9 @@ module Bundler
|
|
530
545
|
attr_reader :sources
|
531
546
|
private :sources
|
532
547
|
|
548
|
+
attr_reader :locked_gem_sources
|
549
|
+
private :locked_gem_sources
|
550
|
+
|
533
551
|
def nothing_changed?
|
534
552
|
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
|
535
553
|
end
|
@@ -594,7 +612,7 @@ module Bundler
|
|
594
612
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
595
613
|
locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
|
596
614
|
|
597
|
-
deps_for_source.sort != locked_deps_for_source.sort
|
615
|
+
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
598
616
|
end
|
599
617
|
|
600
618
|
def specs_for_source_changed?(source)
|
@@ -654,21 +672,20 @@ module Bundler
|
|
654
672
|
end
|
655
673
|
|
656
674
|
def converge_rubygems_sources
|
657
|
-
return false if
|
675
|
+
return false if disable_multisource?
|
658
676
|
|
659
|
-
|
677
|
+
return false if locked_gem_sources.empty?
|
660
678
|
|
661
|
-
# Get the RubyGems sources from the Gemfile.lock
|
662
|
-
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
663
679
|
# Get the RubyGems remotes from the Gemfile
|
664
680
|
actual_remotes = sources.rubygems_remotes
|
681
|
+
return false if actual_remotes.empty?
|
682
|
+
|
683
|
+
changes = false
|
665
684
|
|
666
685
|
# If there is a RubyGems source in both
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
671
|
-
end
|
686
|
+
locked_gem_sources.each do |locked_gem|
|
687
|
+
# Merge the remotes from the Gemfile into the Gemfile.lock
|
688
|
+
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
672
689
|
end
|
673
690
|
|
674
691
|
changes
|
@@ -893,30 +910,18 @@ module Bundler
|
|
893
910
|
# Record the specs available in each gem's source, so that those
|
894
911
|
# specs will be available later when the resolver knows where to
|
895
912
|
# look for that gemspec (or its dependencies)
|
896
|
-
|
897
|
-
source_requirements = { :default => default }
|
898
|
-
default = nil unless Bundler.feature_flag.disable_multisource?
|
899
|
-
dependencies.each do |dep|
|
900
|
-
next unless source = dep.source || default
|
901
|
-
source_requirements[dep.name] = source
|
902
|
-
end
|
913
|
+
source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
|
903
914
|
metadata_dependencies.each do |dep|
|
904
915
|
source_requirements[dep.name] = sources.metadata_source
|
905
916
|
end
|
917
|
+
source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
|
906
918
|
source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
|
907
919
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
908
920
|
source_requirements
|
909
921
|
end
|
910
922
|
|
911
923
|
def pinned_spec_names(skip = nil)
|
912
|
-
|
913
|
-
default = Bundler.feature_flag.disable_multisource? && sources.default_source
|
914
|
-
@dependencies.each do |dep|
|
915
|
-
next unless dep_source = dep.source || default
|
916
|
-
next if dep_source == skip
|
917
|
-
pinned_names << dep.name
|
918
|
-
end
|
919
|
-
pinned_names
|
924
|
+
dependency_source_requirements.reject {|_, source| source == skip }.keys
|
920
925
|
end
|
921
926
|
|
922
927
|
def requested_groups
|
@@ -973,5 +978,17 @@ module Bundler
|
|
973
978
|
|
974
979
|
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
975
980
|
end
|
981
|
+
|
982
|
+
def dependency_source_requirements
|
983
|
+
@dependency_source_requirements ||= begin
|
984
|
+
source_requirements = {}
|
985
|
+
default = sources.default_source
|
986
|
+
dependencies.each do |dep|
|
987
|
+
dep_source = dep.source || default
|
988
|
+
source_requirements[dep.name] = dep_source
|
989
|
+
end
|
990
|
+
source_requirements
|
991
|
+
end
|
992
|
+
end
|
976
993
|
end
|
977
994
|
end
|
data/lib/bundler/dsl.rb
CHANGED
@@ -24,6 +24,9 @@ module Bundler
|
|
24
24
|
def initialize
|
25
25
|
@source = nil
|
26
26
|
@sources = SourceList.new
|
27
|
+
|
28
|
+
@global_rubygems_sources = []
|
29
|
+
|
27
30
|
@git_sources = {}
|
28
31
|
@dependencies = []
|
29
32
|
@groups = []
|
@@ -45,6 +48,7 @@ module Bundler
|
|
45
48
|
@gemfiles << expanded_gemfile_path
|
46
49
|
contents ||= Bundler.read_file(@gemfile.to_s)
|
47
50
|
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
|
51
|
+
check_primary_source_safety
|
48
52
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
49
53
|
message = "There was an error " \
|
50
54
|
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
|
@@ -164,8 +168,7 @@ module Bundler
|
|
164
168
|
elsif block_given?
|
165
169
|
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
|
166
170
|
else
|
167
|
-
|
168
|
-
@sources.global_rubygems_source = source
|
171
|
+
@global_rubygems_sources << source
|
169
172
|
end
|
170
173
|
end
|
171
174
|
|
@@ -183,24 +186,14 @@ module Bundler
|
|
183
186
|
end
|
184
187
|
|
185
188
|
def path(path, options = {}, &blk)
|
186
|
-
unless block_given?
|
187
|
-
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
188
|
-
"either use the :path option on a gem, or specify the gems that \n" \
|
189
|
-
"bundler should find in the path source by passing a block to \n" \
|
190
|
-
"the path method, like: \n\n" \
|
191
|
-
" path 'dir/containing/rails' do\n" \
|
192
|
-
" gem 'rails'\n" \
|
193
|
-
" end\n\n"
|
194
|
-
|
195
|
-
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
|
196
|
-
SharedHelpers.major_deprecation(2, msg.strip)
|
197
|
-
end
|
198
|
-
|
199
189
|
source_options = normalize_hash(options).merge(
|
200
190
|
"path" => Pathname.new(path),
|
201
191
|
"root_path" => gemfile_root,
|
202
192
|
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
|
203
193
|
)
|
194
|
+
|
195
|
+
source_options["global"] = true unless block_given?
|
196
|
+
|
204
197
|
source = @sources.add_path_source(source_options)
|
205
198
|
with_source(source, &blk)
|
206
199
|
end
|
@@ -279,6 +272,11 @@ module Bundler
|
|
279
272
|
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
|
280
273
|
end
|
281
274
|
|
275
|
+
def check_primary_source_safety
|
276
|
+
check_path_source_safety
|
277
|
+
check_rubygems_source_safety
|
278
|
+
end
|
279
|
+
|
282
280
|
private
|
283
281
|
|
284
282
|
def add_git_sources
|
@@ -440,25 +438,38 @@ repo_name ||= user_name
|
|
440
438
|
end
|
441
439
|
end
|
442
440
|
|
443
|
-
def
|
444
|
-
return if
|
441
|
+
def check_path_source_safety
|
442
|
+
return if @sources.global_path_source.nil?
|
443
|
+
|
444
|
+
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
445
|
+
"either use the :path option on a gem, or specify the gems that \n" \
|
446
|
+
"bundler should find in the path source by passing a block to \n" \
|
447
|
+
"the path method, like: \n\n" \
|
448
|
+
" path 'dir/containing/rails' do\n" \
|
449
|
+
" gem 'rails'\n" \
|
450
|
+
" end\n\n"
|
451
|
+
|
452
|
+
SharedHelpers.major_deprecation(2, msg.strip)
|
453
|
+
end
|
454
|
+
|
455
|
+
def check_rubygems_source_safety
|
456
|
+
@sources.global_rubygems_source = @global_rubygems_sources.shift
|
457
|
+
return if @global_rubygems_sources.empty?
|
445
458
|
|
446
|
-
|
459
|
+
@global_rubygems_sources.each do |source|
|
460
|
+
@sources.add_rubygems_remote(source)
|
461
|
+
end
|
462
|
+
|
463
|
+
if Bundler.feature_flag.bundler_3_mode?
|
447
464
|
msg = "This Gemfile contains multiple primary sources. " \
|
448
465
|
"Each source after the first must include a block to indicate which gems " \
|
449
466
|
"should come from that source"
|
450
|
-
unless Bundler.feature_flag.bundler_2_mode?
|
451
|
-
msg += ". To downgrade this error to a warning, run " \
|
452
|
-
"`bundle config unset disable_multisource`"
|
453
|
-
end
|
454
467
|
raise GemfileEvalError, msg
|
455
468
|
else
|
456
469
|
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
|
457
470
|
"Using `source` more than once without a block is a security risk, and " \
|
458
471
|
"may result in installing unexpected gems. To resolve this warning, use " \
|
459
|
-
"a block to indicate which gems should come from the secondary source.
|
460
|
-
"To upgrade this warning to an error, run `bundle config set --local " \
|
461
|
-
"disable_multisource true`."
|
472
|
+
"a block to indicate which gems should come from the secondary source."
|
462
473
|
end
|
463
474
|
end
|
464
475
|
|
data/lib/bundler/inline.rb
CHANGED
@@ -50,6 +50,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
50
50
|
Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
|
51
51
|
builder = Bundler::Dsl.new
|
52
52
|
builder.instance_eval(&gemfile)
|
53
|
+
builder.check_primary_source_safety
|
53
54
|
|
54
55
|
Bundler.settings.temporary(:frozen => false) do
|
55
56
|
definition = builder.to_definition(nil, true)
|
data/lib/bundler/installer.rb
CHANGED
@@ -89,6 +89,8 @@ module Bundler
|
|
89
89
|
end
|
90
90
|
install(options)
|
91
91
|
|
92
|
+
Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
|
93
|
+
|
92
94
|
lock unless Bundler.frozen_bundle?
|
93
95
|
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
|
94
96
|
end
|
@@ -27,13 +27,8 @@ module Bundler
|
|
27
27
|
state == :failed
|
28
28
|
end
|
29
29
|
|
30
|
-
def installation_attempted?
|
31
|
-
installed? || failed?
|
32
|
-
end
|
33
|
-
|
34
|
-
# Only true when spec in neither installed nor already enqueued
|
35
30
|
def ready_to_enqueue?
|
36
|
-
|
31
|
+
state == :none
|
37
32
|
end
|
38
33
|
|
39
34
|
def has_post_install_message?
|
@@ -93,6 +88,11 @@ module Bundler
|
|
93
88
|
def call
|
94
89
|
check_for_corrupt_lockfile
|
95
90
|
|
91
|
+
if @rake
|
92
|
+
do_install(@rake, 0)
|
93
|
+
Gem::Specification.reset
|
94
|
+
end
|
95
|
+
|
96
96
|
if @size > 1
|
97
97
|
install_with_worker
|
98
98
|
else
|
@@ -217,8 +217,6 @@ module Bundler
|
|
217
217
|
# are installed.
|
218
218
|
def enqueue_specs
|
219
219
|
@specs.select(&:ready_to_enqueue?).each do |spec|
|
220
|
-
next if @rake && !@rake.installed? && spec.name != @rake.name
|
221
|
-
|
222
220
|
if spec.dependencies_installed? @specs
|
223
221
|
spec.state = :enqueued
|
224
222
|
worker_pool.enq spec
|
@@ -64,8 +64,6 @@ module Bundler
|
|
64
64
|
@state = nil
|
65
65
|
@specs = {}
|
66
66
|
|
67
|
-
@rubygems_aggregate = Source::Rubygems.new
|
68
|
-
|
69
67
|
if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
|
70
68
|
raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
|
71
69
|
"Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
|
@@ -89,7 +87,6 @@ module Bundler
|
|
89
87
|
send("parse_#{@state}", line)
|
90
88
|
end
|
91
89
|
end
|
92
|
-
@sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
|
93
90
|
@specs = @specs.values.sort_by(&:identifier)
|
94
91
|
warn_for_outdated_bundler_version
|
95
92
|
rescue ArgumentError => e
|
@@ -134,16 +131,9 @@ module Bundler
|
|
134
131
|
@sources << @current_source
|
135
132
|
end
|
136
133
|
when GEM
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
@sources << @current_source
|
141
|
-
else
|
142
|
-
Array(@opts["remote"]).each do |url|
|
143
|
-
@rubygems_aggregate.add_remote(url)
|
144
|
-
end
|
145
|
-
@current_source = @rubygems_aggregate
|
146
|
-
end
|
134
|
+
@opts["remotes"] = Array(@opts.delete("remote")).reverse
|
135
|
+
@current_source = TYPES[@type].from_lock(@opts)
|
136
|
+
@sources << @current_source
|
147
137
|
when PLUGIN
|
148
138
|
@current_source = Plugin.source_from_lock(@opts)
|
149
139
|
@sources << @current_source
|
@@ -211,10 +211,10 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|
211
211
|
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
|
212
212
|
.
|
213
213
|
.IP "\(bu" 4
|
214
|
-
\fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR) Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
|
214
|
+
\fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR): Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
|
215
215
|
.
|
216
216
|
.IP "\(bu" 4
|
217
|
-
\fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1\.
|
217
|
+
\fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1 on Windows, and to the the number of processors on other platforms\.
|
218
218
|
.
|
219
219
|
.IP "\(bu" 4
|
220
220
|
\fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
|
@@ -241,7 +241,7 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|
241
241
|
\fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
|
242
242
|
.
|
243
243
|
.IP "\(bu" 4
|
244
|
-
\fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR) Print only version number from \fBbundler \-\-version\fR\.
|
244
|
+
\fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR): Print only version number from \fBbundler \-\-version\fR\.
|
245
245
|
.
|
246
246
|
.IP "\(bu" 4
|
247
247
|
\fBredirect\fR (\fBBUNDLE_REDIRECT\fR): The number of redirects allowed for network requests\. Defaults to \fB5\fR\.
|
@@ -283,7 +283,7 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|
283
283
|
\fBunlock_source_unlocks_spec\fR (\fBBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC\fR): Whether running \fBbundle update \-\-source NAME\fR unlocks a gem with the given name\. Defaults to \fBtrue\fR\.
|
284
284
|
.
|
285
285
|
.IP "\(bu" 4
|
286
|
-
\fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR) Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
|
286
|
+
\fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR): Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
|
287
287
|
.
|
288
288
|
.IP "\(bu" 4
|
289
289
|
\fBuser_agent\fR (\fBBUNDLE_USER_AGENT\fR): The custom user agent fragment Bundler includes in API requests\.
|
@@ -206,13 +206,14 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|
206
206
|
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
|
207
207
|
Whether Bundler should cache all gems globally, rather than locally to the
|
208
208
|
installing Ruby installation.
|
209
|
-
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
|
210
|
-
messages will be printed. To silence a single gem,
|
211
|
-
`ignore_messages.httparty true`.
|
212
|
-
* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`)
|
209
|
+
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
|
210
|
+
When set, no post install messages will be printed. To silence a single gem,
|
211
|
+
use dot notation like `ignore_messages.httparty true`.
|
212
|
+
* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`):
|
213
213
|
Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
|
214
214
|
* `jobs` (`BUNDLE_JOBS`):
|
215
|
-
The number of gems Bundler can install in parallel. Defaults to 1
|
215
|
+
The number of gems Bundler can install in parallel. Defaults to 1 on Windows,
|
216
|
+
and to the the number of processors on other platforms.
|
216
217
|
* `no_install` (`BUNDLE_NO_INSTALL`):
|
217
218
|
Whether `bundle package` should skip installing gems.
|
218
219
|
* `no_prune` (`BUNDLE_NO_PRUNE`):
|
@@ -233,7 +234,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|
233
234
|
Enable Bundler's experimental plugin system.
|
234
235
|
* `prefer_patch` (BUNDLE_PREFER_PATCH):
|
235
236
|
Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`.
|
236
|
-
* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`)
|
237
|
+
* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`):
|
237
238
|
Print only version number from `bundler --version`.
|
238
239
|
* `redirect` (`BUNDLE_REDIRECT`):
|
239
240
|
The number of redirects allowed for network requests. Defaults to `5`.
|
@@ -269,7 +270,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|
269
270
|
* `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`):
|
270
271
|
Whether running `bundle update --source NAME` unlocks a gem with the given
|
271
272
|
name. Defaults to `true`.
|
272
|
-
* `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`)
|
273
|
+
* `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`):
|
273
274
|
Require passing `--all` to `bundle update` when everything should be updated,
|
274
275
|
and disallow passing no options to `bundle update`.
|
275
276
|
* `user_agent` (`BUNDLE_USER_AGENT`):
|
data/lib/bundler/plugin.rb
CHANGED
@@ -140,6 +140,13 @@ module Bundler
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
# Set internal representation to fetch the gems/specs locally.
|
144
|
+
#
|
145
|
+
# When this is called, the source should try to fetch the specs and
|
146
|
+
# install from the local system.
|
147
|
+
def local!
|
148
|
+
end
|
149
|
+
|
143
150
|
# Set internal representation to fetch the gems/specs from remote.
|
144
151
|
#
|
145
152
|
# When this is called, the source should try to fetch the specs and
|
@@ -16,15 +16,13 @@ module Bundler
|
|
16
16
|
|
17
17
|
version = options[:version] || [">= 0"]
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
install_rubygems(names, version, sources)
|
27
|
-
end
|
19
|
+
if options[:git]
|
20
|
+
install_git(names, version, options)
|
21
|
+
elsif options[:local_git]
|
22
|
+
install_local_git(names, version, options)
|
23
|
+
else
|
24
|
+
sources = options[:source] || Bundler.rubygems.sources
|
25
|
+
install_rubygems(names, version, sources)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -79,7 +77,7 @@ module Bundler
|
|
79
77
|
source_list = SourceList.new
|
80
78
|
|
81
79
|
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
-
source_list.
|
80
|
+
source_list.global_rubygems_source = rubygems_source if rubygems_source
|
83
81
|
|
84
82
|
deps = names.map {|name| Dependency.new name, version }
|
85
83
|
|
data/lib/bundler/resolver.rb
CHANGED
@@ -17,16 +17,21 @@ module Bundler
|
|
17
17
|
# ==== Returns
|
18
18
|
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
19
19
|
# collection of gemspecs is returned. Otherwise, nil is returned.
|
20
|
-
def self.resolve(requirements,
|
20
|
+
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
21
21
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
22
|
-
resolver = new(
|
22
|
+
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
23
23
|
result = resolver.start(requirements)
|
24
24
|
SpecSet.new(result)
|
25
25
|
end
|
26
26
|
|
27
|
-
def initialize(
|
28
|
-
@index = index
|
27
|
+
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
29
28
|
@source_requirements = source_requirements
|
29
|
+
|
30
|
+
@index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
|
31
|
+
name, source = source_requirement
|
32
|
+
index_requirements[name] = name == :global ? source : source.specs
|
33
|
+
end
|
34
|
+
|
30
35
|
@base = base
|
31
36
|
@resolver = Molinillo::Resolver.new(self, self)
|
32
37
|
@search_for = {}
|
@@ -36,14 +41,14 @@ module Bundler
|
|
36
41
|
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
37
42
|
end
|
38
43
|
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
39
|
-
@platforms = platforms
|
44
|
+
@platforms = platforms.reject {|p| p != Gem::Platform::RUBY && (platforms - [p]).any? {|pl| generic(pl) == p } }
|
40
45
|
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
41
46
|
@gem_version_promoter = gem_version_promoter
|
42
47
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
43
|
-
@
|
48
|
+
@no_aggregate_global_source = @source_requirements[:global].nil?
|
44
49
|
|
45
50
|
@variant_specific_names = []
|
46
|
-
@generic_names = []
|
51
|
+
@generic_names = ["Ruby\0", "RubyGems\0"]
|
47
52
|
end
|
48
53
|
|
49
54
|
def start(requirements)
|
@@ -125,8 +130,7 @@ module Bundler
|
|
125
130
|
dependency = dependency_proxy.dep
|
126
131
|
name = dependency.name
|
127
132
|
search_result = @search_for[dependency_proxy] ||= begin
|
128
|
-
|
129
|
-
results = index.search(dependency, @base[name])
|
133
|
+
results = results_for(dependency, @base[name])
|
130
134
|
|
131
135
|
if vertex = @base_dg.vertex_named(name)
|
132
136
|
locked_requirement = vertex.payload.requirement
|
@@ -196,22 +200,22 @@ module Bundler
|
|
196
200
|
end
|
197
201
|
|
198
202
|
def index_for(dependency)
|
199
|
-
source = @
|
203
|
+
source = @index_requirements[dependency.name]
|
200
204
|
if source
|
201
|
-
source
|
202
|
-
elsif @
|
205
|
+
source
|
206
|
+
elsif @no_aggregate_global_source
|
203
207
|
Index.build do |idx|
|
204
|
-
|
205
|
-
dependency.all_sources.each {|s| idx.add_source(s.specs) if s }
|
206
|
-
else
|
207
|
-
idx.add_source @source_requirements[:default].specs
|
208
|
-
end
|
208
|
+
dependency.all_sources.each {|s| idx.add_source(s.specs) }
|
209
209
|
end
|
210
210
|
else
|
211
|
-
@
|
211
|
+
@index_requirements[:global]
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
+
def results_for(dependency, base)
|
216
|
+
index_for(dependency).search(dependency, base)
|
217
|
+
end
|
218
|
+
|
215
219
|
def name_for(dependency)
|
216
220
|
dependency.name
|
217
221
|
end
|
@@ -239,18 +243,20 @@ module Bundler
|
|
239
243
|
def relevant_sources_for_vertex(vertex)
|
240
244
|
if vertex.root?
|
241
245
|
[@source_requirements[vertex.name]]
|
242
|
-
elsif @
|
246
|
+
elsif @no_aggregate_global_source
|
243
247
|
vertex.recursive_predecessors.map do |v|
|
244
248
|
@source_requirements[v.name]
|
245
|
-
end << @source_requirements[:default]
|
249
|
+
end.compact << @source_requirements[:default]
|
250
|
+
else
|
251
|
+
[]
|
246
252
|
end
|
247
253
|
end
|
248
254
|
|
249
255
|
def sort_dependencies(dependencies, activated, conflicts)
|
250
256
|
dependencies.sort_by do |dependency|
|
251
|
-
dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
|
252
257
|
name = name_for(dependency)
|
253
258
|
vertex = activated.vertex_named(name)
|
259
|
+
dependency.all_sources = relevant_sources_for_vertex(vertex)
|
254
260
|
[
|
255
261
|
@base_dg.vertex_named(name) ? 0 : 1,
|
256
262
|
vertex.payload ? 0 : 1,
|
@@ -317,7 +323,7 @@ module Bundler
|
|
317
323
|
"If you are updating multiple gems in your Gemfile at once,\n" \
|
318
324
|
"try passing them all to `bundle update`"
|
319
325
|
elsif source = @source_requirements[name]
|
320
|
-
specs = source.specs
|
326
|
+
specs = source.specs.search(name)
|
321
327
|
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
|
322
328
|
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
|
323
329
|
message << if versions_with_platforms.any?
|
@@ -326,7 +332,7 @@ module Bundler
|
|
326
332
|
"The source does not contain any versions of '#{name}'"
|
327
333
|
end
|
328
334
|
else
|
329
|
-
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
335
|
+
message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
|
330
336
|
"listed in your Gemfile#{cache_message}."
|
331
337
|
end
|
332
338
|
raise GemNotFound, message
|
@@ -392,7 +398,7 @@ module Bundler
|
|
392
398
|
if other_bundler_required
|
393
399
|
o << "\n\n"
|
394
400
|
|
395
|
-
candidate_specs = @
|
401
|
+
candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
|
396
402
|
if candidate_specs.any?
|
397
403
|
target_version = candidate_specs.last.version
|
398
404
|
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
@@ -411,14 +417,8 @@ module Bundler
|
|
411
417
|
|
412
418
|
relevant_sources = if conflict.requirement.source
|
413
419
|
[conflict.requirement.source]
|
414
|
-
elsif conflict.requirement.all_sources
|
415
|
-
conflict.requirement.all_sources
|
416
|
-
elsif @lockfile_uses_separate_rubygems_sources
|
417
|
-
# every conflict should have an explicit group of sources when we
|
418
|
-
# enforce strict pinning
|
419
|
-
raise "no source set for #{conflict}"
|
420
420
|
else
|
421
|
-
|
421
|
+
conflict.requirement.all_sources
|
422
422
|
end.compact.map(&:to_s).uniq.sort
|
423
423
|
|
424
424
|
metadata_requirement = name.end_with?("\0")
|
@@ -455,23 +455,21 @@ module Bundler
|
|
455
455
|
def validate_resolved_specs!(resolved_specs)
|
456
456
|
resolved_specs.each do |v|
|
457
457
|
name = v.name
|
458
|
-
|
459
|
-
sources.
|
458
|
+
sources = relevant_sources_for_vertex(v)
|
459
|
+
next unless sources.any?
|
460
460
|
if default_index = sources.index(@source_requirements[:default])
|
461
461
|
sources.delete_at(default_index)
|
462
462
|
end
|
463
|
-
sources.reject! {|s| s.specs
|
463
|
+
sources.reject! {|s| s.specs.search(name).empty? }
|
464
464
|
sources.uniq!
|
465
465
|
next if sources.size <= 1
|
466
466
|
|
467
|
-
multisource_disabled = Bundler.feature_flag.disable_multisource?
|
468
|
-
|
469
467
|
msg = ["The gem '#{name}' was found in multiple relevant sources."]
|
470
468
|
msg.concat sources.map {|s| " * #{s}" }.sort
|
471
|
-
msg << "You #{
|
469
|
+
msg << "You #{@no_aggregate_global_source ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
472
470
|
msg = msg.join("\n")
|
473
471
|
|
474
|
-
raise SecurityError, msg if
|
472
|
+
raise SecurityError, msg if @no_aggregate_global_source
|
475
473
|
Bundler.ui.warn "Warning: #{msg}"
|
476
474
|
end
|
477
475
|
end
|
@@ -8,6 +8,53 @@ module Bundler
|
|
8
8
|
# Bundler needs to install gems regardless of binstub overwriting
|
9
9
|
end
|
10
10
|
|
11
|
+
def install
|
12
|
+
pre_install_checks
|
13
|
+
|
14
|
+
run_pre_install_hooks
|
15
|
+
|
16
|
+
spec.loaded_from = spec_file
|
17
|
+
|
18
|
+
# Completely remove any previous gem files
|
19
|
+
FileUtils.rm_rf gem_dir
|
20
|
+
FileUtils.rm_rf spec.extension_dir
|
21
|
+
|
22
|
+
FileUtils.mkdir_p gem_dir, :mode => 0o755
|
23
|
+
|
24
|
+
extract_files
|
25
|
+
|
26
|
+
build_extensions
|
27
|
+
write_build_info_file
|
28
|
+
run_post_build_hooks
|
29
|
+
|
30
|
+
generate_bin
|
31
|
+
generate_plugins
|
32
|
+
|
33
|
+
write_spec
|
34
|
+
write_cache_file
|
35
|
+
|
36
|
+
say spec.post_install_message unless spec.post_install_message.nil?
|
37
|
+
|
38
|
+
run_post_install_hooks
|
39
|
+
|
40
|
+
spec
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_plugins
|
44
|
+
return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
|
45
|
+
|
46
|
+
latest = Gem::Specification.stubs_for(spec.name).first
|
47
|
+
return if latest && latest.version > spec.version
|
48
|
+
|
49
|
+
ensure_writable_dir @plugins_dir
|
50
|
+
|
51
|
+
if spec.plugins.empty?
|
52
|
+
remove_plugins_for(spec, @plugins_dir)
|
53
|
+
else
|
54
|
+
regenerate_plugins_for(spec, @plugins_dir)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
11
58
|
def pre_install_checks
|
12
59
|
super && validate_bundler_checksum(options[:bundler_expected_checksum])
|
13
60
|
end
|
data/lib/bundler/source.rb
CHANGED
@@ -33,6 +33,12 @@ module Bundler
|
|
33
33
|
spec.source == self
|
34
34
|
end
|
35
35
|
|
36
|
+
def local!; end
|
37
|
+
|
38
|
+
def cached!; end
|
39
|
+
|
40
|
+
def remote!; end
|
41
|
+
|
36
42
|
# it's possible that gems from one source depend on gems from some
|
37
43
|
# other source, so now we download gemspecs and iterate over those
|
38
44
|
# dependencies, looking for gems we don't have info on yet.
|
@@ -20,17 +20,29 @@ module Bundler
|
|
20
20
|
@dependency_names = []
|
21
21
|
@allow_remote = false
|
22
22
|
@allow_cached = false
|
23
|
+
@allow_local = options["allow_local"] || false
|
23
24
|
@caches = [cache_path, *Bundler.rubygems.gem_cache]
|
24
25
|
|
25
|
-
Array(options["remotes"]
|
26
|
+
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def local!
|
30
|
+
return if @allow_local
|
31
|
+
|
32
|
+
@specs = nil
|
33
|
+
@allow_local = true
|
26
34
|
end
|
27
35
|
|
28
36
|
def remote!
|
37
|
+
return if @allow_remote
|
38
|
+
|
29
39
|
@specs = nil
|
30
40
|
@allow_remote = true
|
31
41
|
end
|
32
42
|
|
33
43
|
def cached!
|
44
|
+
return if @allow_cached
|
45
|
+
|
34
46
|
@specs = nil
|
35
47
|
@allow_cached = true
|
36
48
|
end
|
@@ -49,8 +61,12 @@ module Bundler
|
|
49
61
|
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
|
50
62
|
end
|
51
63
|
|
64
|
+
def disable_multisource?
|
65
|
+
@remotes.size <= 1
|
66
|
+
end
|
67
|
+
|
52
68
|
def can_lock?(spec)
|
53
|
-
return super if
|
69
|
+
return super if disable_multisource?
|
54
70
|
spec.source.is_a?(Rubygems)
|
55
71
|
end
|
56
72
|
|
@@ -87,7 +103,7 @@ module Bundler
|
|
87
103
|
# small_idx.use large_idx.
|
88
104
|
idx = @allow_remote ? remote_specs.dup : Index.new
|
89
105
|
idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
|
90
|
-
idx.use(installed_specs, :override_dupes)
|
106
|
+
idx.use(installed_specs, :override_dupes) if @allow_local
|
91
107
|
idx
|
92
108
|
end
|
93
109
|
end
|
@@ -365,7 +381,7 @@ module Bundler
|
|
365
381
|
|
366
382
|
def cached_specs
|
367
383
|
@cached_specs ||= begin
|
368
|
-
idx = installed_specs.dup
|
384
|
+
idx = @allow_local ? installed_specs.dup : Index.new
|
369
385
|
|
370
386
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
371
387
|
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
|
data/lib/bundler/source_list.rb
CHANGED
@@ -5,24 +5,40 @@ module Bundler
|
|
5
5
|
attr_reader :path_sources,
|
6
6
|
:git_sources,
|
7
7
|
:plugin_sources,
|
8
|
-
:
|
8
|
+
:global_path_source,
|
9
9
|
:metadata_source
|
10
10
|
|
11
|
+
def global_rubygems_source
|
12
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
|
13
|
+
end
|
14
|
+
|
11
15
|
def initialize
|
12
16
|
@path_sources = []
|
13
17
|
@git_sources = []
|
14
18
|
@plugin_sources = []
|
15
19
|
@global_rubygems_source = nil
|
16
|
-
@
|
20
|
+
@global_path_source = nil
|
17
21
|
@rubygems_sources = []
|
18
22
|
@metadata_source = Source::Metadata.new
|
23
|
+
|
24
|
+
@disable_multisource = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def disable_multisource?
|
28
|
+
@disable_multisource
|
29
|
+
end
|
30
|
+
|
31
|
+
def merged_gem_lockfile_sections!
|
32
|
+
@disable_multisource = false
|
19
33
|
end
|
20
34
|
|
21
35
|
def add_path_source(options = {})
|
22
36
|
if options["gemspec"]
|
23
37
|
add_source_to_list Source::Gemspec.new(options), path_sources
|
24
38
|
else
|
25
|
-
add_source_to_list Source::Path.new(options), path_sources
|
39
|
+
path_source = add_source_to_list Source::Path.new(options), path_sources
|
40
|
+
@global_path_source ||= path_source if options["global"]
|
41
|
+
path_source
|
26
42
|
end
|
27
43
|
end
|
28
44
|
|
@@ -41,24 +57,20 @@ module Bundler
|
|
41
57
|
end
|
42
58
|
|
43
59
|
def global_rubygems_source=(uri)
|
44
|
-
|
45
|
-
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
|
46
|
-
end
|
47
|
-
add_rubygems_remote(uri)
|
60
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri, "allow_local" => true)
|
48
61
|
end
|
49
62
|
|
50
63
|
def add_rubygems_remote(uri)
|
51
|
-
|
52
|
-
|
53
|
-
@rubygems_aggregate
|
64
|
+
global_rubygems_source.add_remote(uri)
|
65
|
+
global_rubygems_source
|
54
66
|
end
|
55
67
|
|
56
68
|
def default_source
|
57
|
-
|
69
|
+
global_path_source || global_rubygems_source
|
58
70
|
end
|
59
71
|
|
60
72
|
def rubygems_sources
|
61
|
-
@rubygems_sources + [
|
73
|
+
@rubygems_sources + [global_rubygems_source]
|
62
74
|
end
|
63
75
|
|
64
76
|
def rubygems_remotes
|
@@ -75,7 +87,7 @@ module Bundler
|
|
75
87
|
|
76
88
|
def lock_sources
|
77
89
|
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
78
|
-
if
|
90
|
+
if disable_multisource?
|
79
91
|
lock_sources + rubygems_sources.sort_by(&:to_s)
|
80
92
|
else
|
81
93
|
lock_sources << combine_rubygems_sources
|
@@ -92,12 +104,11 @@ module Bundler
|
|
92
104
|
end
|
93
105
|
end
|
94
106
|
|
95
|
-
replacement_rubygems = !
|
107
|
+
replacement_rubygems = !disable_multisource? &&
|
96
108
|
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
97
|
-
@
|
109
|
+
@global_rubygems_source = replacement_rubygems if replacement_rubygems
|
98
110
|
|
99
111
|
return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
|
100
|
-
return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
|
101
112
|
|
102
113
|
false
|
103
114
|
end
|
@@ -110,10 +121,6 @@ module Bundler
|
|
110
121
|
all_sources.each(&:remote!)
|
111
122
|
end
|
112
123
|
|
113
|
-
def rubygems_primary_remotes
|
114
|
-
@rubygems_aggregate.remotes
|
115
|
-
end
|
116
|
-
|
117
124
|
private
|
118
125
|
|
119
126
|
def rubygems_aggregate_class
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -82,6 +82,7 @@ module Bundler
|
|
82
82
|
materialized.map! do |s|
|
83
83
|
next s unless s.is_a?(LazySpecification)
|
84
84
|
s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
|
85
|
+
s.source.local!
|
85
86
|
spec = s.__materialize__
|
86
87
|
unless spec
|
87
88
|
unless missing_specs
|
@@ -102,6 +103,7 @@ module Bundler
|
|
102
103
|
@specs.map do |s|
|
103
104
|
next s unless s.is_a?(LazySpecification)
|
104
105
|
s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
|
106
|
+
s.source.local!
|
105
107
|
s.source.remote!
|
106
108
|
spec = s.__materialize__
|
107
109
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
@@ -26,11 +26,19 @@ module Bundler
|
|
26
26
|
|
27
27
|
# @!group Stub Delegates
|
28
28
|
|
29
|
+
def manually_installed?
|
30
|
+
# This is for manually installed gems which are gems that were fixed in place after a
|
31
|
+
# failed installation. Once the issue was resolved, the user then manually created
|
32
|
+
# the gem specification using the instructions provided by `gem help install`
|
33
|
+
installed_by_version == Gem::Version.new(0)
|
34
|
+
end
|
35
|
+
|
29
36
|
# This is defined directly to avoid having to loading the full spec
|
30
37
|
def missing_extensions?
|
31
38
|
return false if default_gem?
|
32
39
|
return false if extensions.empty?
|
33
40
|
return false if File.exist? gem_build_complete_path
|
41
|
+
return false if manually_installed?
|
34
42
|
|
35
43
|
true
|
36
44
|
end
|
@@ -29,19 +29,21 @@ TODO: Write usage instructions here
|
|
29
29
|
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
|
30
30
|
|
31
31
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
<% if config[:git] -%>
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
|
37
|
+
<% end -%>
|
36
38
|
<% if config[:mit] -%>
|
37
39
|
|
38
40
|
## License
|
39
41
|
|
40
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
43
|
<% end -%>
|
42
|
-
<% if config[:coc] -%>
|
44
|
+
<% if config[:git] && config[:coc] -%>
|
43
45
|
|
44
46
|
## Code of Conduct
|
45
47
|
|
46
|
-
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
48
|
+
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
|
47
49
|
<% end -%>
|
data/lib/bundler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Arko
|
@@ -22,7 +22,7 @@ authors:
|
|
22
22
|
autorequire:
|
23
23
|
bindir: exe
|
24
24
|
cert_chain: []
|
25
|
-
date: 2021-
|
25
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
26
26
|
dependencies: []
|
27
27
|
description: Bundler manages an application's dependencies through its entire life,
|
28
28
|
across many machines, systematically and repeatably
|
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
352
352
|
- !ruby/object:Gem::Version
|
353
353
|
version: 2.5.2
|
354
354
|
requirements: []
|
355
|
-
rubygems_version: 3.2.
|
355
|
+
rubygems_version: 3.2.14
|
356
356
|
signing_key:
|
357
357
|
specification_version: 4
|
358
358
|
summary: The best way to manage your application's dependencies
|