bundler 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +735 -574
  3. data/LICENSE.md +18 -19
  4. data/README.md +8 -7
  5. data/bundler.gemspec +5 -23
  6. data/exe/bundle +19 -3
  7. data/lib/bundler.rb +202 -87
  8. data/lib/bundler/build_metadata.rb +3 -3
  9. data/lib/bundler/capistrano.rb +5 -5
  10. data/lib/bundler/cli.rb +179 -143
  11. data/lib/bundler/cli/add.rb +28 -16
  12. data/lib/bundler/cli/cache.rb +25 -13
  13. data/lib/bundler/cli/common.rb +10 -11
  14. data/lib/bundler/cli/config.rb +161 -86
  15. data/lib/bundler/cli/console.rb +2 -2
  16. data/lib/bundler/cli/doctor.rb +4 -4
  17. data/lib/bundler/cli/exec.rb +15 -18
  18. data/lib/bundler/cli/gem.rb +5 -5
  19. data/lib/bundler/cli/info.rb +17 -5
  20. data/lib/bundler/cli/init.rb +1 -1
  21. data/lib/bundler/cli/install.rb +3 -3
  22. data/lib/bundler/cli/issue.rb +1 -1
  23. data/lib/bundler/cli/open.rb +10 -6
  24. data/lib/bundler/cli/outdated.rb +85 -81
  25. data/lib/bundler/cli/plugin.rb +9 -2
  26. data/lib/bundler/cli/pristine.rb +1 -1
  27. data/lib/bundler/cli/show.rb +1 -1
  28. data/lib/bundler/cli/update.rb +31 -11
  29. data/lib/bundler/compact_index_client.rb +25 -9
  30. data/lib/bundler/compact_index_client/updater.rb +2 -6
  31. data/lib/bundler/current_ruby.rb +8 -7
  32. data/lib/bundler/definition.rb +33 -26
  33. data/lib/bundler/dependency.rb +16 -4
  34. data/lib/bundler/deployment.rb +2 -2
  35. data/lib/bundler/dsl.rb +19 -43
  36. data/lib/bundler/env.rb +6 -5
  37. data/lib/bundler/environment_preserver.rb +0 -1
  38. data/lib/bundler/feature_flag.rb +1 -13
  39. data/lib/bundler/fetcher.rb +16 -13
  40. data/lib/bundler/fetcher/compact_index.rb +26 -12
  41. data/lib/bundler/fetcher/dependency.rb +1 -1
  42. data/lib/bundler/fetcher/downloader.rb +4 -1
  43. data/lib/bundler/fetcher/index.rb +5 -3
  44. data/lib/bundler/friendly_errors.rb +6 -7
  45. data/lib/bundler/gem_helper.rb +14 -14
  46. data/lib/bundler/gem_helpers.rb +2 -4
  47. data/lib/bundler/gem_tasks.rb +1 -1
  48. data/lib/bundler/gem_version_promoter.rb +3 -3
  49. data/lib/bundler/graph.rb +2 -2
  50. data/lib/bundler/injector.rb +3 -1
  51. data/lib/bundler/inline.rb +40 -30
  52. data/lib/bundler/installer.rb +7 -14
  53. data/lib/bundler/installer/gem_installer.rb +5 -1
  54. data/lib/bundler/installer/parallel_installer.rb +4 -4
  55. data/lib/bundler/installer/standalone.rb +1 -2
  56. data/lib/bundler/lazy_specification.rb +2 -3
  57. data/lib/bundler/lockfile_parser.rb +14 -21
  58. data/lib/bundler/match_platform.rb +1 -1
  59. data/lib/bundler/mirror.rb +3 -3
  60. data/lib/bundler/plugin.rb +29 -18
  61. data/lib/bundler/plugin/api.rb +1 -1
  62. data/lib/bundler/plugin/api/source.rb +4 -6
  63. data/lib/bundler/plugin/index.rb +10 -2
  64. data/lib/bundler/plugin/installer.rb +28 -15
  65. data/lib/bundler/psyched_yaml.rb +1 -1
  66. data/lib/bundler/remote_specification.rb +0 -2
  67. data/lib/bundler/resolver.rb +72 -24
  68. data/lib/bundler/resolver/spec_group.rb +3 -2
  69. data/lib/bundler/retry.rb +2 -2
  70. data/lib/bundler/ruby_version.rb +4 -19
  71. data/lib/bundler/rubygems_ext.rb +11 -66
  72. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  73. data/lib/bundler/rubygems_integration.rb +133 -410
  74. data/lib/bundler/runtime.rb +2 -9
  75. data/lib/bundler/settings.rb +22 -52
  76. data/lib/bundler/setup.rb +7 -13
  77. data/lib/bundler/shared_helpers.rb +46 -74
  78. data/lib/bundler/similarity_detector.rb +2 -2
  79. data/lib/bundler/source.rb +5 -5
  80. data/lib/bundler/source/git.rb +24 -17
  81. data/lib/bundler/source/git/git_proxy.rb +38 -41
  82. data/lib/bundler/source/metadata.rb +7 -2
  83. data/lib/bundler/source/path.rb +13 -8
  84. data/lib/bundler/source/rubygems.rb +14 -8
  85. data/lib/bundler/source/rubygems/remote.rb +2 -3
  86. data/lib/bundler/source_list.rb +9 -12
  87. data/lib/bundler/spec_set.rb +1 -6
  88. data/lib/bundler/stub_specification.rb +18 -30
  89. data/lib/bundler/templates/Executable.bundler +22 -13
  90. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
  91. data/lib/bundler/templates/newgem/Gemfile.tt +8 -0
  92. data/lib/bundler/templates/newgem/README.md.tt +4 -3
  93. data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -18
  94. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  95. data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  96. data/lib/bundler/ui.rb +3 -3
  97. data/lib/bundler/ui/rg_proxy.rb +1 -1
  98. data/lib/bundler/ui/shell.rb +4 -8
  99. data/lib/bundler/uri_credentials_filter.rb +7 -3
  100. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
  101. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
  102. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
  103. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  104. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +134 -111
  105. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
  106. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  107. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  108. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  109. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  110. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  111. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  112. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  113. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  114. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
  115. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  116. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
  117. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  118. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +273 -304
  119. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  120. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  121. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  122. data/lib/bundler/vendor/thor/lib/thor.rb +19 -4
  123. data/lib/bundler/vendor/thor/lib/thor/actions.rb +17 -12
  124. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  125. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
  126. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  127. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +5 -5
  128. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  129. data/lib/bundler/vendor/thor/lib/thor/base.rb +51 -39
  130. data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  131. data/lib/bundler/vendor/thor/lib/thor/error.rb +14 -18
  132. data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
  133. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  134. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  135. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  136. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  137. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  138. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  139. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +2 -2
  140. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
  141. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -3
  142. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  143. data/lib/bundler/vendor/thor/lib/thor/runner.rb +13 -12
  144. data/lib/bundler/vendor/thor/lib/thor/shell.rb +3 -3
  145. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  146. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
  147. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
  148. data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
  149. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  150. data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  151. data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  152. data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  153. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  154. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  155. data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  156. data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  157. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  158. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  159. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  160. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  161. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  162. data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  163. data/lib/bundler/vendored_fileutils.rb +1 -6
  164. data/lib/bundler/vendored_molinillo.rb +1 -1
  165. data/lib/bundler/vendored_persistent.rb +7 -5
  166. data/lib/bundler/vendored_thor.rb +2 -2
  167. data/lib/bundler/vendored_uri.rb +4 -0
  168. data/lib/bundler/version.rb +1 -20
  169. data/lib/bundler/version_ranges.rb +51 -5
  170. data/lib/bundler/vlad.rb +3 -3
  171. data/lib/bundler/worker.rb +1 -3
  172. data/lib/bundler/yaml_serializer.rb +2 -3
  173. data/man/bundle-add.1 +10 -2
  174. data/man/bundle-add.1.txt +11 -5
  175. data/man/bundle-add.ronn +7 -1
  176. data/man/bundle-binstubs.1 +2 -2
  177. data/man/bundle-binstubs.1.txt +2 -2
  178. data/man/bundle-binstubs.ronn +1 -1
  179. data/man/bundle-cache.1 +55 -0
  180. data/man/bundle-cache.1.txt +78 -0
  181. data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
  182. data/man/bundle-check.1 +1 -1
  183. data/man/bundle-check.1.txt +6 -6
  184. data/man/bundle-clean.1 +1 -1
  185. data/man/bundle-clean.1.txt +1 -1
  186. data/man/bundle-config.1 +35 -35
  187. data/man/bundle-config.1.txt +65 -66
  188. data/man/bundle-config.ronn +41 -39
  189. data/man/bundle-doctor.1 +1 -1
  190. data/man/bundle-doctor.1.txt +1 -1
  191. data/man/bundle-exec.1 +2 -2
  192. data/man/bundle-exec.1.txt +2 -2
  193. data/man/bundle-exec.ronn +1 -1
  194. data/man/bundle-gem.1 +1 -1
  195. data/man/bundle-gem.1.txt +3 -3
  196. data/man/bundle-info.1 +1 -1
  197. data/man/bundle-info.1.txt +1 -1
  198. data/man/bundle-init.1 +1 -1
  199. data/man/bundle-init.1.txt +1 -1
  200. data/man/bundle-inject.1 +1 -1
  201. data/man/bundle-inject.1.txt +1 -1
  202. data/man/bundle-install.1 +8 -5
  203. data/man/bundle-install.1.txt +56 -51
  204. data/man/bundle-install.ronn +9 -4
  205. data/man/bundle-list.1 +1 -1
  206. data/man/bundle-list.1.txt +1 -1
  207. data/man/bundle-lock.1 +1 -1
  208. data/man/bundle-lock.1.txt +16 -16
  209. data/man/bundle-open.1 +1 -1
  210. data/man/bundle-open.1.txt +1 -1
  211. data/man/bundle-outdated.1 +1 -1
  212. data/man/bundle-outdated.1.txt +1 -1
  213. data/man/bundle-platform.1 +1 -1
  214. data/man/bundle-platform.1.txt +1 -1
  215. data/man/bundle-pristine.1 +1 -1
  216. data/man/bundle-pristine.1.txt +1 -1
  217. data/man/bundle-remove.1 +1 -1
  218. data/man/bundle-remove.1.txt +1 -1
  219. data/man/bundle-show.1 +1 -1
  220. data/man/bundle-show.1.txt +1 -1
  221. data/man/bundle-update.1 +4 -4
  222. data/man/bundle-update.1.txt +64 -65
  223. data/man/bundle-update.ronn +3 -3
  224. data/man/bundle-viz.1 +1 -1
  225. data/man/bundle-viz.1.txt +1 -1
  226. data/man/bundle.1 +2 -2
  227. data/man/bundle.1.txt +7 -7
  228. data/man/bundle.ronn +1 -1
  229. data/man/gemfile.5 +12 -15
  230. data/man/gemfile.5.ronn +9 -13
  231. data/man/gemfile.5.txt +103 -107
  232. data/man/index.txt +1 -1
  233. metadata +30 -120
  234. data/exe/bundle_ruby +0 -60
  235. data/lib/bundler/cli/package.rb +0 -49
  236. data/lib/bundler/compatibility_guard.rb +0 -13
  237. data/lib/bundler/gem_remote_fetcher.rb +0 -43
  238. data/lib/bundler/ssl_certs/.document +0 -1
  239. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  240. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  241. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  242. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  243. data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  244. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  245. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  246. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  247. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  248. data/man/bundle-package.1 +0 -55
  249. data/man/bundle-package.1.txt +0 -79
