bundler 2.2.24 → 2.3.7

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +246 -1
  3. data/README.md +1 -1
  4. data/exe/bundle +7 -8
  5. data/lib/bundler/.document +1 -0
  6. data/lib/bundler/build_metadata.rb +2 -2
  7. data/lib/bundler/cli/cache.rb +1 -1
  8. data/lib/bundler/cli/config.rb +10 -1
  9. data/lib/bundler/cli/doctor.rb +13 -4
  10. data/lib/bundler/cli/exec.rb +1 -6
  11. data/lib/bundler/cli/gem.rb +101 -11
  12. data/lib/bundler/cli/info.rb +26 -5
  13. data/lib/bundler/cli/install.rb +12 -45
  14. data/lib/bundler/cli/issue.rb +4 -3
  15. data/lib/bundler/cli/list.rb +7 -1
  16. data/lib/bundler/cli/open.rb +1 -2
  17. data/lib/bundler/cli/platform.rb +1 -1
  18. data/lib/bundler/cli/remove.rb +1 -2
  19. data/lib/bundler/cli/update.rb +9 -5
  20. data/lib/bundler/cli.rb +24 -20
  21. data/lib/bundler/compact_index_client/cache.rb +0 -9
  22. data/lib/bundler/compact_index_client/updater.rb +0 -5
  23. data/lib/bundler/compact_index_client.rb +2 -8
  24. data/lib/bundler/definition.rb +97 -161
  25. data/lib/bundler/dependency.rb +5 -7
  26. data/lib/bundler/digest.rb +71 -0
  27. data/lib/bundler/dsl.rb +32 -31
  28. data/lib/bundler/endpoint_specification.rb +21 -11
  29. data/lib/bundler/env.rb +1 -1
  30. data/lib/bundler/environment_preserver.rb +4 -1
  31. data/lib/bundler/errors.rb +19 -3
  32. data/lib/bundler/fetcher/compact_index.rb +9 -14
  33. data/lib/bundler/fetcher/index.rb +0 -26
  34. data/lib/bundler/fetcher.rb +13 -20
  35. data/lib/bundler/friendly_errors.rb +5 -30
  36. data/lib/bundler/gem_helper.rb +7 -18
  37. data/lib/bundler/injector.rb +10 -1
  38. data/lib/bundler/installer/gem_installer.rb +4 -22
  39. data/lib/bundler/installer/standalone.rb +13 -8
  40. data/lib/bundler/installer.rb +1 -5
  41. data/lib/bundler/lazy_specification.rb +19 -3
  42. data/lib/bundler/lockfile_generator.rb +1 -1
  43. data/lib/bundler/lockfile_parser.rb +11 -12
  44. data/lib/bundler/man/bundle-add.1 +10 -2
  45. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  46. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  47. data/lib/bundler/man/bundle-cache.1 +1 -1
  48. data/lib/bundler/man/bundle-check.1 +1 -1
  49. data/lib/bundler/man/bundle-clean.1 +1 -1
  50. data/lib/bundler/man/bundle-config.1 +5 -5
  51. data/lib/bundler/man/bundle-config.1.ronn +5 -5
  52. data/lib/bundler/man/bundle-doctor.1 +1 -1
  53. data/lib/bundler/man/bundle-exec.1 +1 -1
  54. data/lib/bundler/man/bundle-gem.1 +14 -1
  55. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  56. data/lib/bundler/man/bundle-info.1 +1 -1
  57. data/lib/bundler/man/bundle-init.1 +1 -1
  58. data/lib/bundler/man/bundle-inject.1 +1 -1
  59. data/lib/bundler/man/bundle-install.1 +2 -2
  60. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  61. data/lib/bundler/man/bundle-list.1 +1 -1
  62. data/lib/bundler/man/bundle-lock.1 +1 -1
  63. data/lib/bundler/man/bundle-open.1 +1 -1
  64. data/lib/bundler/man/bundle-outdated.1 +1 -1
  65. data/lib/bundler/man/bundle-platform.1 +1 -1
  66. data/lib/bundler/man/bundle-pristine.1 +1 -1
  67. data/lib/bundler/man/bundle-remove.1 +1 -1
  68. data/lib/bundler/man/bundle-show.1 +1 -1
  69. data/lib/bundler/man/bundle-update.1 +2 -2
  70. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  71. data/lib/bundler/man/bundle-viz.1 +1 -1
  72. data/lib/bundler/man/bundle.1 +1 -1
  73. data/lib/bundler/man/gemfile.5 +28 -2
  74. data/lib/bundler/man/gemfile.5.ronn +9 -1
  75. data/lib/bundler/plugin/api/source.rb +1 -0
  76. data/lib/bundler/plugin/installer.rb +3 -1
  77. data/lib/bundler/plugin.rb +23 -6
  78. data/lib/bundler/process_lock.rb +1 -1
  79. data/lib/bundler/remote_specification.rb +7 -0
  80. data/lib/bundler/resolver/spec_group.rb +1 -1
  81. data/lib/bundler/resolver.rb +38 -47
  82. data/lib/bundler/ruby_version.rb +1 -1
  83. data/lib/bundler/rubygems_ext.rb +19 -10
  84. data/lib/bundler/rubygems_gem_installer.rb +25 -5
  85. data/lib/bundler/rubygems_integration.rb +40 -70
  86. data/lib/bundler/runtime.rb +17 -8
  87. data/lib/bundler/self_manager.rb +168 -0
  88. data/lib/bundler/settings.rb +15 -2
  89. data/lib/bundler/setup.rb +2 -2
  90. data/lib/bundler/shared_helpers.rb +4 -19
  91. data/lib/bundler/source/git/git_proxy.rb +8 -6
  92. data/lib/bundler/source/git.rb +22 -4
  93. data/lib/bundler/source/metadata.rb +1 -1
  94. data/lib/bundler/source/rubygems.rb +70 -81
  95. data/lib/bundler/source/rubygems_aggregate.rb +4 -0
  96. data/lib/bundler/source.rb +4 -0
  97. data/lib/bundler/source_list.rb +22 -31
  98. data/lib/bundler/spec_set.rb +14 -36
  99. data/lib/bundler/templates/Executable.bundler +7 -7
  100. data/lib/bundler/templates/Gemfile +0 -2
  101. data/lib/bundler/templates/gems.rb +0 -3
  102. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  103. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  104. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -2
  105. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -15
  106. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  107. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  108. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  109. data/lib/bundler/ui/shell.rb +1 -1
  110. data/lib/bundler/vendor/.document +1 -0
  111. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  112. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  113. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  114. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  115. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  116. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  117. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  118. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  119. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  120. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  121. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  122. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  123. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  124. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  125. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  126. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  127. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  128. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  129. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  130. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  131. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  132. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  133. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  134. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  135. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  136. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  137. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  138. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  139. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  140. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  141. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  142. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  143. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  144. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  145. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  146. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  147. data/lib/bundler/vendored_tsort.rb +4 -0
  148. data/lib/bundler/version.rb +1 -1
  149. data/lib/bundler/worker.rb +19 -4
  150. data/lib/bundler.rb +23 -26
  151. metadata +25 -10
  152. data/lib/bundler/gemdeps.rb +0 -29
  153. data/lib/bundler/psyched_yaml.rb +0 -22
  154. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -18,6 +18,7 @@ module Bundler
