rubygems-update 3.5.10 → 3.5.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -1
  3. data/CODE_OF_CONDUCT.md +79 -28
  4. data/CONTRIBUTING.md +2 -2
  5. data/Manifest.txt +2 -0
  6. data/bundler/CHANGELOG.md +48 -0
  7. data/bundler/lib/bundler/build_metadata.rb +2 -2
  8. data/bundler/lib/bundler/cli/install.rb +1 -1
  9. data/bundler/lib/bundler/cli.rb +5 -8
  10. data/bundler/lib/bundler/compact_index_client/cache.rb +47 -72
  11. data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
  12. data/bundler/lib/bundler/compact_index_client.rb +51 -80
  13. data/bundler/lib/bundler/constants.rb +8 -1
  14. data/bundler/lib/bundler/definition.rb +21 -27
  15. data/bundler/lib/bundler/errors.rb +14 -0
  16. data/bundler/lib/bundler/fetcher/compact_index.rb +15 -24
  17. data/bundler/lib/bundler/gem_helper.rb +1 -1
  18. data/bundler/lib/bundler/installer/gem_installer.rb +0 -1
  19. data/bundler/lib/bundler/installer.rb +8 -8
  20. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  21. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  25. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  26. data/bundler/lib/bundler/man/bundle-config.1.ronn +1 -1
  27. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  28. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  45. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  46. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  47. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  48. data/bundler/lib/bundler/man/bundle.1 +1 -1
  49. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  50. data/bundler/lib/bundler/rubygems_ext.rb +20 -12
  51. data/bundler/lib/bundler/rubygems_integration.rb +14 -0
  52. data/bundler/lib/bundler/self_manager.rb +6 -1
  53. data/bundler/lib/bundler/settings.rb +12 -8
  54. data/bundler/lib/bundler/setup.rb +3 -0
  55. data/bundler/lib/bundler/shared_helpers.rb +6 -4
  56. data/bundler/lib/bundler/source/git/git_proxy.rb +8 -0
  57. data/bundler/lib/bundler/source/git.rb +14 -0
  58. data/bundler/lib/bundler/source/metadata.rb +2 -0
  59. data/bundler/lib/bundler/source/path.rb +0 -13
  60. data/bundler/lib/bundler/source/rubygems.rb +32 -15
  61. data/bundler/lib/bundler/source_list.rb +13 -2
  62. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  63. data/bundler/lib/bundler/version.rb +1 -1
  64. data/bundler/lib/bundler/yaml_serializer.rb +1 -8
  65. data/bundler/lib/bundler.rb +6 -1
  66. data/exe/update_rubygems +1 -1
  67. data/lib/rubygems/basic_specification.rb +27 -0
  68. data/lib/rubygems/commands/pristine_command.rb +12 -9
  69. data/lib/rubygems/commands/setup_command.rb +2 -0
  70. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  71. data/lib/rubygems/dependency.rb +1 -13
  72. data/lib/rubygems/ext/cargo_builder.rb +1 -16
  73. data/lib/rubygems/installer.rb +1 -1
  74. data/lib/rubygems/package/tar_header.rb +20 -4
  75. data/lib/rubygems/package.rb +0 -1
  76. data/lib/rubygems/platform.rb +1 -0
  77. data/lib/rubygems/specification.rb +45 -118
  78. data/lib/rubygems/specification_policy.rb +3 -1
  79. data/lib/rubygems/specification_record.rb +212 -0
  80. data/lib/rubygems/stub_specification.rb +21 -0
  81. data/lib/rubygems/uninstaller.rb +26 -19
  82. data/lib/rubygems/util/licenses.rb +25 -0
  83. data/lib/rubygems/yaml_serializer.rb +1 -8
  84. data/lib/rubygems.rb +8 -1
  85. data/rubygems-update.gemspec +1 -1
  86. metadata +5 -3
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLATFORM" "1" "April 2024" ""
3
+ .TH "BUNDLE\-PLATFORM" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-platform\fR \- Displays platform compatibility information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLUGIN" "1" "April 2024" ""
3
+ .TH "BUNDLE\-PLUGIN" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-plugin\fR \- Manage Bundler plugins
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PRISTINE" "1" "April 2024" ""
3
+ .TH "BUNDLE\-PRISTINE" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-REMOVE" "1" "April 2024" ""
3
+ .TH "BUNDLE\-REMOVE" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-SHOW" "1" "April 2024" ""
3
+ .TH "BUNDLE\-SHOW" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-UPDATE" "1" "April 2024" ""
3
+ .TH "BUNDLE\-UPDATE" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-update\fR \- Update your gems to the latest available versions
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VERSION" "1" "April 2024" ""
3
+ .TH "BUNDLE\-VERSION" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-version\fR \- Prints Bundler version information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VIZ" "1" "April 2024" ""
3
+ .TH "BUNDLE\-VIZ" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE" "1" "April 2024" ""
3
+ .TH "BUNDLE" "1" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\fR \- Ruby Dependency Management
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "GEMFILE" "5" "April 2024" ""
3
+ .TH "GEMFILE" "5" "May 2024" ""
4
4
  .SH "NAME"