@@ -9,10 +9,10 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
- Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \
12
+ Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
13
13
  "by `bin/console` generated by `bundle gem <name>`"
14
14
 
15
- group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
15
+ group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
16
16
  ARGV.clear
17
17
 
18
18
  console = get_console(Bundler.settings[:console] || "irb")
@@ -4,8 +4,8 @@ require "rbconfig"
4
4
 
5
5
  module Bundler
6
6
  class CLI::Doctor
7
- DARWIN_REGEX = /\s+(.+) \(compatibility /
8
- LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
7
+ DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
8
+ LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
9
9
 
10
10
  attr_reader :options
11
11
 
@@ -56,7 +56,7 @@ module Bundler
56
56
  end
57
57
 
58
58
  def check!
59
- require "bundler/cli/check"
59
+ require_relative "check"
60
60
  Bundler::CLI::Check.new({}).run
61
61
  end
62
62
 
@@ -100,7 +100,7 @@ module Bundler
100
100
  files_not_readable_or_writable = []
101
101
  files_not_rw_and_owned_by_different_user = []
102
102
  files_not_owned_by_current_user_but_still_rw = []
103
- Find.find(Bundler.home.to_s).each do |f|
103
+ Find.find(Bundler.bundle_path.to_s).each do |f|
104
104
  if !File.writable?(f) || !File.readable?(f)
105
105
  if File.stat(f).uid != Process.uid
106
106
  files_not_rw_and_owned_by_different_user << f
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/current_ruby"
3
+ require_relative "../current_ruby"
4
4
 
5
5
  module Bundler
6
6
  class CLI::Exec
@@ -13,7 +13,7 @@ module Bundler
13
13
  @cmd = args.shift
14
14
  @args = args
15
15
 
16
- if Bundler.current_ruby.ruby_2? && !Bundler.current_ruby.jruby?
16
+ if !Bundler.current_ruby.jruby?
17
17
  @args << { :close_others => !options.keep_file_descriptors? }
18
18
  elsif options.keep_file_descriptors?
19
19
  Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
@@ -25,17 +25,12 @@ module Bundler
25
25
  SharedHelpers.set_bundle_environment
26
26
  if bin_path = Bundler.which(cmd)
27
27
  if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
28
- return kernel_load(bin_path, *args)
29
- end
30
- # First, try to exec directly to something in PATH
31
- if Bundler.current_ruby.jruby_18?
32
- kernel_exec(bin_path, *args)
33
- else
34
- kernel_exec([bin_path, cmd], *args)
28
+ return with_verbose_rubygems { kernel_load(bin_path, *args) }
35
29
  end
30
+ with_verbose_rubygems { kernel_exec(bin_path, *args) }
36
31
  else
37
32
  # exec using the given command
38
- kernel_exec(cmd, *args)
33
+ with_verbose_rubygems { kernel_exec(cmd, *args) }
39
34
  end
40
35
  end
41
36
 
@@ -48,15 +43,11 @@ module Bundler
48
43
  end
49
44
 
50
45
  def kernel_exec(*args)
51
- ui = Bundler.ui
52
- Bundler.ui = nil
53
46
  Kernel.exec(*args)
54
47
  rescue Errno::EACCES, Errno::ENOEXEC
55
- Bundler.ui = ui
56
48
  Bundler.ui.error "bundler: not executable: #{cmd}"
57
49
  exit 126
58
50
  rescue Errno::ENOENT
59
- Bundler.ui = ui
60
51
  Bundler.ui.error "bundler: command not found: #{cmd}"
61
52
  Bundler.ui.warn "Install missing gem executables with `bundle install`"
62
53
  exit 127
@@ -67,15 +58,12 @@ module Bundler
67
58
  ARGV.replace(args)
68
59
  $0 = file
69
60
  Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
70
- ui = Bundler.ui
71
- Bundler.ui = nil
72
- require "bundler/setup"
61
+ require_relative "../setup"
73
62
  TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
74
63
  Kernel.load(file)
75
64
  rescue SystemExit, SignalException
76
65
  raise
77
66
  rescue Exception => e # rubocop:disable Lint/RescueException
78
- Bundler.ui = ui
79
67
  Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
80
68
  backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
81
69
  abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
@@ -101,5 +89,14 @@ module Bundler
101
89
  first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
102
90
  possibilities.any? {|shebang| first_line.start_with?(shebang) }
103
91
  end
92
+
93
+ def with_verbose_rubygems
94
+ old_ui = Gem::DefaultUserInteraction.ui
95
+ Gem::DefaultUserInteraction.ui = nil
96
+
97
+ yield
98
+ ensure
99
+ Gem::DefaultUserInteraction.ui = old_ui
100
+ end
104
101
  end
105
102
  end
@@ -11,7 +11,7 @@ module Bundler
11
11
  class CLI::Gem
12
12
  TEST_FRAMEWORK_VERSIONS = {
13
13
  "rspec" => "3.0",
14
- "minitest" => "5.0"
14
+ "minitest" => "5.0",
15
15
  }.freeze
16
16
 
17
17
  attr_reader :options, :gem_name, :thor, :name, :target
@@ -57,7 +57,7 @@ module Bundler
57
57
  :ext => options[:ext],
58
58
  :exe => options[:exe],
59
59
  :bundler_version => bundler_dependency_version,
60
- :github_username => github_username.empty? ? "[USERNAME]" : github_username
60
+ :github_username => github_username.empty? ? "[USERNAME]" : github_username,
61
61
  }