18
18
 
19
19
  if spec
20
20
  return print_gem_path(spec) if @options[:path]
21
+ return print_gem_version(spec) if @options[:version]
21
22
  print_gem_info(spec)
22
23
  end
23
24
  end
@@ -39,13 +40,18 @@ module Bundler
39
40
  raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(gem_name, Bundler.definition.dependencies)
40
41
  end
41
42
 
43
+ def print_gem_version(spec)
44
+ Bundler.ui.info spec.version.to_s
45
+ end
46
+
42
47
  def print_gem_path(spec)
43
- if spec.name == "bundler"
48
+ name = spec.name
49
+ if name == "bundler"
44
50
  path = File.expand_path("../../../..", __FILE__)
45
51
  else
46
52
  path = spec.full_gem_path
47
- unless File.directory?(path)
48
- return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
53
+ if spec.deleted_gem?
54
+ return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
49
55
  end
50
56
  end
51
57
 
@@ -54,8 +60,9 @@ module Bundler
54
60
 
55
61
  def print_gem_info(spec)
56
62
  metadata = spec.metadata
63
+ name = spec.name
57
64
  gem_info = String.new
58
- gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
65
+ gem_info << " * #{name} (#{spec.version}#{spec.git_version})\n"
59
66
  gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
60
67
  gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
