rubygems-update 3.2.33 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -4
  3. data/CONTRIBUTING.md +40 -10
  4. data/Manifest.txt +6 -5
  5. data/POLICIES.md +22 -8
  6. data/README.md +9 -7
  7. data/UPGRADING.md +5 -81
  8. data/bin/gem +1 -6
  9. data/bundler/CHANGELOG.md +27 -0
  10. data/bundler/exe/bundle +7 -8
  11. data/bundler/lib/bundler/build_metadata.rb +2 -2
  12. data/bundler/lib/bundler/cli/gem.rb +1 -1
  13. data/bundler/lib/bundler/cli/install.rb +2 -0
  14. data/bundler/lib/bundler/cli.rb +5 -0
  15. data/bundler/lib/bundler/definition.rb +14 -2
  16. data/bundler/lib/bundler/dependency.rb +5 -7
  17. data/bundler/lib/bundler/dsl.rb +0 -27
  18. data/bundler/lib/bundler/endpoint_specification.rb +0 -8
  19. data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
  20. data/bundler/lib/bundler/fetcher.rb +2 -5
  21. data/bundler/lib/bundler/injector.rb +10 -1
  22. data/bundler/lib/bundler/installer/gem_installer.rb +1 -6
  23. data/bundler/lib/bundler/installer.rb +1 -4
  24. data/bundler/lib/bundler/lockfile_parser.rb +10 -13
  25. data/bundler/lib/bundler/man/bundle-add.1 +9 -1
  26. data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -1
  27. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  28. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  29. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
  31. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
  33. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  34. data/bundler/lib/bundler/man/gemfile.5.ronn +1 -1
  35. data/bundler/lib/bundler/plugin/installer.rb +1 -1
  36. data/bundler/lib/bundler/process_lock.rb +1 -1
  37. data/bundler/lib/bundler/psyched_yaml.rb +1 -13
  38. data/bundler/lib/bundler/resolver.rb +34 -29
  39. data/bundler/lib/bundler/rubygems_ext.rb +2 -0
  40. data/bundler/lib/bundler/rubygems_integration.rb +11 -48
  41. data/bundler/lib/bundler/self_manager.rb +73 -0
  42. data/bundler/lib/bundler/shared_helpers.rb +2 -9
  43. data/bundler/lib/bundler/source/metadata.rb +1 -1
  44. data/bundler/lib/bundler/templates/Executable.bundler +1 -1
  45. data/bundler/lib/bundler/templates/Gemfile +0 -2
  46. data/bundler/lib/bundler/templates/gems.rb +0 -3
  47. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -1
  48. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  49. data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  50. data/bundler/lib/bundler/ui/shell.rb +1 -1
  51. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  52. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  53. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  54. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  63. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  64. data/bundler/lib/bundler/version.rb +1 -1
  65. data/bundler/lib/bundler.rb +9 -3
  66. data/hide_lib_for_update/note.txt +0 -4
  67. data/lib/rubygems/command_manager.rb +1 -1
  68. data/lib/rubygems/commands/install_command.rb +5 -2
  69. data/lib/rubygems/commands/server_command.rb +14 -77
  70. data/lib/rubygems/commands/setup_command.rb +4 -16
  71. data/lib/rubygems/commands/update_command.rb +9 -4
  72. data/lib/rubygems/defaults.rb +2 -20
  73. data/lib/rubygems/deprecate.rb +53 -6
  74. data/lib/rubygems/exceptions.rb +26 -1
  75. data/lib/rubygems/ext/builder.rb +5 -3
  76. data/lib/rubygems/install_update_options.rb +11 -2
  77. data/lib/rubygems/installer.rb +11 -1
  78. data/lib/rubygems/name_tuple.rb +2 -3
  79. data/lib/rubygems/path_support.rb +1 -6
  80. data/lib/rubygems/platform.rb +4 -0
  81. data/lib/rubygems/remote_fetcher.rb +1 -1
  82. data/lib/rubygems/requirement.rb +1 -1
  83. data/lib/rubygems/resolver/installer_set.rb +1 -1
  84. data/lib/rubygems/security.rb +4 -3
  85. data/lib/rubygems/source.rb +3 -1
  86. data/lib/rubygems/spec_fetcher.rb +1 -1
  87. data/lib/rubygems/specification.rb +11 -13
  88. data/lib/rubygems/text.rb +21 -20
  89. data/lib/rubygems/uninstaller.rb +4 -1
  90. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  91. data/lib/rubygems/version.rb +2 -0
  92. data/lib/rubygems.rb +26 -23
  93. data/rubygems-update.gemspec +1 -1
  94. data/setup.rb +1 -6
  95. data/test/rubygems/helper.rb +20 -6
  96. data/test/rubygems/test_config.rb +2 -2
  97. data/test/rubygems/test_exit.rb +11 -0
  98. data/test/rubygems/test_gem.rb +46 -41
  99. data/test/rubygems/test_gem_command_manager.rb +16 -2
  100. data/test/rubygems/test_gem_commands_open_command.rb +1 -1
  101. data/test/rubygems/test_gem_commands_server_command.rb +4 -46
  102. data/test/rubygems/test_gem_commands_update_command.rb +2 -2
  103. data/test/rubygems/test_gem_path_support.rb +2 -6
  104. data/test/rubygems/test_gem_remote_fetcher.rb +15 -0
  105. data/test/rubygems/test_gem_requirement.rb +0 -1
  106. data/test/rubygems/test_gem_security.rb +1 -1
  107. data/test/rubygems/test_gem_specification.rb +16 -25
  108. data/test/rubygems/test_gem_text.rb +6 -0
  109. data/test/rubygems/test_project_sanity.rb +1 -1
  110. data/test/rubygems/test_require.rb +0 -7
  111. data/test/rubygems/test_rubygems.rb +23 -0
  112. metadata +9 -8
  113. data/bundler/lib/bundler/gemdeps.rb +0 -29
  114. data/lib/rubygems/server.rb +0 -882
  115. data/test/rubygems/bogussources.rb +0 -9
  116. data/test/rubygems/test_gem_server.rb +0 -608
