rubygems-update 2.6.8 → 2.6.9

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -6
  3. data/CODE_OF_CONDUCT.md +36 -33
  4. data/History.txt +16 -0
  5. data/Manifest.txt +5 -3
  6. data/Rakefile +5 -0
  7. data/bundler/CHANGELOG.md +72 -0
  8. data/bundler/DEVELOPMENT.md +2 -2
  9. data/bundler/README.md +5 -0
  10. data/bundler/lib/bundler.rb +1 -1
  11. data/bundler/lib/bundler/cli.rb +42 -29
  12. data/bundler/lib/bundler/cli/common.rb +17 -0
  13. data/bundler/lib/bundler/cli/exec.rb +6 -0
  14. data/bundler/lib/bundler/cli/gem.rb +16 -3
  15. data/bundler/lib/bundler/cli/install.rb +7 -20
  16. data/bundler/lib/bundler/cli/lock.rb +1 -1
  17. data/bundler/lib/bundler/cli/open.rb +2 -1
  18. data/bundler/lib/bundler/cli/outdated.rb +91 -43
  19. data/bundler/lib/bundler/cli/update.rb +3 -10
  20. data/bundler/lib/bundler/compact_index_client.rb +7 -1
  21. data/bundler/lib/bundler/current_ruby.rb +1 -0
  22. data/bundler/lib/bundler/definition.rb +9 -5
  23. data/bundler/lib/bundler/dependency.rb +12 -0
  24. data/bundler/lib/bundler/env.rb +25 -20
  25. data/bundler/lib/bundler/errors.rb +21 -0
  26. data/bundler/lib/bundler/fetcher.rb +2 -2
  27. data/bundler/lib/bundler/fetcher/compact_index.rb +15 -3
  28. data/bundler/lib/bundler/friendly_errors.rb +23 -7
  29. data/bundler/lib/bundler/index.rb +9 -4
  30. data/bundler/lib/bundler/inline.rb +1 -1
  31. data/bundler/lib/bundler/installer.rb +1 -1
  32. data/bundler/lib/bundler/installer/gem_installer.rb +2 -2
  33. data/bundler/lib/bundler/installer/parallel_installer.rb +40 -9
  34. data/bundler/lib/bundler/lockfile_parser.rb +0 -1
  35. data/bundler/lib/bundler/match_platform.rb +12 -4
  36. data/bundler/lib/bundler/plugin/api.rb +2 -1
  37. data/bundler/lib/bundler/plugin/api/source.rb +1 -1
  38. data/bundler/lib/bundler/postit_trampoline.rb +3 -3
  39. data/bundler/lib/bundler/resolver.rb +6 -1
  40. data/bundler/lib/bundler/retry.rb +4 -1
  41. data/bundler/lib/bundler/rubygems_gem_installer.rb +18 -6
  42. data/bundler/lib/bundler/rubygems_integration.rb +16 -3
  43. data/bundler/lib/bundler/settings.rb +8 -3
  44. data/bundler/lib/bundler/shared_helpers.rb +15 -12
  45. data/bundler/lib/bundler/source.rb +4 -0
  46. data/bundler/lib/bundler/source/git/git_proxy.rb +2 -1
  47. data/bundler/lib/bundler/source/rubygems.rb +9 -0
  48. data/bundler/lib/bundler/spec_set.rb +4 -0
  49. data/bundler/lib/bundler/templates/newgem/gitignore.tt +5 -0
  50. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -1
  51. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +10 -1
  52. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +10 -1
  53. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  54. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
  55. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
  56. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  57. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +10 -3
  58. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
  59. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  61. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +2 -0
  62. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  63. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +27 -19
  64. data/bundler/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
  65. data/bundler/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +24 -23
  66. data/bundler/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
  67. data/bundler/lib/bundler/vendored_persistent.rb +9 -4
  68. data/bundler/lib/bundler/version.rb +1 -1
  69. data/bundler/lib/bundler/worker.rb +27 -5
  70. data/bundler/man/bundle-config.ronn +28 -1
  71. data/bundler/man/bundle-install.ronn +1 -1
  72. data/bundler/man/bundle-lock.ronn +47 -0
  73. data/bundler/man/bundle-outdated.ronn +107 -0
  74. data/bundler/man/bundle-update.ronn +152 -3
  75. data/bundler/man/bundle.ronn +22 -4
  76. data/bundler/man/gemfile.5.ronn +16 -0
  77. data/lib/rubygems.rb +1 -1
  78. data/lib/rubygems/ext/ext_conf_builder.rb +5 -3
  79. data/lib/rubygems/ext/rake_builder.rb +1 -1
  80. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +3 -1
  81. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +9 -2
  82. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +2 -0
  83. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  84. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +17 -17
  85. data/lib/rubygems/server.rb +11 -4
  86. data/lib/rubygems/stub_specification.rb +6 -1
  87. data/lib/rubygems/version.rb +6 -2
  88. data/test/rubygems/test_gem.rb +2 -0
  89. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +23 -0
  90. data/test/rubygems/test_gem_ext_rake_builder.rb +34 -17
  91. data/test/rubygems/test_gem_server.rb +16 -0
  92. data/test/rubygems/test_gem_specification.rb +1 -1
  93. data/test/rubygems/test_gem_stub_specification.rb +61 -0
  94. data/test/rubygems/test_gem_version.rb +6 -0
  95. data/util/ci +5 -5
  96. metadata +31 -29