61
68
  gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
@@ -66,8 +73,22 @@ module Bundler
66
73
  gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
67
74
  gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
68
75
  gem_info << "\tPath: #{spec.full_gem_path}\n"
69
- gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
76
+ gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem?
77
+ gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any?
78
+
79
+ if name != "bundler" && spec.deleted_gem?
80
+ return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
81
+ end
82
+
70
83
  Bundler.ui.info gem_info
71
84
  end
85
+
86
+ def gem_dependencies
87
+ @gem_dependencies ||= Bundler.definition.specs.map do |spec|
88
+ dependency = spec.dependencies.find {|dep| dep.name == gem_name }
89
+ next unless dependency
90
+ "#{spec.name} (#{spec.version}) depends on #{gem_name} (#{dependency.requirements_list.join(", ")})"
91
+ end.compact.sort
92
+ end
72
93
  end
73
94
  end
@@ -8,10 +8,12 @@ module Bundler
8
8
  end
9
9
 
10
10
  def run
11
- Bundler.ui.level = "error" if options[:quiet]
11
+ Bundler.ui.level = "warn" if options[:quiet]
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
@@ -60,7 +62,7 @@ module Bundler
60
62
  installer = Installer.install(Bundler.root, definition, options)
61
63
 
62
64
  Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
63
- Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
65
+ Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
64
66
  end
65
67
 
66
68
  Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
@@ -83,22 +85,9 @@ module Bundler
83
85
  end
84
86
 
85
87
  Bundler::CLI::Common.output_fund_metadata_summary
86
- rescue GemNotFound, VersionConflict => e
87
- if options[:local] && Bundler.app_cache.exist?
88
- Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
89
- end
90
-
91
- unless Bundler.definition.has_rubygems_remotes?
92
- Bundler.ui.warn <<-WARN, :wrap => true
93
- Your Gemfile has no gem server sources. If you need gems that are \
94
- not already on your machine, add a line like this to your Gemfile:
95
- source 'https://rubygems.org'
96
- WARN
97
- end
98
- raise e
99
- rescue Gem::InvalidSpecificationException => e
88
+ rescue Gem::InvalidSpecificationException
100
89
  Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
101
- raise e
90
+ raise
102
91
  end
103
92
 
104
93
  private
@@ -146,39 +135,17 @@ module Bundler
146
135
  end
147
136
 
148
137
  def normalize_groups
149
- options[:with] &&= options[:with].join(":").tr(" ", ":").split(":")
150
- options[:without] &&= options[:without].join(":").tr(" ", ":").split(":")
151
-
152
138
  check_for_group_conflicts_in_cli_options
153
139
 