@@ -277,9 +277,6 @@ module Bundler
277
277
 
278
278
  def add_git_sources
279
279
  git_source(:github) do |repo_name|
280
- warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
281
- "https://github.com/#{repo_name}.git"
282
- RUBY
283
280
  if repo_name =~ GITHUB_PULL_REQUEST_URL
284
281
  {
285
282
  "git" => "https://github.com/#{$1}.git",
@@ -294,18 +291,10 @@ module Bundler
294
291
  end
295
292
 
296
293
  git_source(:gist) do |repo_name|
297
- warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
298
-
299
294
  "https://gist.github.com/#{repo_name}.git"
300
295
  end
301
296
 
302
297
  git_source(:bitbucket) do |repo_name|
303
- warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
304
- user_name, repo_name = repo_name.split("/")
305
- repo_name ||= user_name
306
- "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
307
- RUBY
308
-
309
298
  user_name, repo_name = repo_name.split("/")
310
299
  repo_name ||= user_name
311
300
  "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
@@ -490,22 +479,6 @@ repo_name ||= user_name
490
479
  end
491
480
  end
492
481
 
493
- def warn_deprecated_git_source(name, replacement, additional_message = nil)
494
- additional_message &&= " #{additional_message}"
495
- replacement = if replacement.count("\n").zero?
496
- "{|repo_name| #{replacement} }"
497
- else
498
- "do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
499
- end
500
-
501
- Bundler::SharedHelpers.major_deprecation 3, <<-EOS
502
- The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
503
-
504
- git_source(:#{name}) #{replacement}
505
-
506
- EOS
507
- end
508
-
509
482
  class DSLError < GemfileError
510
483
  # @return [String] the description that should be presented to the user.
511
484
  #
@@ -3,7 +3,6 @@
3
3
  module Bundler
4
4
  # used for Creating Specifications from the Gemcutter Endpoint
5
5
  class EndpointSpecification < Gem::Specification
6
- ILLFORMED_MESSAGE = 'Ill-formed requirement ["#<YAML::Syck::DefaultKey'.freeze
7
6
  include MatchPlatform
8
7
 
9
8
  attr_reader :name, :version, :platform, :required_rubygems_version, :required_ruby_version, :checksum
@@ -129,13 +128,6 @@ module Bundler
129
128
 
130
129
  def build_dependency(name, requirements)
131
130
  Gem::Dependency.new(name, requirements)
132
- rescue ArgumentError => e
133
- raise unless e.message.include?(ILLFORMED_MESSAGE)
134
- puts # we shouldn't print the error message on the "fetching info" status line
135
- raise GemspecError,
136
- "Unfortunately, the gem #{name} (#{version}) has an invalid " \
137
- "gemspec.\nPlease ask the gem author to yank the bad version to fix " \
138
- "this issue. For more information, see http://bit.ly/syck-defaultkey."
139
131
  end
140
132
  end
141
133
  end
@@ -68,11 +68,16 @@ module Bundler
68
68
  compact_index_request :fetch_spec
69
69
 
70
70
  def available?
71
- return nil unless SharedHelpers.md5_available?
72
- user_home = Bundler.user_home
73
- return nil unless user_home.directory? && user_home.writable?
71
+ unless SharedHelpers.md5_available?
72
+ Bundler.ui.debug("FIPS mode is enabled, bundler can't use the CompactIndex API")
73
+ return nil
74
+ end
75
+ if fetch_uri.scheme == "file"
76
+ Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
77
+ return false
78
+ end
74
79
  # Read info file checksums out of /versions, so we can know if gems are up to date
75
- fetch_uri.scheme != "file" && compact_index_client.update_and_parse_checksums!
80
+ compact_index_client.update_and_parse_checksums!
76
81
  rescue CompactIndexClient::Updater::MisMatchedChecksumError => e
77
82
  Bundler.ui.debug(e.message)
78
83
  nil
@@ -71,8 +71,8 @@ module Bundler
71
71
  :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
72
72
  FAIL_ERRORS = begin
73
73
  fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
74
- fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError)
75
- fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact)
74
+ fail_errors << Gem::Requirement::BadRequirementError
75
+ fail_errors.concat(NET_ERRORS.map {|e| Net.const_get(e) })
76
76
  end.freeze
