rubygems-update 3.2.10 → 3.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/Manifest.txt +1 -0
  4. data/Rakefile +6 -0
  5. data/bundler/CHANGELOG.md +46 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/gem.rb +23 -17
  8. data/bundler/lib/bundler/compact_index_client/updater.rb +1 -1
  9. data/bundler/lib/bundler/definition.rb +6 -13
  10. data/bundler/lib/bundler/dsl.rb +2 -4
  11. data/bundler/lib/bundler/feature_flag.rb +1 -0
  12. data/bundler/lib/bundler/installer.rb +2 -0
  13. data/bundler/lib/bundler/installer/parallel_installer.rb +36 -15
  14. data/bundler/lib/bundler/lazy_specification.rb +6 -1
  15. data/bundler/lib/bundler/lockfile_parser.rb +2 -16
  16. data/bundler/lib/bundler/man/bundle-config.1 +6 -0
  17. data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -0
  18. data/bundler/lib/bundler/plugin/api/source.rb +7 -0
  19. data/bundler/lib/bundler/plugin/installer.rb +1 -2
  20. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  21. data/bundler/lib/bundler/resolver.rb +19 -17
  22. data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -0
  23. data/bundler/lib/bundler/settings.rb +1 -0
  24. data/bundler/lib/bundler/source.rb +6 -0
  25. data/bundler/lib/bundler/source/metadata.rb +0 -4
  26. data/bundler/lib/bundler/source/path.rb +3 -1
  27. data/bundler/lib/bundler/source/path/installer.rb +1 -1
  28. data/bundler/lib/bundler/source/rubygems.rb +16 -9
  29. data/bundler/lib/bundler/source_list.rb +8 -12
  30. data/bundler/lib/bundler/spec_set.rb +2 -0
  31. data/bundler/lib/bundler/stub_specification.rb +8 -0
  32. data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems.rb +1 -1
  35. data/lib/rubygems/commands/update_command.rb +21 -3
  36. data/lib/rubygems/config_file.rb +9 -0
  37. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  38. data/lib/rubygems/remote_fetcher.rb +4 -8
  39. data/lib/rubygems/security/trust_dir.rb +1 -0
  40. data/rubygems-update.gemspec +1 -1
  41. data/test/rubygems/test_gem_commands_update_command.rb +28 -1
  42. data/test/rubygems/test_gem_config_file.rb +10 -0
  43. data/test/rubygems/test_gem_remote_fetcher.rb +38 -0
  44. metadata +4 -3
@@ -131,18 +131,8 @@ module Bundler
131
131
  @sources << @current_source
132
132
  end
133
133
  when GEM
134
- source_remotes = Array(@opts["remote"])
135
-
136
- if source_remotes.size == 1
137
- @opts["remotes"] = @opts.delete("remote")
138
- @current_source = TYPES[@type].from_lock(@opts)
139
- else
140
- source_remotes.each do |url|
141
- rubygems_aggregate.add_remote(url)
142
- end
143
- @current_source = rubygems_aggregate
144
- end
145
-
134
+ @opts["remotes"] = Array(@opts.delete("remote")).reverse
135
+ @current_source = TYPES[@type].from_lock(@opts)
146
136
  @sources << @current_source
147
137
  when PLUGIN
148
138
  @current_source = Plugin.source_from_lock(@opts)
@@ -245,9 +235,5 @@ module Bundler
245
235
  def parse_ruby(line)
246
236
  @ruby_version = line.strip
247
237
  end
248
-
249
- def rubygems_aggregate
250
- @rubygems_aggregate ||= Source::Rubygems.new
251
- end
252
238
  end
253
239
  end
@@ -56,6 +56,9 @@ Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the con
56
56
  .P
57
57
  Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
58
58
  .
59
+ .P
60
+ Executing \fBbundle config set \-\-local disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
61
+ .
59
62
  .SH "REMEMBERING OPTIONS"
60
63
  Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\.