@@ -91,6 +91,12 @@ module Bundler
91
91
  "#!/usr/bin/env jruby\n",
92
92
  "#!#{Gem.ruby}\n",
93
93
  ]
94
+
95
+ if File.zero?(file)
96
+ Bundler.ui.warn "#{file} is empty"
97
+ return false
98
+ end
99
+
94
100
  first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
95
101
  possibilities.any? {|shebang| first_line.start_with?(shebang) }
96
102
  end
@@ -202,10 +202,23 @@ module Bundler
202
202
  if name =~ /^\d/
203
203
  Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
204
204
  exit 1
205
- elsif constant_array.inject(Object) {|c, s| (c.const_defined?(s) && c.const_get(s)) || break }
206
- Bundler.ui.error "Invalid gem name #{name} constant #{constant_array.join("::")} is already in use. Please choose another gem name."
207
- exit 1
208
205
  end
206
+
207
+ constant_name = constant_array.join("::")
208
+
209
+ existing_constant = constant_array.inject(Object) do |c, s|
210
+ defined = begin
211
+ c.const_defined?(s)
212
+ rescue NameError
213
+ Bundler.ui.error "Invalid gem name #{name} -- `#{constant_name}` is an invalid constant name"
214
+ exit 1
215
+ end
216
+ (defined && c.const_get(s)) || break
217
+ end
218
+
219
+ return unless existing_constant
220
+ Bundler.ui.error "Invalid gem name #{name} constant #{constant_name} is already in use. Please choose another gem name."
221
+ exit 1
209
222
  end
210
223
 
211
224
  def open_editor(editor, file)
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+
2
4
  module Bundler
3
5
  class CLI::Install
4
6
  attr_reader :options
@@ -57,7 +59,7 @@ module Bundler
57
59
 
58
60
  if options["binstubs"]
59
61
  Bundler::SharedHelpers.major_deprecation \
60
- "the --binstubs option will be removed in favor of `bundle binstubs`"
62
+ "The --binstubs option will be removed in favor of `bundle binstubs`"
61
63
  end
62
64
 
63
65
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
@@ -69,7 +71,7 @@ module Bundler
69
71
  Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
70
72
 
71
73
  Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
72
- confirm_without_groups
74
+ Bundler::CLI::Common.output_without_groups_message
73
75
 
74
76
  if Bundler.settings[:path]
75
77
  absolute_path = File.expand_path(Bundler.settings[:path])
@@ -79,11 +81,7 @@ module Bundler
79
81
  Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
80
82
  end
81
83
 
82
- unless Bundler.settings["ignore_messages"]
83
- installer.post_install_messages.to_a.each do |name, msg|
84
- print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
85
- end
86
- end
84
+ Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
87
85
 
88
86
  warn_ambiguous_gems
89
87
 
@@ -132,12 +130,6 @@ module Bundler
132
130
  end
133
131
  end
134
132
 
135
- def confirm_without_groups
136
- return unless Bundler.settings.without.any?
137
- require "bundler/cli/common"
138
- Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
139
- end
140
-
141
133
  def dependencies_count_for(definition)
142
134
  count = definition.dependencies.count
143
135
  "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