154
- Bundler.settings.set_command_option :with, nil if options[:with] == []
155
- Bundler.settings.set_command_option :without, nil if options[:without] == []
156
-
157
- with = options.fetch(:with, [])
158
- with |= Bundler.settings[:with].map(&:to_s)
159
- with -= options[:without] if options[:without]
160
-
161
- without = options.fetch(:without, [])
162
- without |= Bundler.settings[:without].map(&:to_s)
163
- without -= options[:with] if options[:with]
164
-
165
- options[:with] = with
166
- options[:without] = without
167
-
168
- unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
169
- # need to nil them out first to get around validation for backwards compatibility
170
- Bundler.settings.set_command_option :without, nil
171
- Bundler.settings.set_command_option :with, nil
172
- Bundler.settings.set_command_option :without, options[:without] - options[:with]
173
- Bundler.settings.set_command_option :with, options[:with]
174
- end
140
+ # need to nil them out first to get around validation for backwards compatibility
141
+ Bundler.settings.set_command_option :without, nil
142
+ Bundler.settings.set_command_option :with, nil
143
+ Bundler.settings.set_command_option :without, options[:without]
144
+ Bundler.settings.set_command_option :with, options[:with]
175
145
  end
176
146
 
177
147
  def normalize_settings
178
148
  Bundler.settings.set_command_option :path, nil if options[:system]
179
- Bundler.settings.temporary(:path_relative_to_cwd => false) do
180
- Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
181
- end
182
149
  Bundler.settings.set_command_option_if_given :path, options[:path]
183
150
  Bundler.settings.temporary(:path_relative_to_cwd => false) do
184
151
  Bundler.settings.set_command_option :path, "bundle" if options["standalone"] && Bundler.settings[:path].nil?
@@ -198,7 +165,7 @@ module Bundler
198
165
 
199
166
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
200
167
 
201
- normalize_groups
168
+ normalize_groups if options[:without] || options[:with]
202
169
 
203
170
  options[:force] = options[:redownload]
204
171
  end
@@ -20,9 +20,10 @@ module Bundler
20
20
 
21
21
  Hopefully the troubleshooting steps above resolved your problem! If things
22
22
  still aren't working the way you expect them to, please let us know so
23
- that we can diagnose and help fix the problem you're having. Please
24
- view the Filing Issues guide for more information:
25
- https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md
23
+ that we can diagnose and help fix the problem you're having, by filling
24
+ in the new issue form located at
25
+ https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
26
+ and copy and pasting the information below.
26
27
 
27
28
  EOS
28
29
 
@@ -16,7 +16,13 @@ module Bundler
16
16
  specs = if @only_group.any? || @without_group.any?
17
17
  filtered_specs_by_groups
18
18
  else
19
- Bundler.load.specs
19
+ begin
20
+ Bundler.load.specs
21
+ rescue GemNotFound => e
22
+ Bundler.ui.error e.message
23
+ Bundler.ui.warn "Install missing gems with `bundle install`."
24
+ exit 1
25
+ end
20
26
  end.reject {|s| s.name == "bundler" }.sort_by(&:name)
21
27
 
22
28
  return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shellwords"
4
-
5
3
  module Bundler
6
4
  class CLI::Open
7
5
  attr_reader :options, :name
@@ -19,6 +17,7 @@ module Bundler
19
17
  else
20
18
  path = spec.full_gem_path
21
19
  Dir.chdir(path) do
20
+ require "shellwords"
22
21
  command = Shellwords.split(editor) + [path]
23
22
  Bundler.with_original_env do
24
23
  system(*command)
@@ -23,7 +23,7 @@ module Bundler
23
23
  output << "No ruby version specified"
24
24
  end
25
25
  else
26
- output << "Your platform is: #{RUBY_PLATFORM}"
26
+ output << "Your platform is: #{Gem::Platform.local}"
27
27
  output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
28
28
 
29
29
  if ruby_version
@@ -11,8 +11,7 @@ module Bundler
11
11
  raise InvalidOption, "Please specify gems to remove." if @gems.empty?
12
12
 
13
13
  Injector.remove(@gems, {})
14
-
15
- Installer.install(Bundler.root, Bundler.definition) if @options["install"]
14
+ Installer.install(Bundler.root, Bundler.definition)
16
15
  end
17
16
  end
18
17
  end