61
64
  .
@@ -181,6 +184,9 @@ The following is a list of all configuration keys and their purpose\. You can le
181
184
  \fBdisable_local_revision_check\fR (\fBBUNDLE_DISABLE_LOCAL_REVISION_CHECK\fR): Allow Bundler to use a local git override without checking if the revision present in the lockfile is present in the repository\.
182
185
  .
183
186
  .IP "\(bu" 4
187
+ \fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
188
+ .
189
+ .IP "\(bu" 4
184
190
  \fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\.
185
191
  .
186
192
  .IP "\(bu" 4
@@ -47,6 +47,10 @@ configuration only from the local application.
47
47
  Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will
48
48
  cause it to ignore all configuration.
49
49
 
50
+ Executing `bundle config set --local disable_multisource true` upgrades the warning about
51
+ the Gemfile containing multiple primary sources to an error. Executing `bundle
52
+ config unset disable_multisource` downgrades this error to a warning.
53
+
50
54
  ## REMEMBERING OPTIONS
51
55
 
52
56
  Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or
@@ -174,6 +178,10 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
174
178
  * `disable_local_revision_check` (`BUNDLE_DISABLE_LOCAL_REVISION_CHECK`):
175
179
  Allow Bundler to use a local git override without checking if the revision
176
180
  present in the lockfile is present in the repository.
181
+ * `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
182
+ When set, Gemfiles containing multiple sources will produce errors
183
+ instead of warnings.
184
+ Use `bundle config unset disable_multisource` to unset.
177
185
  * `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
178
186
  Stop Bundler from accessing gems installed to RubyGems' normal location.
