rubygems-update 3.2.12 → 3.2.17
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -8
- data/CONTRIBUTING.md +2 -2
- data/Manifest.txt +1 -0
- data/Rakefile +7 -8
- data/bundler/CHANGELOG.md +79 -5
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +3 -2
- data/bundler/lib/bundler/cli/common.rb +15 -2
- data/bundler/lib/bundler/cli/gem.rb +31 -17
- data/bundler/lib/bundler/cli/outdated.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/updater.rb +10 -6
- data/bundler/lib/bundler/current_ruby.rb +1 -0
- data/bundler/lib/bundler/definition.rb +49 -34
- data/bundler/lib/bundler/dsl.rb +36 -25
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher.rb +2 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +8 -4
- data/bundler/lib/bundler/gem_helper.rb +16 -0
- data/bundler/lib/bundler/injector.rb +2 -2
- data/bundler/lib/bundler/inline.rb +2 -1
- data/bundler/lib/bundler/installer/parallel_installer.rb +36 -15
- data/bundler/lib/bundler/lazy_specification.rb +6 -1
- data/bundler/lib/bundler/lockfile_parser.rb +3 -13
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +21 -4
- data/bundler/lib/bundler/man/bundle-config.1.ronn +21 -3
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/plugin.rb +3 -2
- data/bundler/lib/bundler/plugin/api/source.rb +7 -0
- data/bundler/lib/bundler/plugin/installer.rb +8 -10
- data/bundler/lib/bundler/plugin/source_list.rb +4 -0
- data/bundler/lib/bundler/resolver.rb +34 -36
- data/bundler/lib/bundler/retry.rb +1 -1
- data/bundler/lib/bundler/settings.rb +60 -10
- data/bundler/lib/bundler/source.rb +6 -0
- data/bundler/lib/bundler/source/metadata.rb +0 -4
- data/bundler/lib/bundler/source/path.rb +3 -1
- data/bundler/lib/bundler/source/path/installer.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +22 -6
- data/bundler/lib/bundler/source_list.rb +28 -21
- data/bundler/lib/bundler/spec_set.rb +18 -5
- data/bundler/lib/bundler/templates/Gemfile +1 -1
- data/bundler/lib/bundler/templates/gems.rb +1 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +1 -1
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +4 -4
- data/lib/rubygems/commands/install_command.rb +1 -1
- data/lib/rubygems/commands/open_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +21 -3
- data/lib/rubygems/commands/yank_command.rb +1 -1
- data/lib/rubygems/core_ext/tcpsocket_init.rb +4 -1
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/deprecate.rb +3 -1
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/installer.rb +5 -2
- data/lib/rubygems/package.rb +1 -8
- data/lib/rubygems/remote_fetcher.rb +3 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
- data/lib/rubygems/security/trust_dir.rb +1 -0
- data/lib/rubygems/test_utilities.rb +1 -1
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
- data/test/rubygems/test_deprecate.rb +46 -2
- data/test/rubygems/test_gem.rb +2 -8
- data/test/rubygems/test_gem_commands_update_command.rb +28 -1
- data/test/rubygems/test_gem_installer.rb +20 -0
- data/test/rubygems/test_gem_package.rb +1 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +38 -6
- metadata +4 -3
|
@@ -72,7 +72,7 @@ module Bundler
|
|
|
72
72
|
gemfile_specs + dependency_specs
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
specs.sort_by(&:name).each do |current_spec|
|
|
75
|
+
specs.sort_by(&:name).uniq(&:name).each do |current_spec|
|
|
76
76
|
next unless gems.empty? || gems.include?(current_spec.name)
|
|
77
77
|
|
|
78
78
|
active_spec = retrieve_active_spec(definition, current_spec)
|
|
@@ -50,16 +50,20 @@ module Bundler
|
|
|
50
50
|
|
|
51
51
|
content = response.body
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
|
|
54
|
+
correct_response = SharedHelpers.filesystem_access(local_temp_path) do
|
|
54
55
|
if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
|
|
55
56
|
local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
|
|
57
|
+
|
|
58
|
+
etag_for(local_temp_path) == etag
|
|
56
59
|
else
|
|
57
|
-
local_temp_path.open("
|
|
60
|
+
local_temp_path.open("wb") {|f| f << content }
|
|
61
|
+
|
|
62
|
+
etag.length.zero? || etag_for(local_temp_path) == etag
|
|
58
63
|
end
|
|
59
64
|
end
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
if etag.length.zero? || etag_for(local_temp_path) == etag
|
|
66
|
+
if correct_response
|
|
63
67
|
SharedHelpers.filesystem_access(local_path) do
|
|
64
68
|
FileUtils.mv(local_temp_path, local_path)
|
|
65
69
|
end
|
|
@@ -92,11 +96,11 @@ module Bundler
|
|
|
92
96
|
|
|
93
97
|
def checksum_for_file(path)
|
|
94
98
|
return nil unless path.file?
|
|
95
|
-
# This must use
|
|
99
|
+
# This must use File.read instead of Digest.file().hexdigest
|
|
96
100
|
# because we need to preserve \n line endings on windows when calculating
|
|
97
101
|
# the checksum
|
|
98
102
|
SharedHelpers.filesystem_access(path, :read) do
|
|
99
|
-
SharedHelpers.digest(:MD5).hexdigest(
|
|
103
|
+
SharedHelpers.digest(:MD5).hexdigest(File.read(path))
|
|
100
104
|
end
|
|
101
105
|
end
|
|
102
106
|
end
|
|
@@ -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,17 +156,19 @@ 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
|
-
raise "Specs already loaded" if @specs
|
|
150
164
|
sources.cached!
|
|
151
|
-
|
|
165
|
+
resolve
|
|
152
166
|
end
|
|
153
167
|
|
|
154
168
|
def resolve_remotely!
|
|
155
|
-
return if @specs
|
|
156
169
|
@remote = true
|
|
157
170
|
sources.remote!
|
|
158
|
-
|
|
171
|
+
resolve
|
|
159
172
|
end
|
|
160
173
|
|
|
161
174
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
|
@@ -172,10 +185,10 @@ module Bundler
|
|
|
172
185
|
gem_name, gem_version = extract_gem_info(e)
|
|
173
186
|
locked_gem = @locked_specs[gem_name].last
|
|
174
187
|
raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
|
|
175
|
-
raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version
|
|
176
|
-
"be found in
|
|
177
|
-
"
|
|
178
|
-
"
|
|
188
|
+
raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
|
189
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
|
190
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
|
191
|
+
"removed in order to install."
|
|
179
192
|
end
|
|
180
193
|
unless specs["bundler"].any?
|
|
181
194
|
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
|
|
@@ -264,7 +277,7 @@ module Bundler
|
|
|
264
277
|
# Run a resolve against the locally available gems
|
|
265
278
|
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
|
266
279
|
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
|
|
267
|
-
Resolver.resolve(expanded_dependencies,
|
|
280
|
+
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
|
268
281
|
end
|
|
269
282
|
end
|
|
270
283
|
end
|
|
@@ -530,6 +543,9 @@ module Bundler
|
|
|
530
543
|
attr_reader :sources
|
|
531
544
|
private :sources
|
|
532
545
|
|
|
546
|
+
attr_reader :locked_gem_sources
|
|
547
|
+
private :locked_gem_sources
|
|
548
|
+
|
|
533
549
|
def nothing_changed?
|
|
534
550
|
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
|
|
535
551
|
end
|
|
@@ -654,21 +670,20 @@ module Bundler
|
|
|
654
670
|
end
|
|
655
671
|
|
|
656
672
|
def converge_rubygems_sources
|
|
657
|
-
return false if
|
|
673
|
+
return false if disable_multisource?
|
|
658
674
|
|
|
659
|
-
|
|
675
|
+
return false if locked_gem_sources.empty?
|
|
660
676
|
|
|
661
|
-
# Get the RubyGems sources from the Gemfile.lock
|
|
662
|
-
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
|
663
677
|
# Get the RubyGems remotes from the Gemfile
|
|
664
678
|
actual_remotes = sources.rubygems_remotes
|
|
679
|
+
return false if actual_remotes.empty?
|
|
680
|
+
|
|
681
|
+
changes = false
|
|
665
682
|
|
|
666
683
|
# 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
|
|
684
|
+
locked_gem_sources.each do |locked_gem|
|
|
685
|
+
# Merge the remotes from the Gemfile into the Gemfile.lock
|
|
686
|
+
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
|
672
687
|
end
|
|
673
688
|
|
|
674
689
|
changes
|
|
@@ -893,30 +908,18 @@ module Bundler
|
|
|
893
908
|
# Record the specs available in each gem's source, so that those
|
|
894
909
|
# specs will be available later when the resolver knows where to
|
|
895
910
|
# 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
|
|
911
|
+
source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
|
|
903
912
|
metadata_dependencies.each do |dep|
|
|
904
913
|
source_requirements[dep.name] = sources.metadata_source
|
|
905
914
|
end
|
|
915
|
+
source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
|
|
906
916
|
source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
|
|
907
917
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
|
908
918
|
source_requirements
|
|
909
919
|
end
|
|
910
920
|
|
|
911
921
|
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
|
|
922
|
+
dependency_source_requirements.reject {|_, source| source == skip }.keys
|
|
920
923
|
end
|
|
921
924
|
|
|
922
925
|
def requested_groups
|
|
@@ -954,7 +957,7 @@ module Bundler
|
|
|
954
957
|
end
|
|
955
958
|
|
|
956
959
|
def additional_base_requirements_for_resolve
|
|
957
|
-
return [] unless @locked_gems
|
|
960
|
+
return [] unless @locked_gems
|
|
958
961
|
dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
|
|
959
962
|
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
|
|
960
963
|
name = locked_spec.name
|
|
@@ -973,5 +976,17 @@ module Bundler
|
|
|
973
976
|
|
|
974
977
|
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
|
975
978
|
end
|
|
979
|
+
|
|
980
|
+
def dependency_source_requirements
|
|
981
|
+
@dependency_source_requirements ||= begin
|
|
982
|
+
source_requirements = {}
|
|
983
|
+
default = sources.default_source
|
|
984
|
+
dependencies.each do |dep|
|
|
985
|
+
dep_source = dep.source || default
|
|
986
|
+
source_requirements[dep.name] = dep_source
|
|
987
|
+
end
|
|
988
|
+
source_requirements
|
|
989
|
+
end
|
|
990
|
+
end
|
|
976
991
|
end
|
|
977
992
|
end
|
data/bundler/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
|
|
|
@@ -35,7 +35,6 @@ module Bundler
|
|
|
35
35
|
settings_flag(:disable_multisource) { bundler_3_mode? }
|
|
36
36
|
settings_flag(:forget_cli_options) { bundler_3_mode? }
|
|
37
37
|
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
|
38
|
-
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
|
|
39
38
|
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
|
40
39
|
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
|
41
40
|
settings_flag(:print_only_version_number) { bundler_3_mode? }
|
|
@@ -47,7 +47,8 @@ module Bundler
|
|
|
47
47
|
remote_uri = filter_uri(remote_uri)
|
|
48
48
|
super "Authentication is required for #{remote_uri}.\n" \
|
|
49
49
|
"Please supply credentials for this source. You can do this by running:\n" \
|
|
50
|
-
"
|
|
50
|
+
"`bundle config set --global #{remote_uri} username:password`\n" \
|
|
51
|
+
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
|
|
51
52
|
end
|
|
52
53
|
end
|
|
53
54
|
# This error is raised if HTTP authentication is provided, but incorrect.
|
|
@@ -14,8 +14,10 @@ module Bundler
|
|
|
14
14
|
def fetch(uri, headers = {}, counter = 0)
|
|
15
15
|
raise HTTPError, "Too many redirects" if counter >= redirect_limit
|
|
16
16
|
|
|
17
|
+
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
|
18
|
+
|
|
17
19
|
response = request(uri, headers)
|
|
18
|
-
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{
|
|
20
|
+
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{filtered_uri}")
|
|
19
21
|
|
|
20
22
|
case response
|
|
21
23
|
when Net::HTTPSuccess, Net::HTTPNotModified
|
|
@@ -40,7 +42,7 @@ module Bundler
|
|
|
40
42
|
raise BadAuthenticationError, uri.host if uri.userinfo
|
|
41
43
|
raise AuthenticationRequiredError, uri.host
|
|
42
44
|
when Net::HTTPNotFound
|
|
43
|
-
raise FallbackError, "Net::HTTPNotFound: #{
|
|
45
|
+
raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}"
|
|
44
46
|
else
|
|
45
47
|
raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
|
|
46
48
|
end
|
|
@@ -49,7 +51,9 @@ module Bundler
|
|
|
49
51
|
def request(uri, headers)
|
|
50
52
|
validate_uri_scheme!(uri)
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
|
55
|
+
|
|
56
|
+
Bundler.ui.debug "HTTP GET #{filtered_uri}"
|
|
53
57
|
req = Net::HTTP::Get.new uri.request_uri, headers
|
|
54
58
|
if uri.user
|
|
55
59
|
user = CGI.unescape(uri.user)
|
|
@@ -69,7 +73,7 @@ module Bundler
|
|
|
69
73
|
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
|
|
70
74
|
"connection and try again."
|
|
71
75
|
else
|
|
72
|
-
raise HTTPError, "Network error while fetching #{
|
|
76
|
+
raise HTTPError, "Network error while fetching #{filtered_uri}" \
|
|
73
77
|
" (#{e})"
|
|
74
78
|
end
|
|
75
79
|
end
|
|
@@ -47,6 +47,11 @@ module Bundler
|
|
|
47
47
|
built_gem_path = build_gem
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
desc "Generate SHA512 checksum if #{name}-#{version}.gem into the checksums directory."
|
|
51
|
+
task "build:checksum" => "build" do
|
|
52
|
+
build_checksum(built_gem_path)
|
|
53
|
+
end
|
|
54
|
+
|
|
50
55
|
desc "Build and install #{name}-#{version}.gem into system gems."
|
|
51
56
|
task "install" => "build" do
|
|
52
57
|
install_gem(built_gem_path)
|
|
@@ -100,6 +105,17 @@ module Bundler
|
|
|
100
105
|
Bundler.ui.confirm "#{name} (#{version}) installed."
|
|
101
106
|
end
|
|
102
107
|
|
|
108
|
+
def build_checksum(built_gem_path = nil)
|
|
109
|
+
built_gem_path ||= build_gem
|
|
110
|
+
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
|
|
111
|
+
file_name = "#{File.basename(built_gem_path)}.sha512"
|
|
112
|
+
require "digest/sha2"
|
|
113
|
+
checksum = Digest::SHA512.new.hexdigest(built_gem_path.to_s)
|
|
114
|
+
target = File.join(base, "checksums", file_name)
|
|
115
|
+
File.write(target, checksum)
|
|
116
|
+
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
|
|
117
|
+
end
|
|
118
|
+
|
|
103
119
|
protected
|
|
104
120
|
|
|
105
121
|
def rubygem_push(path)
|
|
@@ -128,7 +128,7 @@ module Bundler
|
|
|
128
128
|
# evaluates a gemfile to remove the specified gem
|
|
129
129
|
# from it.
|
|
130
130
|
def remove_deps(gemfile_path)
|
|
131
|
-
initial_gemfile =
|
|
131
|
+
initial_gemfile = File.readlines(gemfile_path)
|
|
132
132
|
|
|
133
133
|
Bundler.ui.info "Removing gems from #{gemfile_path}"
|
|
134
134
|
|
|
@@ -181,7 +181,7 @@ module Bundler
|
|
|
181
181
|
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
|
|
182
182
|
new_gemfile = []
|
|
183
183
|
multiline_removal = false
|
|
184
|
-
|
|
184
|
+
File.readlines(gemfile_path).each do |line|
|
|
185
185
|
match_data = line.match(patterns)
|
|
186
186
|
if match_data && is_not_within_comment?(line, match_data)
|
|
187
187
|
multiline_removal = line.rstrip.end_with?(",")
|
|
@@ -50,8 +50,9 @@ 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
|
-
Bundler.settings.temporary(:frozen => false) do
|
|
55
|
+
Bundler.settings.temporary(:deployment => false, :frozen => false) do
|
|
55
56
|
definition = builder.to_definition(nil, true)
|
|
56
57
|
def definition.lock(*); end
|
|
57
58
|
definition.validate_runtime!
|