rubygems-update 3.1.0.pre3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +43 -0
  5. data/History.txt +32 -0
  6. data/Manifest.txt +20 -3
  7. data/Rakefile +2 -6
  8. data/bundler/CHANGELOG.md +3 -3
  9. data/bundler/lib/bundler.rb +0 -1
  10. data/bundler/lib/bundler/build_metadata.rb +2 -0
  11. data/bundler/lib/bundler/cli.rb +4 -3
  12. data/bundler/lib/bundler/cli/config.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +12 -3
  14. data/bundler/lib/bundler/cli/gem.rb +10 -1
  15. data/bundler/lib/bundler/cli/info.rb +7 -0
  16. data/bundler/lib/bundler/cli/list.rb +11 -9
  17. data/bundler/lib/bundler/cli/outdated.rb +86 -63
  18. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  19. data/bundler/lib/bundler/cli/update.rb +1 -1
  20. data/bundler/lib/bundler/feature_flag.rb +1 -1
  21. data/bundler/lib/bundler/fetcher.rb +2 -2
  22. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  23. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  24. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  25. data/bundler/lib/bundler/gem_helper.rb +12 -10
  26. data/bundler/lib/bundler/inline.rb +36 -31
  27. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  28. data/bundler/lib/bundler/mirror.rb +3 -3
  29. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  30. data/bundler/lib/bundler/remote_specification.rb +0 -2
  31. data/bundler/lib/bundler/rubygems_integration.rb +5 -42
  32. data/bundler/lib/bundler/settings.rb +7 -4
  33. data/bundler/lib/bundler/source/git.rb +9 -9
  34. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  35. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  36. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  37. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  38. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -3
  39. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  40. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  41. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  42. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -26
  43. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  50. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  51. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  52. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  53. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  54. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  63. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  66. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  67. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  68. data/bundler/man/bundle-add.1 +1 -1
  69. data/bundler/man/bundle-add.1.txt +1 -1
  70. data/bundler/man/bundle-binstubs.1 +1 -1
  71. data/bundler/man/bundle-binstubs.1.txt +1 -1
  72. data/bundler/man/bundle-cache.1 +1 -1
  73. data/bundler/man/bundle-cache.1.txt +1 -1
  74. data/bundler/man/bundle-check.1 +1 -1
  75. data/bundler/man/bundle-check.1.txt +1 -1
  76. data/bundler/man/bundle-clean.1 +1 -1
  77. data/bundler/man/bundle-clean.1.txt +1 -1
  78. data/bundler/man/bundle-config.1 +1 -1
  79. data/bundler/man/bundle-config.1.txt +1 -1
  80. data/bundler/man/bundle-doctor.1 +1 -1
  81. data/bundler/man/bundle-doctor.1.txt +1 -1
  82. data/bundler/man/bundle-exec.1 +1 -1
  83. data/bundler/man/bundle-exec.1.txt +1 -1
  84. data/bundler/man/bundle-gem.1 +1 -1
  85. data/bundler/man/bundle-gem.1.txt +1 -1
  86. data/bundler/man/bundle-info.1 +1 -1
  87. data/bundler/man/bundle-info.1.txt +1 -1
  88. data/bundler/man/bundle-init.1 +1 -1
  89. data/bundler/man/bundle-init.1.txt +1 -1
  90. data/bundler/man/bundle-inject.1 +1 -1
  91. data/bundler/man/bundle-inject.1.txt +1 -1
  92. data/bundler/man/bundle-install.1 +1 -1
  93. data/bundler/man/bundle-install.1.txt +1 -1
  94. data/bundler/man/bundle-list.1 +7 -7
  95. data/bundler/man/bundle-list.1.txt +9 -8
  96. data/bundler/man/bundle-list.ronn +6 -6
  97. data/bundler/man/bundle-lock.1 +1 -1
  98. data/bundler/man/bundle-lock.1.txt +1 -1
  99. data/bundler/man/bundle-open.1 +1 -1
  100. data/bundler/man/bundle-open.1.txt +1 -1
  101. data/bundler/man/bundle-outdated.1 +1 -1
  102. data/bundler/man/bundle-outdated.1.txt +1 -1
  103. data/bundler/man/bundle-platform.1 +1 -1
  104. data/bundler/man/bundle-platform.1.txt +1 -1
  105. data/bundler/man/bundle-pristine.1 +1 -1
  106. data/bundler/man/bundle-pristine.1.txt +1 -1
  107. data/bundler/man/bundle-remove.1 +1 -1
  108. data/bundler/man/bundle-remove.1.txt +1 -1
  109. data/bundler/man/bundle-show.1 +1 -1
  110. data/bundler/man/bundle-show.1.txt +1 -1
  111. data/bundler/man/bundle-update.1 +1 -1
  112. data/bundler/man/bundle-update.1.txt +1 -1
  113. data/bundler/man/bundle-viz.1 +1 -1
  114. data/bundler/man/bundle-viz.1.txt +1 -1
  115. data/bundler/man/bundle.1 +1 -1
  116. data/bundler/man/bundle.1.txt +1 -1
  117. data/bundler/man/gemfile.5 +1 -1
  118. data/bundler/man/gemfile.5.txt +1 -1
  119. data/lib/rubygems.rb +5 -15
  120. data/lib/rubygems/command.rb +28 -6
  121. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  122. data/lib/rubygems/commands/setup_command.rb +1 -1
  123. data/lib/rubygems/commands/sources_command.rb +14 -0
  124. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  125. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  126. data/lib/rubygems/ext/builder.rb +1 -1
  127. data/lib/rubygems/remote_fetcher.rb +20 -31
  128. data/lib/rubygems/request.rb +2 -0
  129. data/lib/rubygems/source.rb +7 -1
  130. data/lib/rubygems/specification_policy.rb +44 -29
  131. data/lib/rubygems/uri_formatter.rb +0 -1
  132. data/lib/rubygems/uri_parser.rb +36 -0
  133. data/lib/rubygems/uri_parsing.rb +23 -0
  134. data/rubygems-update.gemspec +1 -8
  135. data/test/rubygems/test_gem.rb +3 -3
  136. data/test/rubygems/test_gem_command.rb +38 -9
  137. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  138. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  139. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  140. data/test/rubygems/test_gem_commands_sources_command.rb +74 -0
  141. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  142. data/test/rubygems/test_gem_indexer.rb +1 -1
  143. data/test/rubygems/test_gem_source.rb +14 -0
  144. data/test/rubygems/test_gem_specification.rb +48 -48
  145. data/test/rubygems/test_project_sanity.rb +0 -43
  146. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  147. data/test/rubygems/test_require.rb +41 -42
  148. data/util/bisect +0 -21
  149. data/util/ci.sh +1 -1
  150. metadata +23 -90
  151. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  153. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "open3"