77
77
 
78
78
  class << self
@@ -122,7 +122,6 @@ module Bundler
122
122
 
123
123
  # return the specs in the bundler format as an index
124
124
  def specs(gem_names, source)
125
- old = Bundler.rubygems.sources
126
125
  index = Bundler::Index.new
127
126
 
128
127
  if Bundler::Fetcher.disable_endpoint
@@ -153,8 +152,6 @@ module Bundler
153
152
  rescue CertificateFailureError
154
153
  Bundler.ui.info "" if gem_names && use_api # newline after dots
155
154
  raise
156
- ensure
157
- Bundler.rubygems.sources = old
158
155
  end
159
156
 
160
157
  def use_api
@@ -112,9 +112,12 @@ module Bundler
112
112
 
113
113
  source = ", :source => \"#{d.source}\"" unless d.source.nil?
114
114
  git = ", :git => \"#{d.git}\"" unless d.git.nil?
115
+ github = ", :github => \"#{d.github}\"" unless d.github.nil?
115
116
  branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
117
+ ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
118
+ require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
116
119
 
117
- %(gem #{name}#{requirement}#{group}#{source}#{git}#{branch})
120
+ %(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path})
118
121
  end.join("\n")
119
122
  end
120
123
 
@@ -269,5 +272,11 @@ module Bundler
269
272
  def show_warning(message)
270
273
  Bundler.ui.info Bundler.ui.add_color(message, :yellow)
271
274
  end
275
+
276
+ def convert_autorequire(autorequire)
277
+ autorequire = autorequire.first
278
+ return autorequire if autorequire == "false"
279
+ autorequire.inspect
280
+ end
272
281
  end
273
282
  end
@@ -13,7 +13,7 @@ module Bundler
13
13
  end
14
14
 
15
15
  def install_from_spec
16
- post_install_message = spec_settings ? install_with_settings : install
16
+ post_install_message = install
17
17
  Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
18
18
  generate_executable_stubs
19
19
  return true, post_install_message
@@ -54,11 +54,6 @@ module Bundler
54
54
  spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
55
55
  end
56
56
 
57
- def install_with_settings
58
- # Build arguments are global, so this is mutexed
59
- Bundler.rubygems.install_with_build_args([spec_settings]) { install }
60
- end
61
-
62
57
  def out_of_space_message
63
58
  "#{install_error_message}\nYour disk is out of space. Free some space to be able to install your bundle."
64
59
  end
@@ -218,9 +218,6 @@ module Bundler
218
218
  return jobs
219
219
  end
220
220
 
221
- # Parallelization has some issues on Windows, so it's not yet the default
222
- return 1 if Gem.win_platform?
223
-
224
221
  Bundler.settings.processor_count