@@ -9,14 +9,18 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
- Bundler.ui.level = "error" if options[:quiet]
12
+ Bundler.ui.level = "warn" if options[:quiet]
13
+
14
+ update_bundler = options[:bundler]
15
+
16
+ Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
13
17
 
14
18
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
15
19
 
16
20
  sources = Array(options[:source])
17
21
  groups = Array(options[:group]).map(&:to_sym)
18
22
 
19
- full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
23
+ full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
20
24
 
21
25
  if full_update && !options[:all]
22
26
  if Bundler.feature_flag.update_requires_all_flag?
@@ -49,7 +53,7 @@ module Bundler
49
53
 
50
54
  Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
51
55
  :conservative => conservative,
52
- :bundler => options[:bundler])
56
+ :bundler => update_bundler)
53
57
  end
54
58
 
55
59
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -66,7 +70,7 @@ module Bundler
66
70
 
67
71
  if locked_gems = Bundler.definition.locked_gems
68
72
  previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
69
- h[s.name] = { :spec => s, :version => s.version, :source => s.source.to_s }
73
+ h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
70
74
  h
71
75
  end
72
76
  end
@@ -95,7 +99,7 @@ module Bundler
95
99
  end
96
100
 
97
101
  locked_source = locked_info[:source]
98
- new_source = new_spec.source.to_s
102
+ new_source = new_spec.source.identifier
99
103
  next if locked_source != new_source
100
104
 
101
105
  new_version = new_spec.version
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
@@ -73,14 +75,6 @@ module Bundler
73
75
  Bundler.ui = UI::Shell.new(options)
74
76
  Bundler.ui.level = "debug" if options["verbose"]
75
77
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
76
-
77
- if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
78
- Bundler.ui.warn(
79
- "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
80
- "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
81
- "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
82
- )
83
- end
84
78
  end
85
79
 
86
80
  check_unknown_options!(:except => [:config, :exec])
@@ -192,6 +186,7 @@ module Bundler
192
186
  method_option "install", :type => :boolean, :banner =>
193
187
  "Runs 'bundle install' after removing the gems from the Gemfile"
194
188
  def remove(*gems)
189
+ SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
195
190
  require_relative "cli/remove"
196
191
  Remove.new(gems, options).run
197
192
  end
@@ -338,6 +333,7 @@ module Bundler
338
333
 
339
334
  desc "info GEM [OPTIONS]", "Show information for the given gem"
340
335
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
336
+ method_option "version", :type => :boolean, :banner => "Print gem version"
341
337
  def info(gem_name)
342
338
  require_relative "cli/info"
343
339
  Info.new(options, gem_name).run
@@ -373,8 +369,11 @@ module Bundler
373
369
  method_option "version", :aliases => "-v", :type => :string
374
370
  method_option "group", :aliases => "-g", :type => :string
375
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."
376
373
  method_option "git", :type => :string
374
+ method_option "github", :type => :string
377
375
  method_option "branch", :type => :string
376
+ method_option "ref", :type => :string
378
377
  method_option "skip-install", :type => :boolean, :banner =>
379
378
  "Adds gem to the Gemfile but does not install it"
380
379
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
@@ -456,6 +455,12 @@ module Bundler
456
455
  "do in future versions. Instead please use `bundle config set cache_all true`, " \
457
456
  "and stop using this flag" if ARGV.include?("--all")
458
457
 
458
+ SharedHelpers.major_deprecation 2,
459
+ "The `--path` flag is deprecated because its semantics are unclear. " \
460
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
461
+ "and `bundle config path` to configure the path where your gems are installed, " \
462
+ "and stop using this flag" if ARGV.include?("--path")
463
+
459
464
  require_relative "cli/cache"
460
465
  Cache.new(options).run
461
466
  end
@@ -463,7 +468,7 @@ module Bundler
463
468
  map aliases_for("cache")
464
469
 
465
470
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
466
- method_option :keep_file_descriptors, :type => :boolean, :default => false
471
+ method_option :keep_file_descriptors, :type => :boolean, :default => true
467
472
  method_option :gemfile, :type => :string, :required => false