@@ -148,11 +140,6 @@ module Bundler
148
140
  "#{count} #{count == 1 ? "gem" : "gems"} now installed"
149
141
  end
150
142
 
151
- def print_post_install_message(name, msg)
152
- Bundler.ui.confirm "Post-install message from #{name}:"
153
- Bundler.ui.info msg
154
- end
155
-
156
143
  def check_for_group_conflicts
157
144
  if options[:without] && options[:with]
158
145
  conflicting_groups = options[:without] & options[:with]
@@ -167,8 +154,8 @@ module Bundler
167
154
  def check_for_options_conflicts
168
155
  if (options[:path] || options[:deployment]) && options[:system]
169
156
  error_message = String.new
170
- error_message << "You have specified both a path to install your gems to as well as --system. Please choose.\n" if options[:path]
171
- error_message << "You have specified both --deployment as well as --system. Please choose.\n" if options[:deployment]
157
+ error_message << "You have specified both --path as well as --system. Please choose only one option.\n" if options[:path]
158
+ error_message << "You have specified both --deployment as well as --system. Please choose only one option.\n" if options[:deployment]
172
159
  raise InvalidOption.new(error_message)
173
160
  end
174
161
  end
@@ -33,7 +33,7 @@ module Bundler
33
33
 
34
34
  options["add-platform"].each do |platform_string|
35
35
  platform = Gem::Platform.new(platform_string)
36
- if platform.to_a.compact == %w(unknown)
36
+ if platform.to_s == "unknown"
37
37
  Bundler.ui.warn "The platform `#{platform_string}` is unknown to RubyGems " \
38
38
  "and adding it will likely lead to resolution errors"
39
39
  end
@@ -13,7 +13,8 @@ module Bundler
13
13
  def run
14
14
  editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
15
15
  return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
16
- path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
16
+ return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
17
+ path = spec.full_gem_path
17
18
  Dir.chdir(path) do
18
19
  command = Shellwords.split(editor) + [path]
19
20
  Bundler.with_clean_env do
@@ -22,7 +22,11 @@ module Bundler
22
22
  Bundler.definition.validate_runtime!
23
23
  current_specs = Bundler.ui.silence { Bundler.load.specs }
24
24
  current_dependencies = {}
25
- Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
25
+ Bundler.ui.silence do
26
+ Bundler.load.dependencies.each do |dep|
27
+ current_dependencies[dep.name] = dep
28
+ end
29
+ end
26
30
 
27
31
  definition = if gems.empty? && sources.empty?
28
32
  # We're doing a full update
@@ -31,11 +35,24 @@ module Bundler
31
35
  Bundler.definition(:gems => gems, :sources => sources)
32
36
  end
33
37
 
34
- Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
35
- # the patch level options don't work without strict also being true
36
- strict = options[:strict] || Bundler::CLI::Common.patch_level_options(options).any?
38
+ Bundler::CLI::Common.configure_gem_version_promoter(
39
+ Bundler.definition,
40
+ options
41
+ )
42
+
43
+ # the patch level options imply strict is also true. It wouldn't make
44
+ # sense otherwise.
45
+ strict = options[:strict] ||
46
+ Bundler::CLI::Common.patch_level_options(options).any?
47
+
48
+ filter_options_patch = options.keys &
49
+ %w(filter-major filter-minor filter-patch)
50
+
51
+ definition_resolution = proc do
52
+ return definition.resolve_with_cache! if options[:local]
53
+ definition.resolve_remotely!
54
+ end
37
55
 
38
- definition_resolution = proc { options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely! }
39
56
  if options[:parseable]
40
57
  Bundler.ui.silence(&definition_resolution)
41
58
  else
@@ -47,32 +64,24 @@ module Bundler
47
64
  outdated_gems_list = []
48
65
 
49
66
  # Loop through the current specs