62
62
  ensure_safe_gem_name(name, constant_array)
63
63
 
@@ -69,7 +69,7 @@ module Bundler
69
69
  "Rakefile.tt" => "Rakefile",
70
70
  "README.md.tt" => "README.md",
71
71
  "bin/console.tt" => "bin/console",
72
- "bin/setup.tt" => "bin/setup"
72
+ "bin/setup.tt" => "bin/setup",
73
73
  }
74
74
 
75
75
  executables = %w[
@@ -148,7 +148,7 @@ module Bundler
148
148
  end
149
149
  end
150
150
 
151
- if Bundler.git_present?
151
+ if Bundler.git_present? && options[:git]
152
152
  Bundler.ui.info "Initializing git repo in #{target}"
153
153
  Dir.chdir(target) do
154
154
  `git init`
@@ -190,7 +190,7 @@ module Bundler
190
190
  Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
191
191
  "naming guidelines for C extensions. For more information, \n" \
192
192
  "see the 'Extension Naming' section at the following URL:\n" \
193
- "http://guides.rubygems.org/gems-with-extensions/\n"
193
+ "https://guides.rubygems.org/gems-with-extensions/\n"
194
194
  exit 1
195
195
  end
196
196
 
@@ -9,18 +9,24 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
+ Bundler.ui.silence do
13
+ Bundler.definition.validate_runtime!
14
+ Bundler.load.lock
15
+ end
16
+
12
17
  spec = spec_for_gem(gem_name)
13
18
 
14
- spec_not_found(gem_name) unless spec
15
- return print_gem_path(spec) if @options[:path]
16
- print_gem_info(spec)
19
+ if spec
20
+ return print_gem_path(spec) if @options[:path]
21
+ print_gem_info(spec)
22
+ end
17
23
  end
18
24
 
19
25
  private
20
26
 
21
27
  def spec_for_gem(gem_name)
22
28
  spec = Bundler.definition.specs.find {|s| s.name == gem_name }
23
- spec || default_gem_spec(gem_name)
29
+ spec || default_gem_spec(gem_name) || Bundler::CLI::Common.select_spec(gem_name, :regex_match)
24
30
  end
25
31
 
26
32
  def default_gem_spec(gem_name)
@@ -34,7 +40,13 @@ module Bundler
34
40
  end
35
41
 
36
42
  def print_gem_path(spec)
37
- Bundler.ui.info spec.full_gem_path
43
+ path = if spec.name == "bundler"
44
+ File.expand_path("../../../..", __FILE__)
45
+ else
46
+ spec.full_gem_path
47
+ end
48
+
49
+ Bundler.ui.info path
38
50
  end
39
51
 
40
52
  def print_gem_info(spec)
@@ -41,7 +41,7 @@ module Bundler
41
41
  private
42
42
 
43
43
  def gemfile
44
- @gemfile ||= Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile"
44
+ @gemfile ||= Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
45
45
  end
46
46
  end
47
47
  end
@@ -53,7 +53,7 @@ module Bundler
53
53
  Bundler::Fetcher.disable_endpoint = options["full-index"]
54
54
 
55
55
  if options["binstubs"]
56
- Bundler::SharedHelpers.major_deprecation 3,
56
+ Bundler::SharedHelpers.major_deprecation 2,
57
57
  "The --binstubs option will be removed in favor of `bundle binstubs`"
58
58
  end
59
59
 
@@ -66,7 +66,7 @@ module Bundler
66
66
  Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
67
67
 
68
68
  Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
69
- Bundler::CLI::Common.output_without_groups_message
69
+ Bundler::CLI::Common.output_without_groups_message(:install)
70
70
 
71
71
  if Bundler.use_system_gems?
72
72
  Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed."
@@ -80,7 +80,7 @@ module Bundler
80
80
  warn_ambiguous_gems
81
81
 
82
82
  if CLI::Common.clean_after_install?
83
- require "bundler/cli/clean"
83
+ require_relative "clean"
84
84
  Bundler::CLI::Clean.new(options).run
85
85
  end
86
86
  rescue GemNotFound, VersionConflict => e
@@ -33,7 +33,7 @@ module Bundler
33
33
  end
34
34
 
35
35
  def doctor
36
- require "bundler/cli/doctor"
36
+ require_relative "doctor"
37
37
  Bundler::CLI::Doctor.new({}).run
38
38
  end
39
39
  end
@@ -14,12 +14,16 @@ module Bundler
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
16
  return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
17
- path = spec.full_gem_path
18
- Dir.chdir(path) do
19
- command = Shellwords.split(editor) + [path]
20
- Bundler.with_original_env do
21
- system(*command)
22
- end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
17
+ if spec.default_gem?
18
+ Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
19
+ else
20
+ path = spec.full_gem_path
21
+ Dir.chdir(path) do
22
+ command = Shellwords.split(editor) + [path]
23
+ Bundler.with_original_env do
24
+ system(*command)
25
+ end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -2,17 +2,32 @@
2
2
 
3
3
  module Bundler
4
4
  class CLI::Outdated
5
- attr_reader :options, :gems
5
+ attr_reader :options, :gems, :options_include_groups, :filter_options_patch, :sources, :strict
6
+ attr_accessor :outdated_gems_by_groups, :outdated_gems_list
6
7
 
7
8
  def initialize(options, gems)
8
9
  @options = options
9
10
  @gems = gems
11
+ @sources = Array(options[:source])
12
+
13
+ @filter_options_patch = options.keys &
14
+ %w[filter-major filter-minor filter-patch]
15
+
16
+ @outdated_gems_by_groups = {}
17
+ @outdated_gems_list = []
18
+
19
+ @options_include_groups = [:group, :groups].any? do |v|
20
+ options.keys.include?(v.to_s)
21
+ end
22
+
23
+ # the patch level options imply strict is also true. It wouldn't make
24
+ # sense otherwise.
25
+ @strict = options["filter-strict"] ||
26
+ Bundler::CLI::Common.patch_level_options(options).any?
10
27
  end
11
28
 
12
29
  def run
13
- check_for_deployment_mode
14
-
15
- sources = Array(options[:source])
30
+ check_for_deployment_mode!
16
31
 
17
32
  gems.each do |gem_name|
18
33
  Bundler::CLI::Common.select_spec(gem_name)
@@ -20,11 +35,9 @@ module Bundler
20
35
 
21
36
  Bundler.definition.validate_runtime!
22
37
  current_specs = Bundler.ui.silence { Bundler.definition.resolve }
23
- current_dependencies = {}
24
- Bundler.ui.silence do
25
- Bundler.load.dependencies.each do |dep|
26
- current_dependencies[dep.name] = dep
27
- end
38
+
39
+ current_dependencies = Bundler.ui.silence do
40
+ Bundler.load.dependencies.map {|dep| [dep.name, dep] }.to_h
28
41
  end
29
42
 
30
43
  definition = if gems.empty? && sources.empty?
@@ -39,14 +52,6 @@ module Bundler
39
52
  options
40
53
  )