4
3
  require "shellwords"
5
4
 
6
5
  module Bundler
@@ -218,7 +217,7 @@ module Bundler
218
217
  # Adds credentials to the URI as Fetcher#configured_uri_for does
219
218
  def configured_uri_for(uri)
220
219
  if /https?:/ =~ uri
221
- remote = URI(uri)
220
+ remote = Bundler::URI(uri)
222
221
  config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
223
222
  remote.userinfo ||= config_auth
224
223
  remote.to_s
@@ -243,12 +242,14 @@ module Bundler
243
242
  end
244
243
 
245
244
  def capture_and_filter_stderr(uri, cmd)
245
+ require "open3"
246
246
  return_value, captured_err, status = Open3.capture3(cmd)
247
247
  Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
248
248
  [return_value, status]
249
249
  end
250
250
 
251
251
  def capture_and_ignore_stderr(cmd)
252
+ require "open3"
252
253
  return_value, _, status = Open3.capture3(cmd)
253
254
  [return_value, status]
254
255
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri"
4
3
  require "rubygems/user_interaction"
5
4
 
6
5
  module Bundler
@@ -328,9 +327,10 @@ module Bundler
328
327
  def normalize_uri(uri)
329
328
  uri = uri.to_s
330
329
  uri = "#{uri}/" unless uri =~ %r{/$}
