bundler 2.1.0.pre.3 → 2.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -3
- data/lib/bundler.rb +0 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +1 -1
- data/lib/bundler/cli/config.rb +1 -1
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/feature_flag.rb +1 -1
- data/lib/bundler/fetcher.rb +2 -2
- data/lib/bundler/fetcher/downloader.rb +1 -1
- data/lib/bundler/fetcher/index.rb +1 -1
- data/lib/bundler/friendly_errors.rb +1 -1
- data/lib/bundler/gem_helper.rb +12 -10
- data/lib/bundler/inline.rb +36 -31
- data/lib/bundler/lazy_specification.rb +0 -1
- data/lib/bundler/mirror.rb +3 -3
- data/lib/bundler/plugin/api/source.rb +2 -4
- data/lib/bundler/remote_specification.rb +0 -2
- data/lib/bundler/rubygems_integration.rb +15 -13
- data/lib/bundler/settings.rb +7 -4
- data/lib/bundler/setup.rb +5 -0
- data/lib/bundler/source/git.rb +5 -5
- data/lib/bundler/source/git/git_proxy.rb +3 -2
- data/lib/bundler/source/rubygems.rb +3 -3
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/uri_credentials_filter.rb +7 -3
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -26
- data/lib/bundler/vendor/thor/lib/thor.rb +7 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
- data/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-add.1 +1 -1
- data/man/bundle-add.1.txt +1 -1
- data/man/bundle-binstubs.1 +1 -1
- data/man/bundle-binstubs.1.txt +1 -1
- data/man/bundle-cache.1 +1 -1
- data/man/bundle-cache.1.txt +1 -1
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +1 -1
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +1 -1
- data/man/bundle-config.1 +1 -1
- data/man/bundle-config.1.txt +1 -1
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +1 -1
- data/man/bundle-exec.1.txt +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +1 -1
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +1 -1
- data/man/bundle-init.1.txt +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +1 -1
- data/man/bundle-install.1.txt +1 -1
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +1 -1
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +1 -1
- data/man/bundle-update.1.txt +1 -1
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +1 -1
- data/man/bundle.1.txt +1 -1
- data/man/gemfile.5 +1 -1
- data/man/gemfile.5.txt +1 -1
- metadata +18 -6
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
data/lib/bundler/settings.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "uri"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class Settings
|
7
5
|
autoload :Mirror, File.expand_path("mirror", __dir__)
|
@@ -152,7 +150,11 @@ module Bundler
|
|
152
150
|
end
|
153
151
|
|
154
152
|
def mirror_for(uri)
|
155
|
-
|
153
|
+
if uri.is_a?(String)
|
154
|
+
require_relative "vendored_uri"
|
155
|
+
uri = Bundler::URI(uri)
|
156
|
+
end
|
157
|
+
|
156
158
|
gem_mirrors.for(uri.to_s).uri
|
157
159
|
end
|
158
160
|
|
@@ -421,7 +423,8 @@ module Bundler
|
|
421
423
|
suffix = $3
|
422
424
|
end
|
423
425
|
uri = "#{uri}/" unless uri.end_with?("/")
|
424
|
-
|
426
|
+
require_relative "vendored_uri"
|
427
|
+
uri = Bundler::URI(uri)
|
425
428
|
unless uri.absolute?
|
426
429
|
raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
|
427
430
|
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -19,4 +19,9 @@ if Bundler::SharedHelpers.in_bundle?
|
|
19
19
|
else
|
20
20
|
Bundler.ui.silence { Bundler.setup }
|
21
21
|
end
|
22
|
+
|
23
|
+
# We might be in the middle of shelling out to rubygems
|
24
|
+
# (RUBYOPT=-rbundler/setup), so we need to give rubygems the opportunity of
|
25
|
+
# not being silent.
|
26
|
+
Gem::DefaultUserInteraction.ui = nil
|
22
27
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../vendored_fileutils"
|
4
|
-
require "uri"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class Source
|
8
7
|
class Git < Path
|
9
8
|
autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
|
10
9
|
|
11
|
-
attr_reader :uri, :ref, :branch, :options, :submodules
|
10
|
+
attr_reader :uri, :ref, :branch, :options, :glob, :submodules
|
12
11
|
|
13
12
|
def initialize(options)
|
14
13
|
@options = options
|
@@ -48,13 +47,14 @@ module Bundler
|
|
48
47
|
end
|
49
48
|
|
50
49
|
def hash
|
51
|
-
[self.class, uri, ref, branch, name, version, submodules].hash
|
50
|
+
[self.class, uri, ref, branch, name, version, glob, submodules].hash
|
52
51
|
end
|
53
52
|
|
54
53
|
def eql?(other)
|
55
54
|
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
|
56
55
|
branch == other.branch && name == other.name &&
|
57
|
-
version == other.version &&
|
56
|
+
version == other.version && glob == other.glob &&
|
57
|
+
submodules == other.submodules
|
58
58
|
end
|
59
59
|
|
60
60
|
alias_method :==, :eql?
|
@@ -284,7 +284,7 @@ module Bundler
|
|
284
284
|
if uri =~ %r{^\w+://(\w+@)?}
|
285
285
|
# Downcase the domain component of the URI
|
286
286
|
# and strip off a trailing slash, if one is present
|
287
|
-
input = URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
287
|
+
input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
288
288
|
else
|
289
289
|
# If there is no URI scheme, assume it is an ssh/git URI
|
290
290
|
input = uri
|
@@ -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
|
-
|
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)
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
259
|
+
env_splat = [config[:env]] if config[:env]
|
262
260
|
|
263
|
-
if config[:
|
264
|
-
|
265
|
-
|
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
|
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
|
-
|
162
|
-
|
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
|
166
|
-
|
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
|
-
|
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,
|
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,
|
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
|
-
|
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
|
#
|