41
54
 
42
- # the patch level options imply strict is also true. It wouldn't make
43
- # sense otherwise.
44
- strict = options[:strict] ||
45
- Bundler::CLI::Common.patch_level_options(options).any?
46
-
47
- filter_options_patch = options.keys &
48
- %w[filter-major filter-minor filter-patch]
49
-
50
55
  definition_resolution = proc do
51
56
  options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely!
52
57
  end
@@ -58,8 +63,6 @@ module Bundler
58
63
  end
59
64
 
60
65
  Bundler.ui.info ""
61
- outdated_gems_by_groups = {}
62
- outdated_gems_list = []
63
66
 
64
67
  # Loop through the current specs
65
68
  gemfile_specs, dependency_specs = current_specs.partition do |spec|
@@ -76,13 +79,11 @@ module Bundler
76
79
  next if !gems.empty? && !gems.include?(current_spec.name)
77
80
 
78
81
  dependency = current_dependencies[current_spec.name]
79
- active_spec = retrieve_active_spec(strict, definition, current_spec)
82
+ active_spec = retrieve_active_spec(definition, current_spec)
80
83
 
81
84
  next if active_spec.nil?
82
- if filter_options_patch.any?
83
- update_present = update_present_via_semver_portions(current_spec, active_spec, options)
84
- next unless update_present
85
- end
85
+ next if filter_options_patch.any? &&
86
+ !update_present_via_semver_portions(current_spec, active_spec, options)
86
87
 