225
222
  end
226
223
 
@@ -242,7 +239,7 @@ module Bundler
242
239
 
243
240
  def ensure_specs_are_compatible!
244
241
  system_ruby = Bundler::RubyVersion.system
245
- rubygems_version = Gem::Version.create(Gem::VERSION)
242
+ rubygems_version = Bundler.rubygems.version
246
243
  @definition.specs.each do |spec|
247
244
  if required_ruby_version = spec.required_ruby_version
248
245
  unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
@@ -46,6 +46,16 @@ module Bundler
46
46
  attributes
47
47
  end
48
48
 
49
+ def self.bundled_with
50
+ lockfile = Bundler.default_lockfile
51
+ return unless lockfile.file?
52
+
53
+ lockfile_contents = Bundler.read_file(lockfile)
54
+ return unless lockfile_contents.include?(BUNDLED)
55
+
56
+ lockfile_contents.split(BUNDLED).last.strip
57
+ end
58
+
49
59
  def initialize(lockfile)
50
60
  @platforms = []
51
61
  @sources = []
@@ -77,25 +87,12 @@ module Bundler
77
87
  end
78
88
  end
79
89
  @specs = @specs.values.sort_by(&:identifier)
80
- warn_for_outdated_bundler_version
81
90
  rescue ArgumentError => e
82
91
  Bundler.ui.debug(e)
83
92
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
84
93
  "and then `bundle install` to generate a new lockfile."
85
94
  end
86
95
 
87
- def warn_for_outdated_bundler_version
88
- return unless bundler_version
89
- return if bundler_version.segments.last == "dev"
90
- prerelease_text = bundler_version.prerelease? ? " --pre" : ""
91
- current_version = Gem::Version.create(Bundler::VERSION)
92
- return unless current_version < bundler_version
93
- Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
94
- "than the version that created the lockfile (#{bundler_version}). We suggest you to " \
95
- "upgrade to the version that created the lockfile by running `gem install " \
96
- "bundler:#{bundler_version}#{prerelease_text}`.\n"
97
- end
98
-
99
96
  private
100
97
 
101
98
  TYPES = {
@@ -7,7 +7,7 @@
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-branch=BRANCH] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
10
+ \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
13
  Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
@@ -49,10 +49,18 @@ Specify the source for the added gem\.
49
49
  Specify the git source for the added gem\.
50
50
  .
51
51
  .TP
52
+ \fB\-\-github\fR
53
+ Specify the github source for the added gem\.
54
+ .
55
+ .TP
52
56
  \fB\-\-branch\fR
53
57
  Specify the git branch for the added gem\.
54
58
  .
55
59
  .TP
60
+ \fB\-\-ref\fR
61
+ Specify the git ref for the added gem\.
62
+ .
63
+ .TP
56
64
  \fB\-\-skip\-install\fR
57
65
  Adds the gem to the Gemfile but does not install it\.
58
66
  .