50
- gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
51
- [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
67
+ gemfile_specs, dependency_specs = current_specs.partition do |spec|
68
+ current_dependencies.key? spec.name
69
+ end
70
+
71
+ (gemfile_specs + dependency_specs).sort_by(&:name).each do |current_spec|
52
72
  next if !gems.empty? && !gems.include?(current_spec.name)
53
73
 
54
74
  dependency = current_dependencies[current_spec.name]
75
+ active_spec = retrieve_active_spec(strict, definition, current_spec)
55
76
 
56
- if strict
57
- active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.platform == current_spec.platform }
58
- else
59
- active_specs = definition.index[current_spec.name].select {|spec| spec.platform == current_spec.platform }.sort_by(&:version)
60
- if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
61
- active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
62
- end
63
- active_spec = active_specs.last
64
- end
65
-
66
- if options["filter-major"] || options["filter-minor"] || options["filter-patch"]
77
+ next if active_spec.nil?
78
+ if filter_options_patch.any?
67
79
  update_present = update_present_via_semver_portions(current_spec, active_spec, options)
68
- active_spec = nil unless update_present
80
+ next unless update_present
69
81
  end
70
82
 
71
- next if active_spec.nil?
72
-
73
83
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
74
- git_outdated = current_spec.git_version != active_spec.git_version
75
- if gem_outdated || git_outdated
84
+ if gem_outdated || (current_spec.git_version != active_spec.git_version)
76
85
  groups = nil
77
86
  if dependency && !options[:parseable]
78
87
  groups = dependency.groups.join(", ")
@@ -94,17 +103,21 @@ module Bundler
94
103
  end
95
104
 
96
105
  if outdated_gems_list.empty?
97
- display_nothing_outdated_message
106
+ display_nothing_outdated_message(filter_options_patch)
98
107
  else
99
108
  unless options[:parseable]
100
109
  if options[:pre]
101
- Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
110
+ Bundler.ui.info "Outdated gems included in the bundle (including " \
111
+ "pre-releases):"
102
112
  else
103
113
  Bundler.ui.info "Outdated gems included in the bundle:"
104
114
  end
105
115
  end
106
116
 
107
- options_include_groups = [:group, :groups].select {|v| options.keys.include?(v.to_s) }
117
+ options_include_groups = [:group, :groups].select do |v|
118
+ options.keys.include?(v.to_s)
119
+ end
120
+
108
121
  if options_include_groups.any?
109
122
  ordered_groups = outdated_gems_by_groups.keys.compact.sort
110
123
  [nil, ordered_groups].flatten.each do |groups|
@@ -126,12 +139,24 @@ module Bundler
126
139
  end
127
140
 
128
141
  gems.each do |gem|
129
- print_gem(gem[:current_spec], gem[:active_spec], gem[:dependency], groups, options_include_groups.any?)
142
+ print_gem(
143
+ gem[:current_spec],
144
+ gem[:active_spec],
145
+ gem[:dependency],
146
+ groups,
147
+ options_include_groups.any?
148
+ )
130
149
  end
131
150
  end
132
151
  else
133
152
  outdated_gems_list.each do |gem|
134
- print_gem(gem[:current_spec], gem[:active_spec], gem[:dependency], gem[:groups], options_include_groups.any?)
153
+ print_gem(
154
+ gem[:current_spec],
155
+ gem[:active_spec],
156
+ gem[:dependency],
157
+ gem[:groups],
158
+ options_include_groups.any?
159
+ )
135
160
  end
136
161
  end
137
162
 
@@ -141,11 +166,27 @@ module Bundler
141
166
 
142
167
  private
143
168
 
144
- def display_nothing_outdated_message
169
+ def retrieve_active_spec(strict, definition, current_spec)
170
+ if strict
171
+ active_spec = definition.find_resolved_spec(current_spec)
172
+ else
173
+ active_specs = definition.find_indexed_specs(current_spec)
174
+ if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
175
+ active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
176
+ end
177
+ active_spec = active_specs.last
178
+ end
179
+
180
+ active_spec
181
+ end
182
+
183
+ def display_nothing_outdated_message(filter_options_patch)
145
184
  unless options[:parseable]
146
- filter_options = options.keys & %w(filter-major filter-minor filter-patch)
147
- if filter_options.any?
148
- display = filter_options.map {|o| o.sub("filter-", "") }.join(" or ")
185
+ if filter_options_patch.any?
186
+ display = filter_options_patch.map do |o|
187
+ o.sub("filter-", "")
188
+ end.join(" or ")
189
+
149
190
  Bundler.ui.info "No #{display} updates to display.\n"
150
191
  else
151
192
  Bundler.ui.info "Bundle up to date!\n"
@@ -156,25 +197,32 @@ module Bundler
156
197
  def print_gem(current_spec, active_spec, dependency, groups, options_include_groups)