331
- uri = URI(uri)
330
+ require_relative "../vendored_uri"
331
+ uri = Bundler::URI(uri)
332
332
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
333
- "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(URI::HTTP) && uri.host.nil?)
333
+ "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Bundler::URI::HTTP) && uri.host.nil?)
334
334
  uri
335
335
  end
336
336
 
@@ -48,7 +48,7 @@ module Bundler
48
48
  end
49
49
 
50
50
  uri
51
- rescue URI::InvalidComponentError
51
+ rescue Bundler::URI::InvalidComponentError
52
52
  error_message = "Please CGI escape your usernames and passwords before " \
53
53
  "setting them for authentication."
54
54
  raise HTTPError.new(error_message)
@@ -10,3 +10,6 @@ gem "rake-compiler"
10
10
  <%- if config[:test] -%>
11
11
  gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
12
12
  <%- end -%>
13
+ <%- if config[:rubocop] -%>
14
+ gem "rubocop"
15
+ <%- end -%>
@@ -1,4 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ <% default_task_names = [config[:test_task]] -%>
2
3
  <% if config[:test] == "minitest" -%>
3
4
  require "rake/testtask"
4
5
 
@@ -13,8 +14,16 @@ require "rspec/core/rake_task"
13
14
 
14
15
  RSpec::Core::RakeTask.new(:spec)
15
16
 
17
+ <% end -%>
18
+ <% if config[:rubocop] -%>
19
+ <% default_task_names << :rubocop -%>
20
+ require "rubocop/rake_task"
21
+
22
+ RuboCop::RakeTask.new
23
+
16
24
  <% end -%>
17
25
  <% if config[:ext] -%>
26
+ <% default_task_names.unshift(:clobber, :compile) -%>
18
27
  require "rake/extensiontask"
19
28
 
20
29
  task :build => :compile
@@ -23,7 +32,5 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
23
32
  ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
24
33
  end
25
34
 
26
- task :default => [:clobber, :compile, :<%= config[:test_task] %>]
27
- <% else -%>
28
- task :default => :<%= config[:test_task] %>
29
35
  <% end -%>
36
+ task :default => <%= default_task_names.size == 1 ? default_task_names.first.inspect : default_task_names.inspect %>
@@ -1,4 +1,4 @@
1
- require_relative 'lib/<%=config[:namespaced_path]%>/version'
1
+ require_relative "lib/<%=config[:namespaced_path]%>/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = <%= config[:name].inspect %>
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
26
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
  end
28
28
  spec.bindir = "exe"
@@ -7,7 +7,11 @@ module Bundler
7
7
  def credential_filtered_uri(uri_to_anonymize)
8
8
  return uri_to_anonymize if uri_to_anonymize.nil?
9
9
  uri = uri_to_anonymize.dup
10
- uri = URI(uri.to_s) unless uri.is_a?(URI)
10
+ if uri.is_a?(String)
11
+ require_relative "vendored_uri"
12
+ uri = Bundler::URI(uri)
13
+ end
14
+
11
15
  if uri.userinfo
12
16
  # oauth authentication
13
17
  if uri.password == "x-oauth-basic" || uri.password == "x"
@@ -17,9 +21,9 @@ module Bundler
17
21
  end
18
22
  uri.password = nil
19
23
  end
20
- return uri if uri_to_anonymize.is_a?(URI)
21
24
  return uri.to_s if uri_to_anonymize.is_a?(String)
22
- rescue URI::InvalidURIError # uri is not canonical uri scheme
25
+ uri
26
+ rescue Bundler::URI::InvalidURIError # uri is not canonical uri scheme
23
27
  uri
24
28
  end
25
29
 
@@ -6,8 +6,6 @@ rescue LoadError
6
6
  # for make mjit-headers
7
7
  end