@@ -3,7 +3,7 @@ bundle-add(1) -- Add gem to the Gemfile and run bundle install
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install] [--strict] [--optimistic]
6
+ `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic]
7
7
 
8
8
  ## DESCRIPTION
9
9
  Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
@@ -33,9 +33,15 @@ bundle add rails --group "development, test"
33
33
  * `--git`:
34
34
  Specify the git source for the added gem.
35
35
 
36
+ * `--github`:
37
+ Specify the github source for the added gem.
38
+
36
39
  * `--branch`:
37
40
  Specify the git branch for the added gem.
38
41
 
42
+ * `--ref`:
43
+ Specify the git ref for the added gem.
44
+
39
45
  * `--skip-install`:
40
46
  Adds the gem to the Gemfile but does not install it.
41
47
 
@@ -211,7 +211,7 @@ The following is a list of all configuration keys and their purpose\. You can le
211
211
  \fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR): Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
212
212
  .
213
213
  .IP "\(bu" 4
214
- \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\.
214
+ \fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to the number of available processors\.
215
215
  .
216
216
  .IP "\(bu" 4
217
217
  \fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
@@ -449,7 +449,7 @@ export BUNDLE_GITHUB__COM=username:password
449
449
  .IP "" 0
450
450
  .
451
451
  .P
452
- This is especially useful for private repositories on hosts such as Github, where you can use personal OAuth tokens:
452
+ This is especially useful for private repositories on hosts such as GitHub, where you can use personal OAuth tokens:
453
453
  .
454
454
  .IP "" 4
455
455
  .
@@ -208,8 +208,8 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
208
208
  * `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`):
209
209
  Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
210
210
  * `jobs` (`BUNDLE_JOBS`):
211
- The number of gems Bundler can install in parallel. Defaults to 1 on Windows,
212
- and to the the number of processors on other platforms.
211
+ The number of gems Bundler can install in parallel. Defaults to the number of
212
+ available processors.
213
213
  * `no_install` (`BUNDLE_NO_INSTALL`):
214
214
  Whether `bundle package` should skip installing gems.
215
215
  * `no_prune` (`BUNDLE_NO_PRUNE`):
@@ -360,7 +360,7 @@ Or you can set the credentials as an environment variable like so:
360
360
 
361
361
  export BUNDLE_GITHUB__COM=username:password
362
362
 
363
- This is especially useful for private repositories on hosts such as Github,
363
+ This is especially useful for private repositories on hosts such as GitHub,
364
364
  where you can use personal OAuth tokens:
365
365
 
366
366
  export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
@@ -63,7 +63,7 @@ The location of the Gemfile(5) which Bundler should use\. This defaults to a Gem
63
63
  .
64
64
  .TP
65
65
  \fB\-\-jobs=[<number>]\fR, \fB\-j[<number>]\fR
66
- The maximum number of parallel download and install jobs\. The default is \fB1\fR\.
66
+ The maximum number of parallel download and install jobs\. The default is the number of available processors\.
67
67
  .
68
68
  .TP
69
69
  \fB\-\-local\fR
@@ -100,8 +100,8 @@ automatically and that requires `bundler` to silently remember them. Since
100
100
  to this location.
101
101
 
102
102
  * `--jobs=[<number>]`, `-j[<number>]`:
103
- The maximum number of parallel download and install jobs. The default
104
- is `1`.
103
+ The maximum number of parallel download and install jobs. The default is the
104
+ number of available processors.
105
105
 
106
106
  * `--local`:
107
107
  Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the
@@ -47,7 +47,7 @@ Fall back to using the single\-file index of all gems\.
47
47
  .
48
48
  .TP
49
49
  \fB\-\-jobs=[<number>]\fR, \fB\-j[<number>]\fR
50
- Specify the number of jobs to run in parallel\. The default is \fB1\fR\.
50
+ Specify the number of jobs to run in parallel\. The default is the number of available processors\.
51
51
  .
52
52
  .TP
53
53
  \fB\-\-retry=[<number>]\fR
@@ -56,7 +56,8 @@ gem.
56
56
  Fall back to using the single-file index of all gems.
57
57
 
58
58
  * `--jobs=[<number>]`, `-j[<number>]`:
59
- Specify the number of jobs to run in parallel. The default is `1`.
59
+ Specify the number of jobs to run in parallel. The default is the number of
60
+ available processors.
60
61
 
61
62
  * `--retry=[<number>]`:
62
63
  Retry failed network or git requests for <number> times.
@@ -533,7 +533,7 @@ gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head"
533
533
  .IP "" 0
534
534
  .
535
535
  .SS "GIST"
536
- If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
536
+ If the git repository you want to use is hosted as a GitHub Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
537
537
  .
538
538
  .IP "" 4
539
539
  .
@@ -382,7 +382,7 @@ Which is equivalent to:
382
382
 
383
383
  ### GIST
384
384
 
385
- If the git repository you want to use is hosted as a Github Gist and is public, you can use
385
+ If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
386
386
  the :gist shorthand to specify the gist identifier (without the trailing ".git").
387
387
 
388
388
  gem "the_hatch", :gist => "4815162342"
@@ -21,7 +21,7 @@ module Bundler
21
21
  elsif options[:local_git]
22
22
  install_local_git(names, version, options)
23
23
  else
24
- sources = options[:source] || Bundler.rubygems.sources
24
+ sources = options[:source] || Gem.sources
25
25
  install_rubygems(names, version, sources)
26
26
  end
27
27
  end
@@ -12,7 +12,7 @@ module Bundler
12
12
  yield
13
13
  f.flock(File::LOCK_UN)
14
14
  end
15
- rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
15
+ rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
16
16
  # In the case the user does not have access to
17
17
  # create the lock file or is using NFS where
18
18
  # locks are not available we skip locking.
@@ -1,22 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Psych could be in the stdlib
4
- # but it's too late if Syck is already loaded
5
3
  begin
6
- require "psych" unless defined?(Syck)
4
+ require "psych"
7
5
  rescue LoadError
8
6
  # Apparently Psych wasn't available. Oh well.
9
7
  end
10
8
 
11
9
  # At least load the YAML stdlib, whatever that may be
12
10
  require "yaml" unless defined?(YAML.dump)
13
-
14
- module Bundler
15
- # On encountering invalid YAML,
16
- # Psych raises Psych::SyntaxError
17
- if defined?(::Psych::SyntaxError)
18
- YamlLibrarySyntaxError = ::Psych::SyntaxError
19
- else # Syck raises ArgumentError
20
- YamlLibrarySyntaxError = ::ArgumentError
21
- end
22
- end
@@ -134,6 +134,7 @@ module Bundler
134
134
  end
135
135
  nested.reduce([]) do |groups, (version, specs)|
136
136
  next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
137
+ next groups unless specs.any? {|spec| spec.match_platform(platform) }
137
138
 
138
139
  specs_by_platform = Hash.new do |current_specs, current_platform|
139
140
  current_specs[current_platform] = select_best_platform_match(specs, current_platform)
@@ -145,7 +146,7 @@ module Bundler
145
146
  next groups if @resolving_only_for_ruby
146
147
 
147
148
  spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
148
- groups << spec_group if spec_group
149
+ groups << spec_group
149
150
 
150
151
  groups
151
152
  end
@@ -262,30 +263,37 @@ module Bundler
262
263
  "If you are updating multiple gems in your Gemfile at once,\n" \
263
264
  "try passing them all to `bundle update`"
264
265
  else
265
- source = source_for(name)
266
- specs = source.specs.search(name)
267
- versions_with_platforms = specs.map {|s| [s.version, s.platform] }
268
- cache_message = begin
269
- " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
270
- rescue GemfileNotFound
271
- nil
272
- end
273
- message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
274
- message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
266
+ message = gem_not_found_message(name, requirement, source_for(name))
275
267
  end
276
268
  raise GemNotFound, message
277
269
  end
278
270
  end
279
271
 
280
- def formatted_versions_with_platforms(versions_with_platforms)
281
- version_platform_strs = versions_with_platforms.map do |vwp|
282
- version = vwp.first
283
- platform = vwp.last
284
- version_platform_str = String.new(version.to_s)
285
- version_platform_str << " #{platform}" unless platform.nil? || platform == Gem::Platform::RUBY
286
- version_platform_str
272
+ def gem_not_found_message(name, requirement, source, extra_message = "")
273
+ specs = source.specs.search(name)
274
+ matching_part = name
275
+ requirement_label = SharedHelpers.pretty_dependency(requirement)
276
+ cache_message = begin
277
+ " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
278
+ rescue GemfileNotFound
279
+ nil
280
+ end
281
+ specs_matching_requirement = specs.select {| spec| requirement.matches_spec?(spec) }
282
+
283
+ if specs_matching_requirement.any?
284
+ specs = specs_matching_requirement
285
+ matching_part = requirement_label
286
+ requirement_label = "#{requirement_label} #{requirement.__platform}"
287
287
  end
288
- version_platform_strs.join(", ")
288
+
289
+ message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
290
+
291
+ if specs.any?
292
+ message << "\nThe source contains the following gems matching '#{matching_part}':\n"
293
+ message << specs.map {|s| " * #{s.full_name}" }.join("\n")
294
+ end
295
+
296
+ message
289
297
  end
290
298
 
291
299
  def version_conflict_message(e)
@@ -357,19 +365,16 @@ module Bundler
357
365
 
358
366
  metadata_requirement = name.end_with?("\0")
359
367
 
360
- o << "Could not find gem '" unless metadata_requirement
361
- o << SharedHelpers.pretty_dependency(conflict.requirement)
362
- o << "'" unless metadata_requirement
363
- if conflict.requirement_trees.first.size > 1
364
- o << ", which is required by "
365
- o << "gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
368
+ extra_message = if conflict.requirement_trees.first.size > 1
369
+ ", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
370
+ else
371
+ ""
366
372
  end
367
- o << " "
368
373
 
369
- o << if metadata_requirement
370
- "is not available in #{relevant_source}"
374
+ if metadata_requirement
375
+ o << "#{SharedHelpers.pretty_dependency(conflict.requirement)}#{extra_message} is not available in #{relevant_source}"
371
376
  else
372
- "in #{relevant_source}.\n"
377
+ o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
373
378
  end
374
379
  end
375
380
  end,
@@ -138,6 +138,8 @@ module Gem
138
138
  class Requirement
139
139
  module OrderIndependentComparison
140
140
  def ==(other)
141
+ return unless Gem::Requirement === other
142
+
141
143
  if _requirements_sorted? && other._requirements_sorted?
142
144
  super
143
145
  else
@@ -12,25 +12,21 @@ module Bundler
12
12
  EXT_LOCK = Monitor.new
13
13
  end
14
14
 
15
- def self.version
16
- @version ||= Gem::Version.new(Gem::VERSION)
17
- end
18
-
19
- def self.provides?(req_str)
20
- Gem::Requirement.new(req_str).satisfied_by?(version)
21
- end
22
-
23
15
  def initialize
24
16
  @replaced_methods = {}
25
17
  backport_ext_builder_monitor
26
18
  end
27
19
 
28
20
  def version
29
- self.class.version
21
+ @version ||= Gem.rubygems_version
30
22
  end
31
23
 
32
24
  def provides?(req_str)
33
- self.class.provides?(req_str)
25
+ Gem::Requirement.new(req_str).satisfied_by?(version)
26
+ end
27
+
28
+ def supports_bundler_trampolining?
29
+ provides?(">= 3.3.0.a")
34
30
  end
35
31
 
36
32
  def build_args
@@ -115,7 +111,7 @@ module Bundler
115
111
  Bundler.ui.error "#{e.class}: #{e.message}"
116
112
  Bundler.ui.trace e
117
113
  raise
118
- rescue YamlLibrarySyntaxError => e
114
+ rescue ::Psych::SyntaxError => e
119
115
  raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
120
116
  "usually located in ~/.gemrc, contains invalid YAML syntax.")
121
117
  end
@@ -142,19 +138,6 @@ module Bundler
142
138
  end
143
139
  end
144
140
 
145
- def sources=(val)
146
- # Gem.configuration creates a new Gem::ConfigFile, which by default will read ~/.gemrc
147
- # If that file exists, its settings (including sources) will overwrite the values we
148
- # are about to set here. In order to avoid that, we force memoizing the config file now.
149
- configuration
150
-
151
- Gem.sources = val
152
- end
153
-
154
- def sources
155
- Gem.sources
156
- end
157
-
158
141
  def gem_dir
159
142
  Gem.dir
160
143
  end
@@ -232,18 +215,6 @@ module Bundler
232
215
  EXT_LOCK
233
216
  end
234
217
 
235
- def with_build_args(args)
236
- ext_lock.synchronize do
237
- old_args = build_args
238
- begin
239
- self.build_args = args
240
- yield
241
- ensure
242
- self.build_args = old_args
243
- end
244
- end
245
- end
246
-
247
218
  def spec_from_gem(path, policy = nil)
248
219
  require "rubygems/security"
249
220
  require_relative "psyched_yaml"
@@ -571,10 +542,6 @@ module Bundler
571
542
  Gem::REPOSITORY_SUBDIRECTORIES
572
543
  end
573
544
 
574
- def install_with_build_args(args)
575
- yield
576
- end
577
-
578
545
  def path_separator
579
546
  Gem.path_separator
580
547
  end
@@ -604,6 +571,10 @@ module Bundler
604
571
  end
605
572
  end
606
573
 
574
+ def find_bundler(version)
575
+ find_name("bundler").find {|s| s.version.to_s == version }
576
+ end
577
+
607
578
  def find_name(name)
608
579
  Gem::Specification.stubs_for(name).map(&:to_spec)
609
580
  end
@@ -617,14 +588,6 @@ module Bundler
617
588
  Gem::Specification.send(:default_stubs, "*.gemspec")
618
589
  end
619
590
  end
620
-
621
- def use_gemdeps(gemfile)
622
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
623
- require_relative "gemdeps"
624
- runtime = Bundler.setup
625
- activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
626
- [Gemdeps.new(runtime), activated_spec_names]
627
- end
628
591
  end
629
592
 
630
593
  def self.rubygems