bundler 2.2.34 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/exe/bundle +7 -8
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/gem.rb +1 -1
  6. data/lib/bundler/cli/install.rb +2 -0
  7. data/lib/bundler/cli.rb +5 -0
  8. data/lib/bundler/definition.rb +14 -2
  9. data/lib/bundler/dependency.rb +5 -7
  10. data/lib/bundler/dsl.rb +0 -27
  11. data/lib/bundler/endpoint_specification.rb +0 -8
  12. data/lib/bundler/fetcher/compact_index.rb +9 -4
  13. data/lib/bundler/fetcher.rb +2 -5
  14. data/lib/bundler/injector.rb +10 -1
  15. data/lib/bundler/installer/gem_installer.rb +1 -6
  16. data/lib/bundler/installer.rb +1 -4
  17. data/lib/bundler/lockfile_parser.rb +10 -13
  18. data/lib/bundler/man/bundle-add.1 +9 -1
  19. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  20. data/lib/bundler/man/bundle-config.1 +2 -2
  21. data/lib/bundler/man/bundle-config.1.ronn +3 -3
  22. data/lib/bundler/man/bundle-install.1 +1 -1
  23. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  24. data/lib/bundler/man/bundle-update.1 +1 -1
  25. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  26. data/lib/bundler/man/gemfile.5 +1 -1
  27. data/lib/bundler/man/gemfile.5.ronn +1 -1
  28. data/lib/bundler/plugin/installer.rb +1 -1
  29. data/lib/bundler/process_lock.rb +1 -1
  30. data/lib/bundler/psyched_yaml.rb +1 -13
  31. data/lib/bundler/resolver.rb +34 -29
  32. data/lib/bundler/rubygems_ext.rb +2 -0
  33. data/lib/bundler/rubygems_integration.rb +11 -48
  34. data/lib/bundler/self_manager.rb +73 -0
  35. data/lib/bundler/shared_helpers.rb +2 -9
  36. data/lib/bundler/source/metadata.rb +1 -1
  37. data/lib/bundler/templates/Executable.bundler +1 -1
  38. data/lib/bundler/templates/Gemfile +0 -2
  39. data/lib/bundler/templates/gems.rb +0 -3
  40. data/lib/bundler/templates/newgem/Rakefile.tt +10 -1
  41. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  42. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  43. data/lib/bundler/ui/shell.rb +1 -1
  44. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  45. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +2 -1
  46. data/lib/bundler/vendor/thor/lib/thor/actions.rb +2 -6
  47. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -6
  48. data/lib/bundler/vendor/thor/lib/thor/error.rb +4 -9
  49. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -19
  50. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +4 -22
  51. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  52. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  53. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  54. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  55. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  56. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  57. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  58. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  59. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  60. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  61. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  62. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  63. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  64. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  65. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  66. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  67. data/lib/bundler/version.rb +1 -1
  68. data/lib/bundler.rb +9 -3
  69. metadata +7 -5
  70. data/lib/bundler/gemdeps.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f86325ff87c89b7223a6f49a0b4f89cf01fed7e897e96f164c24da929bb0e06
4
- data.tar.gz: f55070b88530e57e86001375052cb4220d24382cd7078797312311952c00bde9
3
+ metadata.gz: da1ab3c83c3a4866cc0407d08af4381e5cecfc146e1ca50fa00d078601ef7f64
4
+ data.tar.gz: db6130a6580eec314b8b8c33e3b648ac2022293734dc7513c3de8ab0b508cf2c
5
5
  SHA512:
6
- metadata.gz: 5f15b70e3daac175144a67a5ee44a0017da198742216c2959756a31b3bd69250df726331f611739e5bc5601d531f70242a12f948da96d8df89cb0e6312b84b9b
7
- data.tar.gz: 1149616abac6c71289d861a2c64f765b8814ada5d5ae06c822be4893da7e28f133d40b2e3dfea3e919bf5fc7236031dafd31504b3616851caf2315f12166c2e7
6
+ metadata.gz: 7ba12ac5e1afd3073be1a7bc8e5d95e369b465c4025a69db0d05ab87bc673ccb70d4f031bc17b1390b0dbbb3833fdebca0691bce3f8b3c8730ec83b9df407d88
7
+ data.tar.gz: 91dc119191fdbe40b5211e02a75349246e9f952d520cd58f3997b0e710a2caae0f17c96aaedf9ad25526ce44d38c9d67df9a6e5f7cc0e186b971033b412ad316
data/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # 2.3.0 (December 21, 2021)
2
+
3
+ ## Features:
4
+
5
+ - Change `bundle install` with a lockfile to respect the `BUNDLED WITH` bundler version [#4076](https://github.com/rubygems/rubygems/pull/4076)
6
+
7
+ ## Enhancements:
8
+
9
+ - Print warning when running Bundler on potentially problematic RubyGems & Ruby combinations [#5177](https://github.com/rubygems/rubygems/pull/5177)
10
+ - Error tracing should be printed to stderr [#5179](https://github.com/rubygems/rubygems/pull/5179)
11
+ - Add `github` and `ref` options to `bundle add` [#5159](https://github.com/rubygems/rubygems/pull/5159)
12
+ - Add require parameter to `bundle add` [#5021](https://github.com/rubygems/rubygems/pull/5021)
13
+ - Enable parallel installation on Windows by default [#4822](https://github.com/rubygems/rubygems/pull/4822)
14
+ - More logging when compact index is not used and we fallback to other APIs [#4546](https://github.com/rubygems/rubygems/pull/4546)
15
+ - `bundle gem` generated MiniTest file and class now start with 'test' [#3893](https://github.com/rubygems/rubygems/pull/3893)
16
+ - Add `Bundler::Definition.no_lock` accessor for skipping lock file creation/update [#3401](https://github.com/rubygems/rubygems/pull/3401)
17
+
18
+ ## Bug fixes:
19
+
20
+ - Fix crash when when no platform specific matches exist and show a proper error [#5168](https://github.com/rubygems/rubygems/pull/5168)
21
+ - Ignore dependencies not actually locked from frozen check [#5152](https://github.com/rubygems/rubygems/pull/5152)
22
+ - Fix `bundle cache --all-platforms` on Windows [#4552](https://github.com/rubygems/rubygems/pull/4552)
23
+
24
+ ## Documentation:
25
+
26
+ - Fix gemspec template typo [#4545](https://github.com/rubygems/rubygems/pull/4545)
27
+
1
28
  # 2.2.33 (December 7, 2021)
2
29
 
3
30
  ## Security fixes:
data/exe/bundle CHANGED
@@ -18,14 +18,13 @@ end
18
18
  # Workaround for non-activated bundler spec due to missing https://github.com/rubygems/rubygems/commit/4e306d7bcdee924b8d80ca9db6125aa59ee4e5a3
19
19
  gem "bundler", Bundler::VERSION if Gem.rubygems_version < Gem::Version.new("2.6.2")
20
20
 
21
- # Check if an older version of bundler is installed
22
- $LOAD_PATH.each do |path|
23
- next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
24
- err = String.new
25
- err << "Looks like you have a version of bundler that's older than 0.9.\n"
26
- err << "Please remove your old versions.\n"
27
- err << "An easy way to do this is by running `gem cleanup bundler`."
28
- abort(err)
21
+ if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.6.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"]
22
+ Bundler.ui.warn \
23
+ "Your RubyGems version (#{Gem::VERSION})) has a bug that prevents " \
24
+ "`required_ruby_version` from working for Bundler. Any scripts that use " \
25
+ "`gem install bundler` will break as soon as Bundler drops support for " \
26
+ "your Ruby version. Please upgrade RubyGems to avoid future breakage " \
27
+ "and silence this warning by running `gem update --system 3.2.3`"
29
28
  end
30
29
 
31
30
  if File.exist?(base_path)
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2023-02-06".freeze
8
- @git_commit_sha = "78d3be232c".freeze
7
+ @built_at = "2021-12-21".freeze
8
+ @git_commit_sha = "e7167b9a42".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -106,7 +106,7 @@ module Bundler
106
106
  when "minitest"
107
107
  templates.merge!(
108
108
  "test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
109
- "test/minitest/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
109
+ "test/minitest/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
110
110
  )
111
111
  config[:test_task] = :test
112
112
  when "test-unit"
@@ -12,6 +12,8 @@ module Bundler
12
12
 
13
13
  warn_if_root
14
14
 
15
+ Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
16
+
15
17
  Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
16
18
 
17
19
  # Disable color in deployment mode
data/lib/bundler/cli.rb CHANGED
@@ -61,6 +61,8 @@ module Bundler
61
61
  Bundler.reset_settings_and_root!
62
62
  end
63
63
 
64
+ Bundler.self_manager.restart_with_locked_bundler_if_needed
65
+
64
66
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
65
67
 
66
68
  current_cmd = args.last[:current_command].name
@@ -367,8 +369,11 @@ module Bundler
367
369
  method_option "version", :aliases => "-v", :type => :string
368
370
  method_option "group", :aliases => "-g", :type => :string
369
371
  method_option "source", :aliases => "-s", :type => :string
372
+ method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
370
373
  method_option "git", :type => :string
374
+ method_option "github", :type => :string
371
375
  method_option "branch", :type => :string
376
+ method_option "ref", :type => :string
372
377
  method_option "skip-install", :type => :boolean, :banner =>
373
378
  "Adds gem to the Gemfile but does not install it"
374
379
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
@@ -6,6 +6,11 @@ module Bundler
6
6
  class Definition
7
7
  include GemHelpers
8
8
 
9
+ class << self
10
+ # Do not create or modify a lockfile (Makes #lock a noop)
11
+ attr_accessor :no_lock
12
+ end
13
+
9
14
  attr_reader(
10
15
  :dependencies,
11
16
  :locked_deps,
@@ -275,6 +280,8 @@ module Bundler
275
280
  end
276
281
 
277
282
  def lock(file, preserve_unknown_sections = false)
283
+ return if Definition.no_lock
284
+
278
285
  contents = to_lock
279
286
 
280
287
  # Convert to \r\n if the existing lock has them
@@ -287,7 +294,7 @@ module Bundler
287
294
 
288
295
  if updating_major = locked_major < current_major
289
296
  Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
290
- "after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}."
297
+ "after which you will be unable to return to Bundler #{locked_major}."
291
298
  end
292
299
  end
293
300
 
@@ -372,7 +379,12 @@ module Bundler
372
379
 
373
380
  both_sources = Hash.new {|h, k| h[k] = [] }
374
381
  @dependencies.each {|d| both_sources[d.name][0] = d }
375
- locked_dependencies.each {|d| both_sources[d.name][1] = d }
382
+
383
+ locked_dependencies.each do |d|
384
+ next if !Bundler.feature_flag.bundler_3_mode? && @locked_specs[d.name].empty?
385
+
386
+ both_sources[d.name][1] = d
387
+ end
376
388
 
377
389
  both_sources.each do |name, (dep, lock_dep)|
378
390
  next if dep.nil? || lock_dep.nil?
@@ -7,7 +7,7 @@ require_relative "rubygems_ext"
7
7
  module Bundler
8
8
  class Dependency < Gem::Dependency
9
9
  attr_reader :autorequire
10
- attr_reader :groups, :platforms, :gemfile, :git, :branch
10
+ attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref
11
11
 
12
12
  PLATFORM_MAP = {
13
13
  :ruby => Gem::Platform::RUBY,
@@ -82,7 +82,9 @@ module Bundler
82
82
  @groups = Array(options["group"] || :default).map(&:to_sym)
83
83
  @source = options["source"]
84
84
  @git = options["git"]
85
+ @github = options["github"]
85
86
  @branch = options["branch"]
87
+ @ref = options["ref"]
86
88
  @platforms = Array(options["platforms"])
87
89
  @env = options["env"]
88
90
  @should_include = options.fetch("should_include", true)
@@ -96,15 +98,11 @@ module Bundler
96
98
  def gem_platforms(valid_platforms)
97
99
  return valid_platforms if @platforms.empty?
98
100
 
99
- valid_generic_platforms = valid_platforms.map {|p| [p, GemHelpers.generic(p)] }.to_h
100
- @gem_platforms ||= expanded_platforms.compact.uniq
101
-
102
- filtered_generic_platforms = valid_generic_platforms.values & @gem_platforms
103
- valid_generic_platforms.select {|_, v| filtered_generic_platforms.include?(v) }.keys
101
+ valid_platforms.select {|p| expanded_platforms.include?(GemHelpers.generic(p)) }
104
102
  end
105
103
 
106
104
  def expanded_platforms
107
- @platforms.map {|pl| PLATFORM_MAP[pl] }
105
+ @expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.uniq
108
106
  end
109
107
 
110
108
  def should_include?
data/lib/bundler/dsl.rb CHANGED
@@ -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