8
8
 
9
- require_relative "fileutils/version"
10
-
11
9
  #
12
10
  # = fileutils.rb
13
11
  #
@@ -104,6 +102,7 @@ require_relative "fileutils/version"
104
102
  # <tt>:verbose</tt> flags to methods in Bundler::FileUtils.
105
103
  #
106
104
  module Bundler::FileUtils
105
+ VERSION = "1.4.1"
107
106
 
108
107
  def self.private_module_function(name) #:nodoc:
109
108
  module_function name
@@ -1300,7 +1299,8 @@ module Bundler::FileUtils
1300
1299
  .reject {|n| n == '.' or n == '..' }
1301
1300
  end
1302
1301
 
1303
- files.map {|n| Entry_.new(prefix(), join(rel(), n.tap{|x| x.untaint if RUBY_VERSION < "2.7" })) }
1302
+ untaint = RUBY_VERSION < '2.7'
1303
+ files.map {|n| Entry_.new(prefix(), join(rel(), untaint ? n.untaint : n)) }
1304
1304
  end
1305
1305
 
1306
1306
  def stat
@@ -1,5 +1,5 @@
1
1
  require 'net/http'
2
- require 'uri'
2
+ require_relative '../../../../uri/lib/uri'
3
3
  require 'cgi' # for escaping
4
4
  require_relative '../../../../connection_pool/lib/connection_pool'
5
5
 
@@ -31,7 +31,7 @@ autoload :OpenSSL, 'openssl'
31
31
  #
32
32
  # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
33
33
  #
34
- # uri = URI 'http://example.com/awesome/web/service'
34
+ # uri = Bundler::URI 'http://example.com/awesome/web/service'
35
35
  #
36
36
  # http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
37
37
  #
@@ -48,17 +48,17 @@ autoload :OpenSSL, 'openssl'
48
48
  # post = Net::HTTP::Post.new post_uri.path
49
49
  # post.set_form_data 'some' => 'cool data'
50
50
  #
51
- # # perform the POST, the URI is always required
51
+ # # perform the POST, the Bundler::URI is always required
52
52
  # response http.request post_uri, post
53
53
  #
54
54
  # Note that for GET, HEAD and other requests that do not have a body you want
55
- # to use URI#request_uri not URI#path. The request_uri contains the query
55
+ # to use Bundler::URI#request_uri not Bundler::URI#path. The request_uri contains the query
56
56
  # params which are sent in the body for other requests.
57
57
  #
58
58
  # == SSL
59
59
  #
60
60
  # SSL connections are automatically created depending upon the scheme of the
61
- # URI. SSL connections are automatically verified against the default
61
+ # Bundler::URI. SSL connections are automatically verified against the default
62
62
  # certificate store for your computer. You can override this by changing
63
63
  # verify_mode or by specifying an alternate cert_store.
64
64
  #
@@ -81,7 +81,7 @@ autoload :OpenSSL, 'openssl'
81
81
  # == Proxies
82
82
  #
83
83
  # A proxy can be set through #proxy= or at initialization time by providing a
84
- # second argument to ::new. The proxy may be the URI of the proxy server or
84
+ # second argument to ::new. The proxy may be the Bundler::URI of the proxy server or
85
85
  # <code>:ENV</code> which will consult environment variables.
86
86
  #
87
87
  # See #proxy= and #proxy_from_env for details.
@@ -150,7 +150,7 @@ autoload :OpenSSL, 'openssl'
150
150
  #
151
151
  # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
152
152
  #
153
- # uri = URI 'http://example.com/awesome/web/service'
153
+ # uri = Bundler::URI 'http://example.com/awesome/web/service'
154
154
  # post_uri = uri + 'create'
155
155
  #
156
156
  # http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
@@ -249,7 +249,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
249
249
  # NOTE: This may not work on ruby > 1.9.
250
250
 
251
251
  def self.detect_idle_timeout uri, max = 10