468
473
  long_desc <<-D
469
474
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -471,6 +476,10 @@ module Bundler
471
476
  into the system wide RubyGems repository.
472
477
  D
473
478
  def exec(*args)
479
+ if ARGV.include?("--no-keep-file-descriptors")
480
+ SharedHelpers.major_deprecation(2, "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to")
481
+ end
482
+
474
483
  require_relative "cli/exec"
475
484
  Exec.new(options, args).run
476
485
  end
@@ -549,7 +558,7 @@ module Bundler
549
558
  method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
550
559
  method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
551
560
  def viz
552
- SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
561
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
553
562
  require_relative "cli/viz"
554
563
  Viz.new(options.dup).run
555
564
  end
@@ -572,6 +581,8 @@ module Bundler
572
581
  :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
573
582
  method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
574
583
  :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
584
+ method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
585
+ :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
575
586
  method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
576
587
 
577
588
  def gem(name)
@@ -798,17 +809,10 @@ module Bundler
798
809
 
799
810
  current = Gem::Version.new(VERSION)
800
811
  return if current >= latest
801
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
802
-
803
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
804
- if latest_installed && latest_installed > current
805
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
806
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
807
- else
808
- suggestion = installation
809
- end
810
812
 
811
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
813
+ Bundler.ui.warn \
814
+ "The latest bundler is #{latest}, but you are currently running #{current}.\n" \
815
+ "To update to the most recent version, run `bundle update --bundler`"
812
816
  rescue RuntimeError
813
817
  nil
814
818
  end
@@ -76,15 +76,6 @@ module Bundler
76
76
  end
77
77
  end
78
78
 
79
- def specific_dependency(name, version, platform)
80
- pattern = [version, platform].compact.join("-")
81
- return nil if pattern.empty?
82
-
83
- gem_lines = info_path(name).read
84
- gem_line = gem_lines[/^#{Regexp.escape(pattern)}\b.*/, 0]
85
- gem_line ? parse_gem(gem_line) : nil
86
- end
87
-
88
79
  private
89
80
 
90
81
  def lines(path)
@@ -76,11 +76,6 @@ module Bundler
76
76
 
77
77
  update(local_path, remote_path, :retrying)
78
78
  end
79
- rescue Errno::EACCES
80
- raise Bundler::PermissionError,
81
- "Bundler does not have write access to create a temp directory " \
82
- "within #{Dir.tmpdir}. Bundler must have write access to your " \
83
- "systems temp directory to function properly. "
84
79
  rescue Zlib::GzipFile::Error
85
80
  raise Bundler::HTTPError
86
81
  end
@@ -5,7 +5,7 @@ require "set"
5
5
 
6
6
  module Bundler
7
7
  class CompactIndexClient
8
- DEBUG_MUTEX = Mutex.new
8
+ DEBUG_MUTEX = Thread::Mutex.new
9
9
  def self.debug
10
10
  return unless ENV["DEBUG_COMPACT_INDEX"]
11
11
  DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
@@ -25,7 +25,7 @@ module Bundler
25
25
  @endpoints = Set.new
26
26
  @info_checksums_by_name = {}
27
27
  @parsed_checksums = false
28
- @mutex = Mutex.new
28
+ @mutex = Thread::Mutex.new
29
29
  end
30
30
 
31
31
  def execution_mode=(block)
@@ -73,12 +73,6 @@ module Bundler
73
73
  end.flatten(1)
74
74
  end
75
75
 
76
- def spec(name, version, platform = nil)
77
- Bundler::CompactIndexClient.debug { "spec(name = #{name}, version = #{version}, platform = #{platform})" }
78
- update_info(name)
79
- @cache.specific_dependency(name, version, platform)
80
- end
81
-
82
76
  def update_and_parse_checksums!
83
77
  Bundler::CompactIndexClient.debug { "update_and_parse_checksums!" }
84
78
  return @info_checksums_by_name if @parsed_checksums