87
88
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
88
89
  next unless gem_outdated || (current_spec.git_version != active_spec.git_version)
@@ -97,34 +98,22 @@ module Bundler
97
98
  :groups => groups }
98
99
 
99
100
  outdated_gems_by_groups[groups] ||= []
100
- outdated_gems_by_groups[groups] << { :active_spec => active_spec,
101
- :current_spec => current_spec,
102
- :dependency => dependency,
103
- :groups => groups }
101
+ outdated_gems_by_groups[groups] << outdated_gems_list[-1]
104
102
  end
105
103
 
106
104
  if outdated_gems_list.empty?
107
- display_nothing_outdated_message(filter_options_patch)
105
+ display_nothing_outdated_message
108
106
  else
109
107
  unless options[:parseable]
110
- if options[:pre]
111
- Bundler.ui.info "Outdated gems included in the bundle (including " \
112
- "pre-releases):"
113
- else
114
- Bundler.ui.info "Outdated gems included in the bundle:"
115
- end
116
- end
117
-
118
- options_include_groups = [:group, :groups].select do |v|
119
- options.keys.include?(v.to_s)
108
+ Bundler.ui.info(header_outdated_message)
120
109
  end
121
110
 
122
- if options_include_groups.any?
111
+ if options_include_groups
123
112
  ordered_groups = outdated_gems_by_groups.keys.compact.sort