252
- uri = URI uri unless URI::Generic === uri
252
+ uri = Bundler::URI uri unless Bundler::URI::Generic === uri
253
253
  uri += '/'
254
254
 
255
255
  req = Net::HTTP::Head.new uri.request_uri
@@ -513,13 +513,13 @@ class Bundler::Persistent::Net::HTTP::Persistent
513
513
  # required currently, but highly recommended. Your library name should be
514
514
  # good enough. This parameter will be required in a future version.
515
515
  #
516
- # +proxy+ may be set to a URI::HTTP or :ENV to pick up proxy options from
516
+ # +proxy+ may be set to a Bundler::URI::HTTP or :ENV to pick up proxy options from
517
517
  # the environment. See proxy_from_env for details.
518
518
  #
519
- # In order to use a URI for the proxy you may need to do some extra work
520
- # beyond URI parsing if the proxy requires a password:
519
+ # In order to use a Bundler::URI for the proxy you may need to do some extra work
520
+ # beyond Bundler::URI parsing if the proxy requires a password:
521
521
  #
522
- # proxy = URI 'http://proxy.example'
522
+ # proxy = Bundler::URI 'http://proxy.example'
523
523
  # proxy.user = 'AzureDiamond'
524
524
  # proxy.password = 'hunter2'
525
525
  #
@@ -566,7 +566,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
566
566
  @verify_mode = nil
567
567
  @cert_store = nil
568
568
 
569
- @generation = 0 # incremented when proxy URI changes
569
+ @generation = 0 # incremented when proxy Bundler::URI changes
570
570
 
571
571
  if HAVE_OPENSSL then
572
572
  @verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -688,14 +688,14 @@ class Bundler::Persistent::Net::HTTP::Persistent
688
688
  end
689
689
 
690
690
  ##
691
- # URI::escape wrapper
691
+ # Bundler::URI::escape wrapper
692
692
 
693
693
  def escape str
694
694
  CGI.escape str if str
695
695
  end
696
696
 
697
697
  ##
698
- # URI::unescape wrapper
698
+ # Bundler::URI::unescape wrapper
699
699
 
700
700
  def unescape str
701
701
  CGI.unescape str if str
@@ -803,12 +803,12 @@ class Bundler::Persistent::Net::HTTP::Persistent
803
803
  alias key= private_key=
804
804
 
805
805
  ##
806
- # Sets the proxy server. The +proxy+ may be the URI of the proxy server,
806
+ # Sets the proxy server. The +proxy+ may be the Bundler::URI of the proxy server,
807
807
  # the symbol +:ENV+ which will read the proxy from the environment or nil to
808
808
  # disable use of a proxy. See #proxy_from_env for details on setting the
809
809
  # proxy from the environment.
810
810
  #
811
- # If the proxy URI is set after requests have been made, the next request
811
+ # If the proxy Bundler::URI is set after requests have been made, the next request
812
812
  # will shut-down and re-open all connections.
813
813
  #
814
814
  # The +no_proxy+ query parameter can be used to specify hosts which shouldn't
@@ -819,9 +819,9 @@ class Bundler::Persistent::Net::HTTP::Persistent
819
819
  def proxy= proxy
820
820
  @proxy_uri = case proxy
821
821
  when :ENV then proxy_from_env
822
- when URI::HTTP then proxy
822
+ when Bundler::URI::HTTP then proxy
823
823
  when nil then # ignore
824
- else raise ArgumentError, 'proxy must be :ENV or a URI::HTTP'
824
+ else raise ArgumentError, 'proxy must be :ENV or a Bundler::URI::HTTP'
825
825
  end
826
826
 
827
827
  @no_proxy.clear
@@ -846,13 +846,13 @@ class Bundler::Persistent::Net::HTTP::Persistent
846
846
  end
847
847
 
848
848
  ##
849
- # Creates a URI for an HTTP proxy server from ENV variables.
849
+ # Creates a Bundler::URI for an HTTP proxy server from ENV variables.
850
850
  #
851
851
  # If +HTTP_PROXY+ is set a proxy will be returned.