5
5
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
6
6
  .SH "SYNOPSIS"
@@ -1,11 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
-
5
3
  require "rubygems" unless defined?(Gem)
6
4
 
7
- require "rubygems/specification"
8
-
9
5
  # We can't let `Gem::Source` be autoloaded in the `Gem::Specification#source`
10
6
  # redefinition below, so we need to load it upfront. The reason is that if
11
7
  # Bundler monkeypatches are loaded before RubyGems activates an executable (for
@@ -17,10 +13,6 @@ require "rubygems/specification"
17
13
  # `Gem::Source` from the redefined `Gem::Specification#source`.
18
14
  require "rubygems/source"
19
15
 
20
- require_relative "match_metadata"
21
- require_relative "force_platform"
22
- require_relative "match_platform"
23
-
24
16
  # Cherry-pick fixes to `Gem.ruby_version` to be useful for modern Bundler
25
17
  # versions and ignore patchlevels
26
18
  # (https://github.com/rubygems/rubygems/pull/5472,
@@ -31,7 +23,19 @@ unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1
31
23
  end
32
24
 
33
25
  module Gem
26
+ # Can be removed once RubyGems 3.5.11 support is dropped
27
+ unless Gem.respond_to?(:freebsd_platform?)
28
+ def self.freebsd_platform?
29
+ RbConfig::CONFIG["host_os"].to_s.include?("bsd")
30
+ end
31
+ end
32
+
33
+ require "rubygems/specification"
34
+
34
35
  class Specification
36
+ require_relative "match_metadata"
37
+ require_relative "match_platform"
38
+
35
39
  include ::Bundler::MatchMetadata
36
40
  include ::Bundler::MatchPlatform
37
41
 
@@ -48,7 +52,7 @@ module Gem
48
52
 
49
53
  def full_gem_path
50
54
  if source.respond_to?(:root)
51
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s
55
+ File.expand_path(File.dirname(loaded_from), source.root)
52
56
  else
53
57
  rg_full_gem_path
54
58
  end
@@ -148,17 +152,21 @@ module Gem
148
152
 
149
153
  module BetterPermissionError
150
154
  def data
151
- Bundler::SharedHelpers.filesystem_access(loaded_from, :read) do
152
- super
153
- end
155
+ super
156
+ rescue Errno::EACCES
157
+ raise Bundler::PermissionError.new(loaded_from, :read)
154
158
  end
155
159
  end
156
160
 
161
+ require "rubygems/stub_specification"
162
+
157
163
  class StubSpecification
158
164
  prepend BetterPermissionError
159
165
  end
160
166
 
161
167
  class Dependency
168
+ require_relative "force_platform"
169
+
162
170
  include ::Bundler::ForcePlatform
163
171
 
164
172
  attr_accessor :source, :groups
@@ -469,11 +469,25 @@ module Bundler
469
469
  end
470
470
 
471
471
  def all_specs
472
+ SharedHelpers.major_deprecation 2, "Bundler.rubygems.all_specs has been removed in favor of Bundler.rubygems.installed_specs"
473
+
472
474
  Gem::Specification.stubs.map do |stub|
473
475
  StubSpecification.from_stub(stub)
474
476
  end
475
477
  end
476
478
 