124
- [nil, ordered_groups].flatten.each do |groups|
113
+ ordered_groups.insert(0, nil).each do |groups|
125
114
  gems = outdated_gems_by_groups[groups]
126
115
  contains_group = if groups
127
- groups.split(",").include?(options[:group])
116
+ groups.split(", ").include?(options[:group])
128
117
  else
129
118
  options[:group] == "group"
130
119
  end
@@ -132,33 +121,13 @@ module Bundler
132
121
  next if (!options[:groups] && !contains_group) || gems.nil?
133
122
 
134
123
  unless options[:parseable]
135
- if groups
136
- Bundler.ui.info "===== Group #{groups} ====="
137
- else
138
- Bundler.ui.info "===== Without group ====="
139
- end
124
+ Bundler.ui.info(header_group_message(groups))
140
125
  end
141
126
 
142
- gems.each do |gem|
143
- print_gem(
144
- gem[:current_spec],
145
- gem[:active_spec],
146
- gem[:dependency],
147
- groups,
148
- options_include_groups.any?
149
- )
150
- end
127
+ print_gems(gems)
151
128
  end
152
129
  else
153
- outdated_gems_list.each do |gem|
154
- print_gem(
155
- gem[:current_spec],
156
- gem[:active_spec],
157
- gem[:dependency],
158
- gem[:groups],
159
- options_include_groups.any?
160
- )
161
- end
130
+ print_gems(outdated_gems_list)
162
131
  end
