bundler 2.5.23 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -0
- data/bundler.gemspec +2 -2
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/console.rb +0 -4
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +1 -0
- data/lib/bundler/cli/gem.rb +1 -1
- data/lib/bundler/cli/info.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +4 -0
- data/lib/bundler/cli/lock.rb +20 -1
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli.rb +22 -53
- data/lib/bundler/compact_index_client/cache_file.rb +0 -5
- data/lib/bundler/compact_index_client/updater.rb +0 -11
- data/lib/bundler/definition.rb +134 -61
- data/lib/bundler/dependency.rb +1 -1
- data/lib/bundler/dsl.rb +2 -13
- data/lib/bundler/endpoint_specification.rb +10 -1
- data/lib/bundler/errors.rb +10 -0
- data/lib/bundler/feature_flag.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +1 -1
- data/lib/bundler/fetcher.rb +10 -3
- data/lib/bundler/gem_helpers.rb +21 -5
- data/lib/bundler/injector.rb +2 -2
- data/lib/bundler/installer/standalone.rb +2 -2
- data/lib/bundler/installer.rb +4 -38
- data/lib/bundler/lazy_specification.rb +65 -24
- data/lib/bundler/lockfile_parser.rb +9 -1
- data/lib/bundler/man/bundle-add.1 +13 -10
- data/lib/bundler/man/bundle-add.1.ronn +12 -9
- data/lib/bundler/man/bundle-binstubs.1 +7 -4
- data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
- data/lib/bundler/man/bundle-cache.1 +30 -2
- data/lib/bundler/man/bundle-cache.1.ronn +31 -2
- data/lib/bundler/man/bundle-check.1 +3 -3
- data/lib/bundler/man/bundle-check.1.ronn +4 -2
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +3 -1
- data/lib/bundler/man/bundle-config.1.ronn +2 -0
- data/lib/bundler/man/bundle-console.1 +2 -4
- data/lib/bundler/man/bundle-console.1.ronn +2 -7
- data/lib/bundler/man/bundle-doctor.1 +2 -2
- data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/lib/bundler/man/bundle-exec.1 +5 -2
- data/lib/bundler/man/bundle-exec.1.ronn +4 -1
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +17 -5
- data/lib/bundler/man/bundle-gem.1.ronn +27 -6
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +5 -2
- data/lib/bundler/man/bundle-info.1.ronn +6 -2
- data/lib/bundler/man/bundle-init.1 +3 -3
- data/lib/bundler/man/bundle-init.1.ronn +3 -2
- data/lib/bundler/man/bundle-inject.1 +10 -2
- data/lib/bundler/man/bundle-inject.1.ronn +9 -1
- data/lib/bundler/man/bundle-install.1 +14 -11
- data/lib/bundler/man/bundle-install.1.ronn +21 -16
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-list.1.ronn +4 -1
- data/lib/bundler/man/bundle-lock.1 +21 -6
- data/lib/bundler/man/bundle-lock.1.ronn +25 -4
- data/lib/bundler/man/bundle-open.1 +2 -2
- data/lib/bundler/man/bundle-open.1.ronn +2 -1
- data/lib/bundler/man/bundle-outdated.1 +8 -5
- data/lib/bundler/man/bundle-outdated.1.ronn +8 -4
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-remove.1.ronn +1 -1
- data/lib/bundler/man/bundle-show.1 +5 -2
- data/lib/bundler/man/bundle-show.1.ronn +4 -0
- data/lib/bundler/man/bundle-update.1 +13 -7
- data/lib/bundler/man/bundle-update.1.ronn +14 -6
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +4 -4
- data/lib/bundler/man/bundle-viz.1.ronn +7 -3
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/plugin/events.rb +24 -0
- data/lib/bundler/plugin/installer.rb +1 -1
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +6 -1
- data/lib/bundler/resolver/base.rb +2 -6
- data/lib/bundler/resolver/candidate.rb +2 -2
- data/lib/bundler/resolver/spec_group.rb +4 -3
- data/lib/bundler/resolver.rb +5 -5
- data/lib/bundler/rubygems_ext.rb +17 -28
- data/lib/bundler/rubygems_gem_installer.rb +0 -1
- data/lib/bundler/rubygems_integration.rb +21 -11
- data/lib/bundler/runtime.rb +27 -7
- data/lib/bundler/self_manager.rb +2 -3
- data/lib/bundler/settings.rb +1 -0
- data/lib/bundler/shared_helpers.rb +2 -2
- data/lib/bundler/source/git/git_proxy.rb +0 -6
- data/lib/bundler/source/git.rb +56 -31
- data/lib/bundler/source/path.rb +2 -2
- data/lib/bundler/source_list.rb +1 -1
- data/lib/bundler/spec_set.rb +81 -56
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/uri_credentials_filter.rb +1 -1
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
- data/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +11 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
- data/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
- data/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +9 -9
- data/lib/bundler/vendored_securerandom.rb +0 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +37 -13
- metadata +18 -12
- data/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
- data/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
- data/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
- data/lib/bundler/vendor/uri/LICENSE.txt +0 -22
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: us-ascii -*-
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'random/formatter'
|
5
5
|
|
6
6
|
# == Secure random number generator interface.
|
7
7
|
#
|
@@ -18,7 +18,7 @@ require_relative 'random/formatter'
|
|
18
18
|
# * /dev/urandom
|
19
19
|
# * Win32
|
20
20
|
#
|
21
|
-
# Bundler::SecureRandom is extended by the
|
21
|
+
# Bundler::SecureRandom is extended by the Random::Formatter module which
|
22
22
|
# defines the following methods:
|
23
23
|
#
|
24
24
|
# * alphanumeric
|
@@ -41,7 +41,7 @@ require_relative 'random/formatter'
|
|
41
41
|
module Bundler::SecureRandom
|
42
42
|
|
43
43
|
# The version
|
44
|
-
VERSION = "0.
|
44
|
+
VERSION = "0.4.0"
|
45
45
|
|
46
46
|
class << self
|
47
47
|
# Returns a random binary string containing +size+ bytes.
|
@@ -88,9 +88,9 @@ module Bundler::SecureRandom
|
|
88
88
|
|
89
89
|
# :startdoc:
|
90
90
|
|
91
|
-
# Generate random data bytes for
|
91
|
+
# Generate random data bytes for Random::Formatter
|
92
92
|
public :gen_random
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
Bundler::SecureRandom.extend(
|
96
|
+
Bundler::SecureRandom.extend(Random::Formatter)
|
@@ -10,7 +10,6 @@ class Bundler::Thor
|
|
10
10
|
# destination<String>:: the relative path to the destination root.
|
11
11
|
# config<Hash>:: give :verbose => false to not log the status, and
|
12
12
|
# :mode => :preserve, to preserve the file mode from the source.
|
13
|
-
|
14
13
|
#
|
15
14
|
# ==== Examples
|
16
15
|
#
|
@@ -275,9 +274,8 @@ class Bundler::Thor
|
|
275
274
|
end
|
276
275
|
end
|
277
276
|
|
278
|
-
# Uncomment all lines matching a given regex.
|
279
|
-
#
|
280
|
-
# between the comment hash and the beginning of the line.
|
277
|
+
# Uncomment all lines matching a given regex. Preserves indentation before
|
278
|
+
# the comment hash and removes the hash and any immediate following space.
|
281
279
|
#
|
282
280
|
# ==== Parameters
|
283
281
|
# path<String>:: path of the file to be changed
|
@@ -291,7 +289,7 @@ class Bundler::Thor
|
|
291
289
|
def uncomment_lines(path, flag, *args)
|
292
290
|
flag = flag.respond_to?(:source) ? flag.source : flag
|
293
291
|
|
294
|
-
gsub_file(path, /^(\s*)#[[:blank:]]
|
292
|
+
gsub_file(path, /^(\s*)#[[:blank:]]?(.*#{flag})/, '\1\2', *args)
|
295
293
|
end
|
296
294
|
|
297
295
|
# Comment all lines matching a given regex. It will leave the space
|
@@ -211,6 +211,17 @@ class Bundler::Thor::Group
|
|
211
211
|
raise error, msg
|
212
212
|
end
|
213
213
|
|
214
|
+
# Checks if a specified command exists.
|
215
|
+
#
|
216
|
+
# ==== Parameters
|
217
|
+
# command_name<String>:: The name of the command to check for existence.
|
218
|
+
#
|
219
|
+
# ==== Returns
|
220
|
+
# Boolean:: +true+ if the command exists, +false+ otherwise.
|
221
|
+
def command_exists?(command_name) #:nodoc:
|
222
|
+
commands.keys.include?(command_name)
|
223
|
+
end
|
224
|
+
|
214
225
|
protected
|
215
226
|
|
216
227
|
# The method responsible for dispatching given the args.
|
@@ -89,8 +89,8 @@ class Bundler::Thor
|
|
89
89
|
|
90
90
|
sample = "[#{sample}]".dup unless required?
|
91
91
|
|
92
|
-
if boolean?
|
93
|
-
sample << ", [#{dasherize('no-' + human_name)}]
|
92
|
+
if boolean? && name != "force" && !name.match(/\A(no|skip)[\-_]/)
|
93
|
+
sample << ", [#{dasherize('no-' + human_name)}], [#{dasherize('skip-' + human_name)}]"
|
94
94
|
end
|
95
95
|
|
96
96
|
aliases_for_usage.ljust(padding) + sample
|
@@ -250,7 +250,8 @@ class Bundler::Thor
|
|
250
250
|
@parsing_options
|
251
251
|
end
|
252
252
|
|
253
|
-
# Parse boolean values which can be given as --foo=true
|
253
|
+
# Parse boolean values which can be given as --foo=true or --foo for true values, or
|
254
|
+
# --foo=false, --no-foo or --skip-foo for false values.
|
254
255
|
#
|
255
256
|
def parse_boolean(switch)
|
256
257
|
if current_is_value?
|
@@ -67,15 +67,15 @@ class Bundler::Thor
|
|
67
67
|
# Readline.
|
68
68
|
#
|
69
69
|
# ==== Example
|
70
|
-
#
|
70
|
+
# ask("What is your name?")
|
71
71
|
#
|
72
|
-
#
|
72
|
+
# ask("What is the planet furthest from the sun?", :default => "Neptune")
|
73
73
|
#
|
74
|
-
#
|
74
|
+
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
|
75
75
|
#
|
76
|
-
#
|
76
|
+
# ask("What is your password?", :echo => false)
|
77
77
|
#
|
78
|
-
#
|
78
|
+
# ask("Where should the file be saved?", :path => true)
|
79
79
|
#
|
80
80
|
def ask(statement, *args)
|
81
81
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -93,7 +93,7 @@ class Bundler::Thor
|
|
93
93
|
# are passed straight to puts (behavior got from Highline).
|
94
94
|
#
|
95
95
|
# ==== Example
|
96
|
-
#
|
96
|
+
# say("I know you knew that.")
|
97
97
|
#
|
98
98
|
def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
99
99
|
return if quiet?
|
@@ -110,7 +110,7 @@ class Bundler::Thor
|
|
110
110
|
# are passed straight to puts (behavior got from Highline).
|
111
111
|
#
|
112
112
|
# ==== Example
|
113
|
-
#
|
113
|
+
# say_error("error: something went wrong")
|
114
114
|
#
|
115
115
|
def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
116
116
|
return if quiet?
|
@@ -143,14 +143,14 @@ class Bundler::Thor
|
|
143
143
|
stdout.flush
|
144
144
|
end
|
145
145
|
|
146
|
-
#
|
146
|
+
# Asks the user a question and returns true if the user replies "y" or
|
147
147
|
# "yes".
|
148
148
|
#
|
149
149
|
def yes?(statement, color = nil)
|
150
150
|
!!(ask(statement, color, add_to_history: false) =~ is?(:yes))
|
151
151
|
end
|
152
152
|
|
153
|
-
#
|
153
|
+
# Asks the user a question and returns true if the user replies "n" or
|
154
154
|
# "no".
|
155
155
|
#
|
156
156
|
def no?(statement, color = nil)
|
@@ -102,33 +102,17 @@ class Bundler::Thor
|
|
102
102
|
|
103
103
|
def truncate(string)
|
104
104
|
return string unless @truncate
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
chars[0, @truncate - 3 - @indent].join + "..."
|
111
|
-
end
|
105
|
+
chars = string.chars.to_a
|
106
|
+
if chars.length <= @truncate
|
107
|
+
chars.join
|
108
|
+
else
|
109
|
+
chars[0, @truncate - 3 - @indent].join + "..."
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
115
113
|
def indentation
|
116
114
|
" " * @indent
|
117
115
|
end
|
118
|
-
|
119
|
-
if "".respond_to?(:encode)
|
120
|
-
def as_unicode
|
121
|
-
yield
|
122
|
-
end
|
123
|
-
else
|
124
|
-
def as_unicode
|
125
|
-
old = $KCODE # rubocop:disable Style/GlobalVars
|
126
|
-
$KCODE = "U" # rubocop:disable Style/GlobalVars
|
127
|
-
yield
|
128
|
-
ensure
|
129
|
-
$KCODE = old # rubocop:disable Style/GlobalVars
|
130
|
-
end
|
131
|
-
end
|
132
116
|
end
|
133
117
|
end
|
134
118
|
end
|
@@ -133,7 +133,7 @@ class Bundler::Thor
|
|
133
133
|
*pieces, command = namespace.split(":")
|
134
134
|
namespace = pieces.join(":")
|
135
135
|
namespace = "default" if namespace.empty?
|
136
|
-
klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.
|
136
|
+
klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.command_exists?(command) }
|
137
137
|
end
|
138
138
|
unless klass # look for a Bundler::Thor::Group with the right name
|
139
139
|
klass = Bundler::Thor::Util.find_by_namespace(namespace)
|
@@ -439,6 +439,17 @@ class Bundler::Thor
|
|
439
439
|
command && disable_required_check.include?(command.name.to_sym)
|
440
440
|
end
|
441
441
|
|
442
|
+
# Checks if a specified command exists.
|
443
|
+
#
|
444
|
+
# ==== Parameters
|
445
|
+
# command_name<String>:: The name of the command to check for existence.
|
446
|
+
#
|
447
|
+
# ==== Returns
|
448
|
+
# Boolean:: +true+ if the command exists, +false+ otherwise.
|
449
|
+
def command_exists?(command_name) #:nodoc:
|
450
|
+
commands.keys.include?(normalize_command_name(command_name))
|
451
|
+
end
|
452
|
+
|
442
453
|
protected
|
443
454
|
|
444
455
|
# Returns this class exclusive options array set.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
@@ -13,26 +13,47 @@ require_relative "rfc2396_parser"
|
|
13
13
|
require_relative "rfc3986_parser"
|
14
14
|
|
15
15
|
module Bundler::URI
|
16
|
-
|
16
|
+
RFC2396_PARSER = RFC2396_Parser.new
|
17
|
+
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
|
17
18
|
|
18
|
-
REGEXP = RFC2396_REGEXP
|
19
|
-
Parser = RFC2396_Parser
|
20
19
|
RFC3986_PARSER = RFC3986_Parser.new
|
21
20
|
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
|
22
|
-
RFC2396_PARSER = RFC2396_Parser.new
|
23
|
-
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
|
24
21
|
|
25
|
-
|
26
|
-
DEFAULT_PARSER
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
DEFAULT_PARSER = RFC3986_PARSER
|
23
|
+
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
24
|
+
|
25
|
+
def self.parser=(parser = RFC3986_PARSER)
|
26
|
+
remove_const(:Parser) if defined?(::Bundler::URI::Parser)
|
27
|
+
const_set("Parser", parser.class)
|
28
|
+
|
29
|
+
remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP)
|
30
|
+
remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN)
|
31
|
+
if Parser == RFC2396_Parser
|
32
|
+
const_set("REGEXP", Bundler::URI::RFC2396_REGEXP)
|
33
|
+
const_set("PATTERN", Bundler::URI::RFC2396_REGEXP::PATTERN)
|
34
|
+
end
|
35
|
+
|
36
|
+
Parser.new.regexp.each_pair do |sym, str|
|
37
|
+
remove_const(sym) if const_defined?(sym, false)
|
38
|
+
const_set(sym, str)
|
30
39
|
end
|
31
40
|
end
|
32
|
-
|
33
|
-
|
41
|
+
self.parser = RFC3986_PARSER
|
42
|
+
|
43
|
+
def self.const_missing(const)
|
44
|
+
if const == :REGEXP
|
45
|
+
warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
|
46
|
+
Bundler::URI::RFC2396_REGEXP
|
47
|
+
elsif value = RFC2396_PARSER.regexp[const]
|
48
|
+
warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
|
49
|
+
value
|
50
|
+
elsif value = RFC2396_Parser.const_get(const)
|
51
|
+
warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
|
52
|
+
value
|
53
|
+
else
|
54
|
+
super
|
55
|
+
end
|
34
56
|
end
|
35
|
-
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
36
57
|
|
37
58
|
module Util # :nodoc:
|
38
59
|
def make_components_hash(klass, array_hash)
|
@@ -170,7 +191,7 @@ module Bundler::URI
|
|
170
191
|
# ["fragment", "top"]]
|
171
192
|
#
|
172
193
|
def self.split(uri)
|
173
|
-
|
194
|
+
DEFAULT_PARSER.split(uri)
|
174
195
|
end
|
175
196
|
|
176
197
|
# Returns a new \Bundler::URI object constructed from the given string +uri+:
|
@@ -184,7 +205,7 @@ module Bundler::URI
|
|
184
205
|
# if it may contain invalid Bundler::URI characters.
|
185
206
|
#
|
186
207
|
def self.parse(uri)
|
187
|
-
|
208
|
+
DEFAULT_PARSER.parse(uri)
|
188
209
|
end
|
189
210
|
|
190
211
|
# Merges the given Bundler::URI strings +str+
|
@@ -211,7 +232,7 @@ module Bundler::URI
|
|
211
232
|
# # => #<Bundler::URI::HTTP http://example.com/foo/bar>
|
212
233
|
#
|
213
234
|
def self.join(*str)
|
214
|
-
|
235
|
+
DEFAULT_PARSER.join(*str)
|
215
236
|
end
|
216
237
|
|
217
238
|
#
|
@@ -70,17 +70,17 @@ module Bundler::URI
|
|
70
70
|
|
71
71
|
# raise InvalidURIError
|
72
72
|
def check_userinfo(user)
|
73
|
-
raise Bundler::URI::InvalidURIError, "
|
73
|
+
raise Bundler::URI::InvalidURIError, "cannot set userinfo for file Bundler::URI"
|
74
74
|
end
|
75
75
|
|
76
76
|
# raise InvalidURIError
|
77
77
|
def check_user(user)
|
78
|
-
raise Bundler::URI::InvalidURIError, "
|
78
|
+
raise Bundler::URI::InvalidURIError, "cannot set user for file Bundler::URI"
|
79
79
|
end
|
80
80
|
|
81
81
|
# raise InvalidURIError
|
82
82
|
def check_password(user)
|
83
|
-
raise Bundler::URI::InvalidURIError, "
|
83
|
+
raise Bundler::URI::InvalidURIError, "cannot set password for file Bundler::URI"
|
84
84
|
end
|
85
85
|
|
86
86
|
# do nothing
|
@@ -17,7 +17,7 @@ module Bundler::URI
|
|
17
17
|
# This class will be redesigned because of difference of implementations;
|
18
18
|
# the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
|
19
19
|
# is a good summary about the de facto spec.
|
20
|
-
#
|
20
|
+
# https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04
|
21
21
|
#
|
22
22
|
class FTP < Generic
|
23
23
|
# A Default port of 21 for Bundler::URI::FTP.
|
@@ -82,7 +82,7 @@ module Bundler::URI
|
|
82
82
|
if args.kind_of?(Array)
|
83
83
|
return self.build(args.collect{|x|
|
84
84
|
if x.is_a?(String)
|
85
|
-
|
85
|
+
Bundler::URI::RFC2396_PARSER.escape(x)
|
86
86
|
else
|
87
87
|
x
|
88
88
|
end
|
@@ -91,7 +91,7 @@ module Bundler::URI
|
|
91
91
|
tmp = {}
|
92
92
|
args.each do |key, value|
|
93
93
|
tmp[key] = if value
|
94
|
-
|
94
|
+
Bundler::URI::RFC2396_PARSER.escape(value)
|
95
95
|
else
|
96
96
|
value
|
97
97
|
end
|
@@ -393,7 +393,7 @@ module Bundler::URI
|
|
393
393
|
def check_user(v)
|
394
394
|
if @opaque
|
395
395
|
raise InvalidURIError,
|
396
|
-
"
|
396
|
+
"cannot set user with opaque"
|
397
397
|
end
|
398
398
|
|
399
399
|
return v unless v
|
@@ -417,7 +417,7 @@ module Bundler::URI
|
|
417
417
|
def check_password(v, user = @user)
|
418
418
|
if @opaque
|
419
419
|
raise InvalidURIError,
|
420
|
-
"
|
420
|
+
"cannot set password with opaque"
|
421
421
|
end
|
422
422
|
return v unless v
|
423
423
|
|
@@ -596,7 +596,7 @@ module Bundler::URI
|
|
596
596
|
|
597
597
|
if @opaque
|
598
598
|
raise InvalidURIError,
|
599
|
-
"
|
599
|
+
"cannot set host with registry or opaque"
|
600
600
|
elsif parser.regexp[:HOST] !~ v
|
601
601
|
raise InvalidComponentError,
|
602
602
|
"bad component(expected host component): #{v}"
|
@@ -685,7 +685,7 @@ module Bundler::URI
|
|
685
685
|
|
686
686
|
if @opaque
|
687
687
|
raise InvalidURIError,
|
688
|
-
"
|
688
|
+
"cannot set port with registry or opaque"
|
689
689
|
elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
|
690
690
|
raise InvalidComponentError,
|
691
691
|
"bad component(expected port component): #{v.inspect}"
|
@@ -733,17 +733,17 @@ module Bundler::URI
|
|
733
733
|
end
|
734
734
|
|
735
735
|
def check_registry(v) # :nodoc:
|
736
|
-
raise InvalidURIError, "
|
736
|
+
raise InvalidURIError, "cannot set registry"
|
737
737
|
end
|
738
738
|
private :check_registry
|
739
739
|
|
740
740
|
def set_registry(v) #:nodoc:
|
741
|
-
raise InvalidURIError, "
|
741
|
+
raise InvalidURIError, "cannot set registry"
|
742
742
|
end
|
743
743
|
protected :set_registry
|
744
744
|
|
745
745
|
def registry=(v)
|
746
|
-
raise InvalidURIError, "
|
746
|
+
raise InvalidURIError, "cannot set registry"
|
747
747
|
end
|
748
748
|
|
749
749
|
#
|
@@ -866,7 +866,7 @@ module Bundler::URI
|
|
866
866
|
# hier_part = ( net_path | abs_path ) [ "?" query ]
|
867
867
|
if @host || @port || @user || @path # userinfo = @user + ':' + @password
|
868
868
|
raise InvalidURIError,
|
869
|
-
"
|
869
|
+
"cannot set opaque with host, port, userinfo or path"
|
870
870
|
elsif v && parser.regexp[:OPAQUE] !~ v
|
871
871
|
raise InvalidComponentError,
|
872
872
|
"bad component(expected opaque component): #{v}"
|
@@ -945,7 +945,7 @@ module Bundler::URI
|
|
945
945
|
# == Description
|
946
946
|
#
|
947
947
|
# Bundler::URI has components listed in order of decreasing significance from left to right,
|
948
|
-
# see RFC3986 https://
|
948
|
+
# see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3.
|
949
949
|
#
|
950
950
|
# == Usage
|
951
951
|
#
|
@@ -1235,7 +1235,7 @@ module Bundler::URI
|
|
1235
1235
|
return rel, rel
|
1236
1236
|
end
|
1237
1237
|
|
1238
|
-
# you can modify `rel', but
|
1238
|
+
# you can modify `rel', but cannot `oth'.
|
1239
1239
|
return oth, rel
|
1240
1240
|
end
|
1241
1241
|
private :route_from0
|
@@ -1260,7 +1260,7 @@ module Bundler::URI
|
|
1260
1260
|
# #=> #<Bundler::URI::Generic /main.rbx?page=1>
|
1261
1261
|
#
|
1262
1262
|
def route_from(oth)
|
1263
|
-
# you can modify `rel', but
|
1263
|
+
# you can modify `rel', but cannot `oth'.
|
1264
1264
|
begin
|
1265
1265
|
oth, rel = route_from0(oth)
|
1266
1266
|
rescue
|
@@ -1364,6 +1364,9 @@ module Bundler::URI
|
|
1364
1364
|
str << ':'
|
1365
1365
|
str << @port.to_s
|
1366
1366
|
end
|
1367
|
+
if (@host || @port) && !@path.empty? && !@path.start_with?('/')
|
1368
|
+
str << '/'
|
1369
|
+
end
|
1367
1370
|
str << @path
|
1368
1371
|
if @query
|
1369
1372
|
str << '?'
|
@@ -1399,19 +1402,6 @@ module Bundler::URI
|
|
1399
1402
|
self.component_ary.eql?(oth.component_ary)
|
1400
1403
|
end
|
1401
1404
|
|
1402
|
-
=begin
|
1403
|
-
|
1404
|
-
--- Bundler::URI::Generic#===(oth)
|
1405
|
-
|
1406
|
-
=end
|
1407
|
-
# def ===(oth)
|
1408
|
-
# raise NotImplementedError
|
1409
|
-
# end
|
1410
|
-
|
1411
|
-
=begin
|
1412
|
-
=end
|
1413
|
-
|
1414
|
-
|
1415
1405
|
# Returns an Array of the components defined from the COMPONENT Array.
|
1416
1406
|
def component_ary
|
1417
1407
|
component.collect do |x|
|
@@ -85,7 +85,7 @@ module Bundler::URI
|
|
85
85
|
# == Description
|
86
86
|
#
|
87
87
|
# Returns the authority for an HTTP uri, as defined in
|
88
|
-
# https://
|
88
|
+
# https://www.rfc-editor.org/rfc/rfc3986#section-3.2.
|
89
89
|
#
|
90
90
|
#
|
91
91
|
# Example:
|
@@ -106,7 +106,7 @@ module Bundler::URI
|
|
106
106
|
# == Description
|
107
107
|
#
|
108
108
|
# Returns the origin for an HTTP uri, as defined in
|
109
|
-
# https://
|
109
|
+
# https://www.rfc-editor.org/rfc/rfc6454.
|
110
110
|
#
|
111
111
|
#
|
112
112
|
# Example:
|
@@ -140,11 +140,11 @@ module Bundler::URI
|
|
140
140
|
|
141
141
|
if !scheme
|
142
142
|
raise InvalidURIError,
|
143
|
-
"bad Bundler::URI(absolute but no scheme): #{uri}"
|
143
|
+
"bad Bundler::URI (absolute but no scheme): #{uri}"
|
144
144
|
end
|
145
145
|
if !opaque && (!path && (!host && !registry))
|
146
146
|
raise InvalidURIError,
|
147
|
-
"bad Bundler::URI(absolute but no path): #{uri}"
|
147
|
+
"bad Bundler::URI (absolute but no path): #{uri}"
|
148
148
|
end
|
149
149
|
|
150
150
|
when @regexp[:REL_URI]
|
@@ -173,7 +173,7 @@ module Bundler::URI
|
|
173
173
|
# server = [ [ userinfo "@" ] hostport ]
|
174
174
|
|
175
175
|
else
|
176
|
-
raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri}"
|
176
|
+
raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri}"
|
177
177
|
end
|
178
178
|
|
179
179
|
path = '' if !path && !opaque # (see RFC2396 Section 5.2)
|
@@ -536,4 +536,11 @@ module Bundler::URI
|
|
536
536
|
end
|
537
537
|
|
538
538
|
end # class Parser
|
539
|
+
|
540
|
+
# Backward compatibility for Bundler::URI::REGEXP::PATTERN::*
|
541
|
+
RFC2396_Parser.new.pattern.each_pair do |sym, str|
|
542
|
+
unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false)
|
543
|
+
RFC2396_REGEXP::PATTERN.const_set(sym, str)
|
544
|
+
end
|
545
|
+
end
|
539
546
|
end # module Bundler::URI
|