157
198
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
158
199
  current_version = "#{current_spec.version}#{current_spec.git_version}"
159
- dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
160
200
 
161
- spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})"
162
- if options[:parseable]
163
- Bundler.ui.info spec_outdated_info.to_s.rstrip
201
+ if dependency && dependency.specific?
202
+ dependency_version = %(, requested #{dependency.requirement})
203
+ end
204
+
205
+ spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, " \
206
+ "installed #{current_version}#{dependency_version})"
207
+
208
+ output_message = if options[:parseable]
209
+ spec_outdated_info.to_s
164
210
  elsif options_include_groups || !groups
165
- Bundler.ui.info " * #{spec_outdated_info}".rstrip
211
+ " * #{spec_outdated_info}"
166
212
  else
167
- Bundler.ui.info " * #{spec_outdated_info} in groups \"#{groups}\"".rstrip
213
+ " * #{spec_outdated_info} in groups \"#{groups}\""
168
214
  end
215
+
216
+ Bundler.ui.info output_message.rstrip
169
217
  end
170
218
 
171
219
  def check_for_deployment_mode
172
220
  if Bundler.settings[:frozen]
173
- error_message = "You are trying to check outdated gems in deployment mode. " \
174
- "Run `bundle outdated` elsewhere.\n" \
175
- "\nIf this is a development machine, remove the #{Bundler.default_gemfile} freeze" \
176
- "\nby running `bundle install --no-deployment`."
177
- raise ProductionError, error_message
221
+ raise ProductionError, "You are trying to check outdated gems in " \
222
+ "deployment mode. Run `bundle outdated` elsewhere.\n" \
223
+ "\nIf this is a development machine, remove the " \
224
+ "#{Bundler.default_gemfile} freeze" \
225
+ "\nby running `bundle install --no-deployment`."
178
226
  end
179
227
  end
180
228
 
@@ -52,7 +52,7 @@ module Bundler
52
52
  Bundler.settings[:jobs] = opts["jobs"] if opts["jobs"]
53
53
 
54
54
  Bundler.definition.validate_runtime!
55
- Installer.install Bundler.root, Bundler.definition, opts
55
+ installer = Installer.install Bundler.root, Bundler.definition, opts
56
56
  Bundler.load.cache if Bundler.app_cache.exist?
57
57
 
58
58
  if Bundler.settings[:clean] && Bundler.settings[:path]
@@ -61,15 +61,8 @@ module Bundler
61
61
  end
62
62
 
63
63
  Bundler.ui.confirm "Bundle updated!"
64
- without_groups_messages
65
- end
66
-
67
- private
68
-
69
- def without_groups_messages
70
- return unless Bundler.settings.without.any?
71
- require "bundler/cli/common"
72
- Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
64
+ Bundler::CLI::Common.output_without_groups_message
65
+ Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
73
66
  end
74
67
  end
75
68
  end
@@ -28,6 +28,8 @@ module Bundler
28
28
  @cache = Cache.new(@directory)
29
29
  @endpoints = Set.new
30
30
  @info_checksums_by_name = {}
31
+ @parsed_checksums = false
32
+ @mutex = Mutex.new
31
33
  @in_parallel = lambda do |inputs, &blk|
32
34
  inputs.map(&blk)
33
35
  end
@@ -72,7 +74,7 @@ module Bundler
72
74
 
73
75
  def update(local_path, remote_path)
74
76
  Bundler::CompactIndexClient.debug { "update(#{local_path}, #{remote_path})" }
75
- unless @endpoints.add?(remote_path)
77
+ unless synchronize { @endpoints.add?(remote_path) }
76
78
  Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" }
77
79
  return
78
80
  end
@@ -98,5 +100,9 @@ module Bundler
98
100
  def url(path)
99
101
  path
100
102
  end
103
+
104
+ def synchronize
105
+ @mutex.synchronize { yield }
106
+ end
101
107
  end
102
108
  end
@@ -16,6 +16,7 @@ module Bundler
16
16
  2.2
17
17
  2.3
18
18
  2.4
19
+ 2.5
19
20
  ).freeze
20
21
 
21
22
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -499,14 +499,10 @@ module Bundler
499
499
  end
500
500
  end
501
501
 