163
132
 
164
133
  exit 1
@@ -167,7 +136,39 @@ module Bundler
167
136
 
168
137
  private
169
138
 
170
- def retrieve_active_spec(strict, definition, current_spec)
139
+ def groups_text(group_text, groups)
140
+ "#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
141
+ end
142
+
143
+ def header_outdated_message
144
+ if options[:pre]
145
+ "Outdated gems included in the bundle (including pre-releases):"
146
+ else
147
+ "Outdated gems included in the bundle:"
148
+ end
149
+ end
150
+
151
+ def header_group_message(groups)
152
+ if groups
153
+ "===== #{groups_text("Group", groups)} ====="
154
+ else
155
+ "===== Without group ====="
156
+ end
157
+ end
158
+
159
+ def nothing_outdated_message
160
+ if filter_options_patch.any?
161
+ display = filter_options_patch.map do |o|
162
+ o.sub("filter-", "")
163
+ end.join(" or ")
164
+
165
+ "No #{display} updates to display.\n"
166
+ else
167
+ "Bundle up to date!\n"
168
+ end
169
+ end
170
+
171
+ def retrieve_active_spec(definition, current_spec)
171
172
  if strict
172
173
  active_spec = definition.find_resolved_spec(current_spec)
173
174
  else
@@ -181,21 +182,24 @@ module Bundler
181
182
  active_spec