479
+ def installed_specs
480
+ Gem::Specification.stubs.reject(&:default_gem?).map do |stub|
481
+ StubSpecification.from_stub(stub)
482
+ end
483
+ end
484
+
485
+ def default_specs
486
+ Gem::Specification.default_stubs.map do |stub|
487
+ StubSpecification.from_stub(stub)
488
+ end
489
+ end
490
+
477
491
  def find_bundler(version)
478
492
  find_name("bundler").find {|s| s.version.to_s == version }
479
493
  end
@@ -92,6 +92,7 @@ module Bundler
92
92
  def autoswitching_applies?
93
93
  ENV["BUNDLER_VERSION"].nil? &&
94
94
  Bundler.rubygems.supports_bundler_trampolining? &&
95
+ ruby_can_restart_with_same_arguments? &&
95
96
  SharedHelpers.in_bundle? &&
96
97
  lockfile_version
97
98
  end
@@ -113,7 +114,7 @@ module Bundler
113
114
  end
114
115
 
115
116
  def local_specs
116
- @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true, "allow_cached" => true).specs.select {|spec| spec.name == "bundler" }
117
+ @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
117
118
  end
118
119
 
119
120
  def remote_specs
@@ -151,6 +152,10 @@ module Bundler
151
152
  !version.to_s.end_with?(".dev")
152
153
  end
153
154
 
155
+ def ruby_can_restart_with_same_arguments?
156
+ $PROGRAM_NAME != "-e"
157
+ end
158
+
154
159
  def updating?
155
160
  "update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
156
161
  end
@@ -103,6 +103,7 @@ module Bundler
103
103
  def initialize(root = nil)
104
104
  @root = root
105
105
  @local_config = load_config(local_config_file)
106
+ @local_root = root || Pathname.new(".bundle").expand_path
106
107
 
107
108
  @env_config = ENV.to_h
108
109
  @env_config.select! {|key, _value| key.start_with?("BUNDLE_") }
@@ -142,7 +143,7 @@ module Bundler
142
143
  end
143
144
 
144
145
  def set_local(key, value)
145
- local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
146
+ local_config_file = @local_root.join("config")
146
147
 
147
148
  set_key(key, value, @local_config, local_config_file)
148
149
  end
@@ -491,6 +492,10 @@ module Bundler
491
492
  valid_file = file.exist? && !file.size.zero?
492
493
  return {} unless valid_file
493
494
  serializer_class.load(file.read).inject({}) do |config, (k, v)|
495
+ k = k.dup
496
+ k << "/" if /https?:/i.match?(k) && !k.end_with?("/", "__#{FALLBACK_TIMEOUT_URI_OPTION.upcase}")
497
+ k.gsub!(".", "__")
498
+
494
499
  unless k.start_with?("#")
495
500
  if k.include?("-")
496
501
  Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
@@ -518,26 +523,25 @@ module Bundler
518
523
  YAMLSerializer
519
524
  end
520
525
 
521
- PER_URI_OPTIONS = %w[
522
- fallback_timeout
523
- ].freeze
526
+ FALLBACK_TIMEOUT_URI_OPTION = "fallback_timeout"
524
527
 
525
528
  NORMALIZE_URI_OPTIONS_PATTERN =
526
529
  /
527
530
  \A
528
531
  (\w+\.)? # optional prefix key
529
532
  (https?.*?) # URI