502
- # TODO: refactor this so that `match_platform` can be called with two platforms
503
- DummyPlatform = Struct.new(:platform)
504
- class DummyPlatform; include MatchPlatform; end
505
502
  def validate_platforms!
506
503
  return if @platforms.any? do |bundle_platform|
507
- bundle_platform = DummyPlatform.new(bundle_platform)
508
504
  Bundler.rubygems.platforms.any? do |local_platform|
509
- bundle_platform.match_platform(local_platform)
505
+ MatchPlatform.platforms_match?(bundle_platform, local_platform)
510
506
  end
511
507
  end
512
508
 
@@ -531,6 +527,14 @@ module Bundler
531
527
  add_platform(generic(current_platform))
532
528
  end
533
529
 
530
+ def find_resolved_spec(current_spec)
531
+ specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
532
+ end
533
+
534
+ def find_indexed_specs(current_spec)
535
+ index[current_spec.name].select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
536
+ end
537
+
534
538
  attr_reader :sources
535
539
  private :sources
536
540
 
@@ -17,6 +17,8 @@ module Bundler
17
17
  :ruby_21 => Gem::Platform::RUBY,
18
18
  :ruby_22 => Gem::Platform::RUBY,
19
19
  :ruby_23 => Gem::Platform::RUBY,
20
+ :ruby_24 => Gem::Platform::RUBY,
21
+ :ruby_25 => Gem::Platform::RUBY,
20
22
  :mri => Gem::Platform::RUBY,
21
23
  :mri_18 => Gem::Platform::RUBY,
22
24
  :mri_19 => Gem::Platform::RUBY,
@@ -24,6 +26,8 @@ module Bundler
24
26
  :mri_21 => Gem::Platform::RUBY,
25
27
  :mri_22 => Gem::Platform::RUBY,
26
28
  :mri_23 => Gem::Platform::RUBY,
29
+ :mri_24 => Gem::Platform::RUBY,
30
+ :mri_25 => Gem::Platform::RUBY,
27
31
  :rbx => Gem::Platform::RUBY,
28
32
  :jruby => Gem::Platform::JAVA,
29
33
  :jruby_18 => Gem::Platform::JAVA,
@@ -35,12 +39,16 @@ module Bundler
35
39
  :mswin_21 => Gem::Platform::MSWIN,
36
40
  :mswin_22 => Gem::Platform::MSWIN,
37
41
  :mswin_23 => Gem::Platform::MSWIN,
42
+ :mswin_24 => Gem::Platform::MSWIN,
43
+ :mswin_25 => Gem::Platform::MSWIN,
38
44
  :mswin64 => Gem::Platform::MSWIN64,
39
45
  :mswin64_19 => Gem::Platform::MSWIN64,
40
46
  :mswin64_20 => Gem::Platform::MSWIN64,
41
47
  :mswin64_21 => Gem::Platform::MSWIN64,
42
48
  :mswin64_22 => Gem::Platform::MSWIN64,
43
49
  :mswin64_23 => Gem::Platform::MSWIN64,
50
+ :mswin64_24 => Gem::Platform::MSWIN64,
51
+ :mswin64_25 => Gem::Platform::MSWIN64,
44
52
  :mingw => Gem::Platform::MINGW,
45
53
  :mingw_18 => Gem::Platform::MINGW,
46
54
  :mingw_19 => Gem::Platform::MINGW,
@@ -48,11 +56,15 @@ module Bundler
48
56
  :mingw_21 => Gem::Platform::MINGW,
49
57
  :mingw_22 => Gem::Platform::MINGW,
50
58
  :mingw_23 => Gem::Platform::MINGW,
59
+ :mingw_24 => Gem::Platform::MINGW,
60
+ :mingw_25 => Gem::Platform::MINGW,
51
61
  :x64_mingw => Gem::Platform::X64_MINGW,
52
62
  :x64_mingw_20 => Gem::Platform::X64_MINGW,
53
63
  :x64_mingw_21 => Gem::Platform::X64_MINGW,
54
64
  :x64_mingw_22 => Gem::Platform::X64_MINGW,
55
65
  :x64_mingw_23 => Gem::Platform::X64_MINGW,
66
+ :x64_mingw_24 => Gem::Platform::X64_MINGW,
67
+ :x64_mingw_25 => Gem::Platform::X64_MINGW,
56
68
  }.freeze
57
69
 
58
70
  REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|