852
852
  #
853
- # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the URI is given the
853
+ # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Bundler::URI is given the
854
854
  # indicated user and password unless HTTP_PROXY contains either of these in
855
- # the URI.
855
+ # the Bundler::URI.
856
856
  #
857
857
  # The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
858
858
  # be reached via proxy; if set it should be a comma separated list of
@@ -868,7 +868,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
868
868
 
869
869
  return nil if env_proxy.nil? or env_proxy.empty?
870
870
 
871
- uri = URI normalize_uri env_proxy
871
+ uri = Bundler::URI normalize_uri env_proxy
872
872
 
873
873
  env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
874
874
 
@@ -951,7 +951,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
951
951
  retried = false
952
952
  bad_response = false
953
953
 
954
- uri = URI uri
954
+ uri = Bundler::URI uri
955
955
  req = request_setup req || uri
956
956
  response = nil
957
957
 
@@ -1024,13 +1024,13 @@ class Bundler::Persistent::Net::HTTP::Persistent
1024
1024
  end
1025
1025
 
1026
1026
  ##
1027
- # Creates a GET request if +req_or_uri+ is a URI and adds headers to the
1027
+ # Creates a GET request if +req_or_uri+ is a Bundler::URI and adds headers to the
1028
1028
  # request.
1029
1029
  #
1030
1030
  # Returns the request.
1031
1031
 
1032
1032
  def request_setup req_or_uri # :nodoc:
1033
- req = if URI === req_or_uri then
1033
+ req = if Bundler::URI === req_or_uri then
1034
1034
  Net::HTTP::Get.new req_or_uri.request_uri
1035
1035
  else
1036
1036
  req_or_uri
@@ -344,6 +344,13 @@ class Bundler::Thor
344
344
  command && disable_required_check.include?(command.name.to_sym)
345
345
  end
346
346
 
347
+ def deprecation_warning(message) #:nodoc:
348
+ unless ENV['THOR_SILENCE_DEPRECATION']
349
+ warn "Deprecation warning: #{message}\n" +
350
+ 'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
351
+ end
352
+ end
353
+
347
354
  protected
348
355
 
349
356
  def stop_on_unknown_option #:nodoc:
@@ -1,5 +1,3 @@
1
- require "uri"
2
- require_relative "core_ext/io_binary_read"
3
1
  require_relative "actions/create_file"
4
2
  require_relative "actions/create_link"
5
3
  require_relative "actions/directory"
@@ -258,13 +256,19 @@ class Bundler::Thor
258
256
 
259
257
  return if options[:pretend]
260
258
 
261
- result = config[:capture] ? `#{command}` : system(command.to_s)
259
+ env_splat = [config[:env]] if config[:env]
262
260
 
263
- if config[:abort_on_failure]
264
- success = config[:capture] ? $?.success? : result
265
- abort unless success
261
+ if config[:capture]
262
+ require "open3"
263
+ result, status = Open3.capture2e(*env_splat, command.to_s)
264
+ success = status.success?
265
+ else
266
+ result = system(*env_splat, command.to_s)
267
+ success = result
266
268
  end
267
269
 
270
+ abort if !success && config.fetch(:abort_on_failure, self.class.exit_on_failure?)
271
+
268
272
  result
269
273
  end
270
274
 
@@ -2,6 +2,7 @@ require_relative "command"
2
2
  require_relative "core_ext/hash_with_indifferent_access"
3
3
  require_relative "error"
4
4
  require_relative "invocation"
5
+ require_relative "nested_context"
5
6
  require_relative "parser"
6
7
  require_relative "shell"
7
8
  require_relative "line_editor"
@@ -153,17 +154,20 @@ class Bundler::Thor
153
154
 
154
155
  # If you want to raise an error when the default value of an option does not match
155
156
  # the type call check_default_type!
156
- # This is disabled by default for compatibility.
157
+ # This will be the default; for compatibility a deprecation warning is issued if necessary.
157
158
  def check_default_type!
158
159
  @check_default_type = true