530
- (\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
533
+ (\.#{FALLBACK_TIMEOUT_URI_OPTION})? # optional suffix key
531
534
  \z
532
535
  /ix
533
536
 
534
537
  def self.key_for(key)
535
- key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
536
- key = key_to_s(key).gsub(".", "__")
538
+ key = key_to_s(key)
539
+ key = normalize_uri(key) if key.start_with?("http", "mirror.http")
540
+ key = key.gsub(".", "__")
537
541
  key.gsub!("-", "___")
538
542
  key.upcase!
539
543
 
540
- key.prepend("BUNDLE_")
544
+ key.gsub(/\A([ #]*)/, '\1BUNDLE_')
541
545
  end
542
546
 
543
547
  # TODO: duplicates Rubygems#normalize_uri
@@ -5,6 +5,9 @@ require_relative "shared_helpers"
5
5
  if Bundler::SharedHelpers.in_bundle?
6
6
  require_relative "../bundler"
7
7
 
8
+ # autoswitch to locked Bundler version if available
9
+ Bundler.auto_switch
10
+
8
11
  # try to auto_install first before we get to the `Bundler.ui.silence`, so user knows what is happening
9
12
  Bundler.auto_install
10
13
 
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
- require "rbconfig"
5
-
6
3
  require_relative "version"
7
- require_relative "constants"
8
4
  require_relative "rubygems_integration"
9
5
  require_relative "current_ruby"
10
6
 
7
+ autoload :Pathname, "pathname"
8
+
11
9
  module Bundler
10
+ autoload :WINDOWS, File.expand_path("constants", __dir__)
11
+ autoload :FREEBSD, File.expand_path("constants", __dir__)
12
+ autoload :NULL, File.expand_path("constants", __dir__)
13
+
12
14
  module SharedHelpers
13
15
  def root
14
16
  gemfile = find_gemfile
@@ -182,6 +182,14 @@ module Bundler
182
182
  if err.include?("Could not find remote branch")
183
183
  raise MissingGitRevisionError.new(command_with_no_credentials, nil, explicit_ref, credential_filtered_uri)
184
184
  else
185
+ idx = command.index("--depth")
186
+ if idx
187
+ command.delete_at(idx)
188
+ command.delete_at(idx)
189
+ command_with_no_credentials = check_allowed(command)
190
+
191
+ err += "Retrying without --depth argument."
192
+ end
185
193
  raise GitCommandError.new(command_with_no_credentials, path, err)
186
194
  end
187
195
  end
@@ -32,6 +32,20 @@ module Bundler
32
32
  @local = false
33
33
  end
34
34
 
35
+ def remote!
36
+ return if @allow_remote
37
+
38
+ @local_specs = nil
39
+ @allow_remote = true
40
+ end
41
+
42
+ def cached!
43
+ return if @allow_cached
44
+
45
+ @local_specs = nil
46
+ @allow_cached = true
47
+ end
48
+
35
49
  def self.from_lock(options)
36
50
  new(options.merge("uri" => options.delete("remote")))
37
51
  end
@@ -11,6 +11,8 @@ module Bundler
11
11
  end
12
12
 
13
13
  if local_spec = Gem.loaded_specs["bundler"]
14
+ raise CorruptBundlerInstallError.new(local_spec) if local_spec.version.to_s != Bundler::VERSION
15
+
14
16
  idx << local_spec
15
17
  else
16
18
  idx << Gem::Specification.new do |s|
@@ -18,9 +18,6 @@ module Bundler
18
18
  @options = options.dup
19
19
  @glob = options["glob"] || DEFAULT_GLOB
20
20
 
21
- @allow_cached = false
22
- @allow_remote = false
23
-
24
21
  @root_path = options["root_path"] || root
25
22
 
26
23
  if options["path"]
@@ -41,16 +38,6 @@ module Bundler
41
38
  @original_path = @path
42
39
  end
43
40
 
44
- def remote!
45
- @local_specs = nil
46
- @allow_remote = true
47
- end
48
-
49
- def cached!
50
- @local_specs = nil
51
- @allow_cached = true
52
- end
53
-
54
41
  def self.from_lock(options)
55
42
  new(options.merge("path" => options.delete("remote")))
56
43
  end
@@ -10,16 +10,17 @@ module Bundler
10
10
  # Ask for X gems per API request
11
11
  API_REQUEST_SIZE = 50
12
12
 
13
- attr_accessor :remotes
13
+ attr_reader :remotes
14
14
 
15
15
  def initialize(options = {})
16
16
  @options = options
17
17
  @remotes = []
18
18
  @dependency_names = []
19
19
  @allow_remote = false
20
- @allow_cached = options["allow_cached"] || false
20
+ @allow_cached = false
21
21
  @allow_local = options["allow_local"] || false
22
22
  @checksum_store = Checksum::Store.new
23
+ @original_remotes = nil
23
24
 
24
25
  Array(options["remotes"]).reverse_each {|r| add_remote(r) }
25
26
  end
@@ -50,10 +51,11 @@ module Bundler
50
51
  end
51
52
 
52
53
  def cached!
54
+ return unless File.exist?(cache_path)
55
+
53
56
  return if @allow_cached
54
57
 
55
58
  @specs = nil
56
- @allow_local = true
57
59
  @allow_cached = true
58
60
  end
59
61
 
@@ -93,10 +95,15 @@ module Bundler
93
95
  new(options)
94
96
  end
95
97
 
98
+ def remotes=(new_remotes)
99
+ @original_remotes = @remotes
100
+ @remotes = new_remotes
101
+ end
102
+
96
103
  def to_lock
97
104
  out = String.new("GEM\n")
98
- remotes.reverse_each do |remote|
99
- out << " remote: #{remove_auth remote}\n"
105
+ lockfile_remotes.reverse_each do |remote|
106
+ out << " remote: #{remote}\n"
100
107
  end
101
108
  out << " specs:\n"
102
109
  end
@@ -135,20 +142,17 @@ module Bundler
135
142
  index = @allow_remote ? remote_specs.dup : Index.new
136
143
  index.merge!(cached_specs) if @allow_cached
137
144
  index.merge!(installed_specs) if @allow_local
145
+
146
+ # complete with default specs, only if not already available in the
147
+ # index through remote, cached, or installed specs
148
+ index.use(default_specs) if @allow_local
149
+
138
150
  index
139
151
  end
140
152
  end
141
153
 
142
154
  def install(spec, options = {})
143
- force = options[:force]
144
- ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
145
-
146
- if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
147
- cached_built_in_gem(spec) unless spec.remote
148
- force = true
149
- end
150
-
151
- if installed?(spec) && !force
155
+ if (spec.default_gem? && !cached_built_in_gem(spec)) || (installed?(spec) && !options[:force])
152
156
  print_using_message "Using #{version_message(spec, options[:previous_spec])}"
153
157
  return nil # no post-install message
154
158
  end
@@ -361,7 +365,7 @@ module Bundler
361
365
 
362
366
  def installed_specs
363
367
  @installed_specs ||= Index.build do |idx|
364
- Bundler.rubygems.all_specs.reverse_each do |spec|
368
+ Bundler.rubygems.installed_specs.reverse_each do |spec|
365
369
  spec.source = self
366
370
  if Bundler.rubygems.spec_missing_extensions?(spec, false)
367
371
  Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
@@ -372,6 +376,15 @@ module Bundler
372
376
  end
373
377
  end
374
378
 
379
+ def default_specs
380
+ @default_specs ||= Index.build do |idx|
381
+ Bundler.rubygems.default_specs.each do |spec|
382
+ spec.source = self
383
+ idx << spec
384
+ end
385
+ end
386
+ end
387
+
375
388
  def cached_specs
376
389
  @cached_specs ||= begin
377
390
  idx = Index.new
@@ -456,6 +469,10 @@ module Bundler
456
469
 
457
470
  private
458
471
 
472
+ def lockfile_remotes
473
+ @original_remotes || credless_remotes
474
+ end
475
+
459
476
  # Checks if the requested spec exists in the global cache. If it does,
460
477
  # we copy it to the download path, and if it does not, we download it.
461
478
  #
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true, "allow_cached" => true)
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -22,6 +22,7 @@ module Bundler
22
22
  @metadata_source = Source::Metadata.new
23
23
 
24
24
  @merged_gem_lockfile_sections = false
25
+ @local_mode = true
25
26
  end
26
27
 
27
28
  def merged_gem_lockfile_sections?
@@ -73,6 +74,10 @@ module Bundler
73
74
  global_rubygems_source
74
75
  end
75
76
 
77
+ def local_mode?
78
+ @local_mode
79
+ end
80
+
76
81
  def default_source
77
82
  global_path_source || global_rubygems_source
78
83
  end
@@ -140,11 +145,17 @@ module Bundler
140
145
  all_sources.each(&:local_only!)
141
146
  end
142
147
 
148
+ def local!
149
+ all_sources.each(&:local!)
150
+ end
151
+
143
152
  def cached!
144
153
  all_sources.each(&:cached!)
145
154
  end
146
155
 
147
156
  def remote!
157
+ @local_mode = false
158
+
148
159
  all_sources.each(&:remote!)
149
160
  end
150
161
 
@@ -178,7 +189,7 @@ module Bundler
178
189
  replacement_source = replace_rubygems_source(replacement_sources, global_rubygems_source)
179
190
  return global_rubygems_source unless replacement_source
180
191
 
181
- replacement_source.cached!
192
+ replacement_source.local!
182
193
  replacement_source
183
194
  end
184
195