182
183
  end
183
184
 
184
- def display_nothing_outdated_message(filter_options_patch)
185
+ def display_nothing_outdated_message
185
186
  unless options[:parseable]
186
- if filter_options_patch.any?
187
- display = filter_options_patch.map do |o|
188
- o.sub("filter-", "")
189
- end.join(" or ")
187
+ Bundler.ui.info(nothing_outdated_message)
188
+ end
189
+ end
190
190
 
191
- Bundler.ui.info "No #{display} updates to display.\n"
192
- else
193
- Bundler.ui.info "Bundle up to date!\n"
194
- end
191
+ def print_gems(gems_list)
192
+ gems_list.each do |gem|
193
+ print_gem(
194
+ gem[:current_spec],
195
+ gem[:active_spec],
196
+ gem[:dependency],
197
+ gem[:groups],
198
+ )
195
199
  end
196
200
  end
197
201
 
198
- def print_gem(current_spec, active_spec, dependency, groups, options_include_groups)
202
+ def print_gem(current_spec, active_spec, dependency, groups)
199
203
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
200
204
  spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
201
205
  current_version = "#{current_spec.version}#{current_spec.git_version}"
@@ -212,18 +216,18 @@ module Bundler
212
216
  elsif options_include_groups || !groups
213
217
  " * #{spec_outdated_info}"
214
218
  else
215
- " * #{spec_outdated_info} in groups \"#{groups}\""
219
+ " * #{spec_outdated_info} in #{groups_text("group", groups)}"
216
220
  end
217
221
 
218
222
  Bundler.ui.info output_message.rstrip
219
223
  end
220
224
 
221
- def check_for_deployment_mode
225
+ def check_for_deployment_mode!
222
226
  return unless Bundler.frozen_bundle?
223
227
  suggested_command = if Bundler.settings.locations("frozen")[:global]
224
- "bundle config --delete frozen"
228
+ "bundle config unset frozen"
225
229
  elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
226
- "bundle config --delete deployment"
230
+ "bundle config unset deployment"
227
231
  else
228
232
  "bundle install --no-deployment"
229
233
  end
@@ -260,7 +264,7 @@ module Bundler
260
264
 
261
265
  def get_version_semver_portion_value(spec, version_portion_index)
262
266
  version_section = spec.version.segments[version_portion_index, 1]
263
- version_section.nil? ? 0 : (version_section.first || 0)
267
+ version_section.to_a[0].to_i
264
268
  end
265
269
  end
266
270
  end