179
187
  * `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
@@ -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
@@ -77,12 +77,11 @@ module Bundler
77
77
  source_list = SourceList.new
78
78
 
79
79
  source_list.add_git_source(git_source_options) if git_source_options
80
- source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
80
+ source_list.global_rubygems_source = rubygems_source if rubygems_source
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
84
84
  definition = Definition.new(nil, deps, source_list, true)
85
- definition.allow_multisource!
86
85
  install_definition(definition)
87
86
  end
88
87
 
@@ -17,6 +17,10 @@ module Bundler
17
17
  path_sources + git_sources + rubygems_sources + [metadata_source]
18
18
  end
19
19
 
20
+ def default_source
21
+ git_sources.first || global_rubygems_source
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def rubygems_aggregate_class
@@ -26,6 +26,12 @@ module Bundler
26
26
 
27
27
  def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
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
+
29
35
  @base = base
30
36
  @resolver = Molinillo::Resolver.new(self, self)
31
37
  @search_for = {}
@@ -193,24 +199,21 @@ module Bundler
193
199
  search_result
194
200
  end
195
201
 
196
- def index_for(dependency, base)
197
- source = @source_requirements[dependency.name]
202
+ def index_for(dependency)
203
+ source = @index_requirements[dependency.name]
198
204
  if source
199
- source.specs
205
+ source
200
206
  elsif @no_aggregate_global_source
201
- dependency.all_sources.find(-> { Index.new }) do |s|
202
- idx = s.specs
203
- results = idx.search(dependency, base)
204
- next if results.empty? || results == base
205
- return idx
207
+ Index.build do |idx|
208
+ dependency.all_sources.each {|s| idx.add_source(s.specs) }
206
209
  end
207
210
  else
208
- @source_requirements[:global]
211
+ @index_requirements[:global]
209
212
  end
210
213
  end
211
214
 
212
215
  def results_for(dependency, base)
213
- index_for(dependency, base).search(dependency, base)
216
+ index_for(dependency).search(dependency, base)
214
217
  end
215
218
 
216
219
  def name_for(dependency)
@@ -239,7 +242,7 @@ module Bundler
239
242
 
240
243
  def relevant_sources_for_vertex(vertex)
241
244
  if vertex.root?
242
- [@source_requirements[vertex.name]].compact
245
+ [@source_requirements[vertex.name]]
243
246
  elsif @no_aggregate_global_source
244
247
  vertex.recursive_predecessors.map do |v|
245
248
  @source_requirements[v.name]
@@ -251,9 +254,9 @@ module Bundler
251
254
 
252
255
  def sort_dependencies(dependencies, activated, conflicts)
253
256
  dependencies.sort_by do |dependency|
254
- dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
255
257
  name = name_for(dependency)
256
258
  vertex = activated.vertex_named(name)
259
+ dependency.all_sources = relevant_sources_for_vertex(vertex)
257
260
  [
258
261
  @base_dg.vertex_named(name) ? 0 : 1,
259
262
  vertex.payload ? 0 : 1,
@@ -286,7 +289,7 @@ module Bundler
286
289
  if (base = @base[dependency.name]) && !base.empty?
287
290
  dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
288
291
  else
289
- all = index_for(dependency, base).search(dependency.name).size
292
+ all = index_for(dependency).search(dependency.name).size
290
293
 
291
294
  if all <= 1
292
295
  all - 1_000_000
@@ -320,7 +323,7 @@ module Bundler
320
323
  "If you are updating multiple gems in your Gemfile at once,\n" \
321
324
  "try passing them all to `bundle update`"
322
325
  elsif source = @source_requirements[name]
323
- specs = source.specs[name]
326
+ specs = source.specs.search(name)
324
327
  versions_with_platforms = specs.map {|s| [s.version, s.platform] }
325
328
  message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
326
329
  message << if versions_with_platforms.any?
@@ -395,7 +398,7 @@ module Bundler
395
398
  if other_bundler_required
396
399
  o << "\n\n"
397
400
 
398
- candidate_specs = @source_requirements[:default_bundler].specs.search(conflict_dependency)
401
+ candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
399
402
  if candidate_specs.any?
400
403
  target_version = candidate_specs.last.version
401
404
  new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
@@ -454,11 +457,10 @@ module Bundler
454
457
  name = v.name
455
458
  sources = relevant_sources_for_vertex(v)
456
459
  next unless sources.any?
457
- sources.compact!
458
460
  if default_index = sources.index(@source_requirements[:default])
459
461
  sources.delete_at(default_index)
460
462
  end
461
- sources.reject! {|s| s.specs[name].empty? }
463
+ sources.reject! {|s| s.specs.search(name).empty? }
462
464
  sources.uniq!
463
465
  next if sources.size <= 1
464
466
 
@@ -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
@@ -20,6 +20,7 @@ module Bundler
20
20
  disable_exec_load
21
21
  disable_local_branch_check
22
22
  disable_local_revision_check
23
+ disable_multisource
23
24
  disable_shared_gems
24
25
  disable_version_check
25
26
  force_ruby_platform
@@ -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.
@@ -33,10 +33,6 @@ module Bundler
33
33
  end
34
34
  end
35
35
 
36
- def cached!; end
37
-
38
- def remote!; end
39
-
40
36
  def options
41
37
  {}
42
38
  end
@@ -82,7 +82,9 @@ module Bundler
82
82
  end
83
83
 
84
84
  def install(spec, options = {})
85
- print_using_message "Using #{version_message(spec)} from #{self}"
85
+ using_message = "Using #{version_message(spec)} from #{self}"
86
+ using_message += " and installing its executables" unless spec.executables.empty?
87
+ print_using_message using_message
86
88
  generate_bin(spec, :disable_extensions => true)
87
89
  nil # no post-install message
88
90
  end
@@ -35,7 +35,7 @@ module Bundler
35
35
  run_hooks(:post_build)
36
36
  end
37
37
 
38
- generate_bin unless spec.executables.nil? || spec.executables.empty?
38
+ generate_bin unless spec.executables.empty?
39
39
 
40
40
  run_hooks(:post_install)
41
41
  ensure
@@ -20,18 +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
- @disable_multisource = true
25
25
 
26
- Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
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
27
34
  end
28
35
 
29
36
  def remote!
37
+ return if @allow_remote
38
+
30
39
  @specs = nil
31
40
  @allow_remote = true
32
41
  end
33
42
 
34
43
  def cached!
44
+ return if @allow_cached
45
+
35
46
  @specs = nil
36
47
  @allow_cached = true
37
48
  end
@@ -51,11 +62,7 @@ module Bundler
51
62
  end
52
63
 
53
64
  def disable_multisource?
54
- @disable_multisource
55
- end
56
-
57
- def allow_multisource!
58
- @disable_multisource = false
65
+ @remotes.size <= 1
59
66
  end
60
67
 
61
68
  def can_lock?(spec)
@@ -96,7 +103,7 @@ module Bundler
96
103
  # small_idx.use large_idx.
97
104
  idx = @allow_remote ? remote_specs.dup : Index.new
98
105
  idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
99
- idx.use(installed_specs, :override_dupes)
106
+ idx.use(installed_specs, :override_dupes) if @allow_local
100
107
  idx
101
108
  end
102
109
  end
@@ -374,7 +381,7 @@ module Bundler
374
381
 
375
382
  def cached_specs
376
383
  @cached_specs ||= begin
377
- idx = installed_specs.dup
384
+ idx = @allow_local ? installed_specs.dup : Index.new
378
385
 
379
386
  Dir["#{cache_path}/*.gem"].each do |gemfile|
380
387
  next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
@@ -6,11 +6,10 @@ module Bundler
6
6
  :git_sources,
7
7
  :plugin_sources,
8
8
  :global_path_source,
9
- :metadata_source,
10
- :disable_multisource
9
+ :metadata_source
11
10
 
12
11
  def global_rubygems_source
13
- @global_rubygems_source ||= rubygems_aggregate_class.new
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
14
13
  end
15
14
 
16
15
  def initialize
@@ -21,15 +20,15 @@ module Bundler
21
20
  @global_path_source = nil
22
21
  @rubygems_sources = []
23
22
  @metadata_source = Source::Metadata.new
24
- @disable_multisource = true
23
+
24
+ @disable_multisource = true
25
25
  end
26
26
 
27
27
  def disable_multisource?
28
28
  @disable_multisource
29
29
  end
30
30
 
31
- def allow_multisource!
32
- rubygems_sources.map(&:allow_multisource!)
31
+ def merged_gem_lockfile_sections!
33
32
  @disable_multisource = false
34
33
  end
35
34
 
@@ -58,7 +57,7 @@ module Bundler
58
57
  end
59
58
 
60
59
  def global_rubygems_source=(uri)
61
- @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
60
+ @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri, "allow_local" => true)
62
61
  end
63
62
 
64
63
  def add_rubygems_remote(uri)
@@ -89,7 +88,7 @@ module Bundler
89
88
  def lock_sources
90
89
  lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
91
90
  if disable_multisource?
92
- lock_sources + rubygems_sources.sort_by(&:to_s)
91
+ lock_sources + rubygems_sources.sort_by(&:to_s).uniq
93
92
  else
94
93
  lock_sources << combine_rubygems_sources
95
94
  end
@@ -110,7 +109,6 @@ module Bundler
110
109
  @global_rubygems_source = replacement_rubygems if replacement_rubygems
111
110
 
112
111
  return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
113
- return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
114
112
 
115
113
  false
116
114
  end
@@ -145,9 +143,7 @@ module Bundler
145
143
  end
146
144
 
147
145
  def combine_rubygems_sources
148
- aggregate_source = Source::Rubygems.new("remotes" => rubygems_remotes)
149
- aggregate_source.allow_multisource! unless disable_multisource?
150
- aggregate_source
146
+ Source::Rubygems.new("remotes" => rubygems_remotes)
151
147
  end
152
148
 
153
149
  def warn_on_git_protocol(source)