159
160
  end
160
161
 
161
- def check_default_type #:nodoc:
162
- @check_default_type ||= from_superclass(:check_default_type, false)
162
+ # If you want to use defaults that don't match the type of an option,
163
+ # either specify `check_default_type: false` or call `allow_incompatible_default_type!`
164
+ def allow_incompatible_default_type!
165
+ @check_default_type = false
163
166
  end
164
167
 
165
- def check_default_type? #:nodoc:
166
- !!check_default_type
168
+ def check_default_type #:nodoc:
169
+ @check_default_type = from_superclass(:check_default_type, nil) unless defined?(@check_default_type)
170
+ @check_default_type
167
171
  end
168
172
 
169
173
  # If true, option parsing is suspended as soon as an unknown option or a
@@ -415,14 +419,20 @@ class Bundler::Thor
415
419
  # remove_command :this_is_not_a_command
416
420
  # end
417
421
  #
418
- def no_commands
419
- @no_commands = true
420
- yield
421
- ensure
422
- @no_commands = false
422
+ def no_commands(&block)
423
+ no_commands_context.enter(&block)
423
424
  end
425
+
424
426
  alias_method :no_tasks, :no_commands
425
427
 
428
+ def no_commands_context
429
+ @no_commands_context ||= NestedContext.new
430
+ end
431
+
432
+ def no_commands?
433
+ no_commands_context.entered?
434
+ end
435
+
426
436
  # Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the
427
437
  # namespace is retrieved from the class name. If your Bundler::Thor class is named
428
438
  # Scripts::MyScript, the help method, for example, will be called as:
@@ -506,6 +516,12 @@ class Bundler::Thor
506
516
  raise InvocationError, msg
507
517
  end
508
518
 
519
+ # A flag that makes the process exit with status 1 if any error happens.
520
+ def exit_on_failure?
521
+ Bundler::Thor.deprecation_warning "Bundler::Thor exit with status 0 on errors. To keep this behavior, you must define `exit_on_failure?` in `#{self.name}`"
522
+ false
523
+ end
524
+
509
525
  protected
510
526
 
511
527
  # Prints the class options per group. If an option does not belong to
@@ -563,7 +579,7 @@ class Bundler::Thor
563
579
  # options<Hash>:: Described in both class_option and method_option.
564
580
  # scope<Hash>:: Options hash that is being built up
565
581
  def build_option(name, options, scope) #:nodoc:
566
- scope[name] = Bundler::Thor::Option.new(name, options.merge(:check_default_type => check_default_type?))
582
+ scope[name] = Bundler::Thor::Option.new(name, {:check_default_type => check_default_type}.merge!(options))
567
583
  end
568
584
 
569
585
  # Receives a hash of options, parse them and add to the scope. This is a
@@ -598,7 +614,7 @@ class Bundler::Thor
598
614
  def inherited(klass)
599
615
  super(klass)
600
616
  Bundler::Thor::Base.register_klass_file(klass)
601
- klass.instance_variable_set(:@no_commands, false)
617
+ klass.instance_variable_set(:@no_commands, 0)
602
618
  end
603
619
 
604
620
  # Fire this callback whenever a method is added. Added methods are
@@ -615,8 +631,7 @@ class Bundler::Thor
615
631
  # Return if it's not a public instance method
616
632
  return unless public_method_defined?(meth.to_sym)
617
633
 
618
- @no_commands ||= false
619
- return if @no_commands || !create_command(meth)
634
+ return if no_commands? || !create_command(meth)
620
635
 
621
636
  is_thor_reserved_word?(meth, :command)
622
637
  Bundler::Thor::Base.register_klass_file(self)
@@ -643,11 +658,6 @@ class Bundler::Thor
643
658
  end
644
659
  end
645
660
 
646
- # A flag that makes the process exit with status 1 if any error happens.
647
- def exit_on_failure?
648
- false
649
- end
650
-
651
661
  #
652
662
  # The basename of the program invoking the thor class.
653
663
  #