rubygems-update 3.2.34 → 3.3.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 +45 -4
- data/CONTRIBUTING.md +40 -10
- data/Manifest.txt +6 -5
- data/POLICIES.md +22 -8
- data/README.md +9 -7
- data/UPGRADING.md +5 -81
- data/bin/gem +1 -6
- data/bundler/CHANGELOG.md +27 -0
- data/bundler/exe/bundle +7 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +2 -0
- data/bundler/lib/bundler/cli.rb +5 -0
- data/bundler/lib/bundler/definition.rb +14 -2
- data/bundler/lib/bundler/dependency.rb +5 -7
- data/bundler/lib/bundler/dsl.rb +0 -27
- data/bundler/lib/bundler/endpoint_specification.rb +0 -8
- data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
- data/bundler/lib/bundler/fetcher.rb +2 -5
- data/bundler/lib/bundler/injector.rb +10 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +1 -6
- data/bundler/lib/bundler/installer.rb +1 -4
- data/bundler/lib/bundler/lockfile_parser.rb +10 -13
- data/bundler/lib/bundler/man/bundle-add.1 +9 -1
- data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/bundler/lib/bundler/man/bundle-config.1 +2 -2
- data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/man/gemfile.5.ronn +1 -1
- data/bundler/lib/bundler/plugin/installer.rb +1 -1
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/psyched_yaml.rb +1 -13
- data/bundler/lib/bundler/resolver.rb +34 -29
- data/bundler/lib/bundler/rubygems_ext.rb +2 -0
- data/bundler/lib/bundler/rubygems_integration.rb +11 -48
- data/bundler/lib/bundler/self_manager.rb +73 -0
- data/bundler/lib/bundler/shared_helpers.rb +2 -9
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/gems.rb +0 -3
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/bundler/lib/bundler/ui/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +2 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +4 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -19
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +4 -22
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +9 -3
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/command_manager.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +5 -2
- data/lib/rubygems/commands/server_command.rb +14 -77
- data/lib/rubygems/commands/setup_command.rb +4 -16
- data/lib/rubygems/commands/update_command.rb +9 -4
- data/lib/rubygems/defaults.rb +2 -20
- data/lib/rubygems/deprecate.rb +55 -8
- data/lib/rubygems/exceptions.rb +26 -1
- data/lib/rubygems/ext/builder.rb +5 -3
- data/lib/rubygems/install_update_options.rb +11 -2
- data/lib/rubygems/installer.rb +11 -1
- data/lib/rubygems/name_tuple.rb +2 -3
- data/lib/rubygems/path_support.rb +1 -6
- data/lib/rubygems/platform.rb +4 -0
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/security.rb +4 -3
- data/lib/rubygems/source.rb +3 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +9 -13
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/version.rb +2 -0
- data/lib/rubygems.rb +3 -3
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -6
- data/test/rubygems/helper.rb +20 -6
- data/test/rubygems/test_config.rb +2 -2
- data/test/rubygems/test_exit.rb +11 -0
- data/test/rubygems/test_gem.rb +46 -41
- data/test/rubygems/test_gem_command_manager.rb +16 -27
- data/test/rubygems/test_gem_commands_open_command.rb +1 -1
- data/test/rubygems/test_gem_commands_server_command.rb +4 -46
- data/test/rubygems/test_gem_commands_update_command.rb +2 -2
- data/test/rubygems/test_gem_path_support.rb +2 -6
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -0
- data/test/rubygems/test_gem_requirement.rb +0 -1
- data/test/rubygems/test_gem_security.rb +1 -1
- data/test/rubygems/test_gem_source_git.rb +0 -5
- data/test/rubygems/test_gem_specification.rb +16 -25
- data/test/rubygems/test_gem_text.rb +6 -0
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_require.rb +0 -7
- metadata +9 -8
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/lib/rubygems/server.rb +0 -882
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/test_gem_server.rb +0 -608
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
#
|
5
|
+
# This class handles installing and switching to the version of bundler needed
|
6
|
+
# by an application.
|
7
|
+
#
|
8
|
+
class SelfManager
|
9
|
+
def restart_with_locked_bundler_if_needed
|
10
|
+
return unless needs_switching? && installed?
|
11
|
+
|
12
|
+
restart_with_locked_bundler
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_locked_bundler_and_restart_with_it_if_needed
|
16
|
+
return unless needs_switching?
|
17
|
+
|
18
|
+
Bundler.ui.info \
|
19
|
+
"Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
|
20
|
+
"Installing Bundler #{lockfile_version} and restarting using that version."
|
21
|
+
|
22
|
+
install_and_restart_with_locked_bundler
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def install_and_restart_with_locked_bundler
|
28
|
+
bundler_dep = Gem::Dependency.new("bundler", lockfile_version)
|
29
|
+
|
30
|
+
Gem.install(bundler_dep)
|
31
|
+
rescue StandardError => e
|
32
|
+
Bundler.ui.trace e
|
33
|
+
Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
|
34
|
+
else
|
35
|
+
restart_with_locked_bundler
|
36
|
+
end
|
37
|
+
|
38
|
+
def restart_with_locked_bundler
|
39
|
+
configured_gem_home = ENV["GEM_HOME"]
|
40
|
+
configured_gem_path = ENV["GEM_PATH"]
|
41
|
+
|
42
|
+
Bundler.with_original_env do
|
43
|
+
Kernel.exec(
|
44
|
+
{ "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
|
45
|
+
$PROGRAM_NAME, *ARGV
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def needs_switching?
|
51
|
+
ENV["BUNDLER_VERSION"].nil? &&
|
52
|
+
Bundler.rubygems.supports_bundler_trampolining? &&
|
53
|
+
SharedHelpers.in_bundle? &&
|
54
|
+
lockfile_version &&
|
55
|
+
!lockfile_version.end_with?(".dev") &&
|
56
|
+
lockfile_version != current_version
|
57
|
+
end
|
58
|
+
|
59
|
+
def installed?
|
60
|
+
Bundler.configure
|
61
|
+
|
62
|
+
Bundler.rubygems.find_bundler(lockfile_version)
|
63
|
+
end
|
64
|
+
|
65
|
+
def current_version
|
66
|
+
@current_version ||= Bundler::VERSION
|
67
|
+
end
|
68
|
+
|
69
|
+
def lockfile_version
|
70
|
+
@lockfile_version ||= Bundler::LockfileParser.bundled_with
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -109,7 +109,7 @@ module Bundler
|
|
109
109
|
raise VirtualProtocolError.new
|
110
110
|
rescue Errno::ENOSPC
|
111
111
|
raise NoSpaceOnDeviceError.new(path, action)
|
112
|
-
rescue
|
112
|
+
rescue Errno::ENOTSUP
|
113
113
|
raise OperationNotSupportedError.new(path, action)
|
114
114
|
rescue Errno::EEXIST, Errno::ENOENT
|
115
115
|
raise
|
@@ -117,13 +117,6 @@ module Bundler
|
|
117
117
|
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
|
118
118
|
end
|
119
119
|
|
120
|
-
def const_get_safely(constant_name, namespace)
|
121
|
-
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
|
122
|
-
namespace.constants.include?(constant_name.to_sym)
|
123
|
-
return nil unless const_in_namespace
|
124
|
-
namespace.const_get(constant_name)
|
125
|
-
end
|
126
|
-
|
127
120
|
def major_deprecation(major_version, message, print_caller_location: false)
|
128
121
|
if print_caller_location
|
129
122
|
caller_location = caller_locations(2, 2).first
|
@@ -246,7 +239,7 @@ module Bundler
|
|
246
239
|
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
247
240
|
|
248
241
|
until !File.directory?(current) || current == previous
|
249
|
-
if ENV["
|
242
|
+
if ENV["BUNDLER_SPEC_RUN"]
|
250
243
|
# avoid stepping above the tmp directory when testing
|
251
244
|
gemspec = if ENV["GEM_COMMAND"]
|
252
245
|
# for Ruby Core
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
s.loaded_from = File.expand_path("..", __FILE__)
|
26
26
|
end
|
27
27
|
|
28
|
-
if local_spec = Bundler.rubygems.
|
28
|
+
if local_spec = Bundler.rubygems.find_bundler(VERSION)
|
29
29
|
idx << local_spec
|
30
30
|
end
|
31
31
|
|
@@ -73,7 +73,7 @@ m = Module.new do
|
|
73
73
|
|
74
74
|
requirement = bundler_gem_version.approximate_recommendation
|
75
75
|
|
76
|
-
return requirement unless Gem
|
76
|
+
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
|
77
77
|
|
78
78
|
requirement += ".a" if bundler_gem_version.prerelease?
|
79
79
|
|
@@ -3,7 +3,16 @@
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
<% default_task_names = [config[:test_task]].compact -%>
|
5
5
|
<% case config[:test] -%>
|
6
|
-
<% when "minitest"
|
6
|
+
<% when "minitest" -%>
|
7
|
+
require "rake/testtask"
|
8
|
+
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << "test"
|
11
|
+
t.libs << "lib"
|
12
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
13
|
+
end
|
14
|
+
|
15
|
+
<% when "test-unit" -%>
|
7
16
|
require "rake/testtask"
|
8
17
|
|
9
18
|
Rake::TestTask.new(:test) do |t|
|
@@ -39,6 +39,6 @@ Gem::Specification.new do |spec|
|
|
39
39
|
# Uncomment to register a new dependency of your gem
|
40
40
|
# spec.add_dependency "example-gem", "~> 1.0"
|
41
41
|
|
42
|
-
# For more information and examples about making a new gem,
|
42
|
+
# For more information and examples about making a new gem, check out our
|
43
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
44
44
|
end
|
@@ -210,9 +210,9 @@ class Bundler::Thor
|
|
210
210
|
#
|
211
211
|
# ==== Examples
|
212
212
|
#
|
213
|
-
# inject_into_class "app/controllers/application_controller.rb",
|
213
|
+
# inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
|
214
214
|
#
|
215
|
-
# inject_into_class "app/controllers/application_controller.rb",
|
215
|
+
# inject_into_class "app/controllers/application_controller.rb", ApplicationController do
|
216
216
|
# " filter_parameter :password\n"
|
217
217
|
# end
|
218
218
|
#
|
@@ -233,9 +233,9 @@ class Bundler::Thor
|
|
233
233
|
#
|
234
234
|
# ==== Examples
|
235
235
|
#
|
236
|
-
# inject_into_module "app/helpers/application_helper.rb",
|
236
|
+
# inject_into_module "app/helpers/application_helper.rb", ApplicationHelper, " def help; 'help'; end\n"
|
237
237
|
#
|
238
|
-
# inject_into_module "app/helpers/application_helper.rb",
|
238
|
+
# inject_into_module "app/helpers/application_helper.rb", ApplicationHelper do
|
239
239
|
# " def help; 'help'; end\n"
|
240
240
|
# end
|
241
241
|
#
|
@@ -252,7 +252,7 @@ class Bundler::Thor
|
|
252
252
|
# flag<Regexp|String>:: the regexp or string to be replaced
|
253
253
|
# replacement<String>:: the replacement, can be also given as a block
|
254
254
|
# config<Hash>:: give :verbose => false to not log the status, and
|
255
|
-
# :force => true, to force the replacement
|
255
|
+
# :force => true, to force the replacement regardless of runner behavior.
|
256
256
|
#
|
257
257
|
# ==== Example
|
258
258
|
#
|
@@ -331,7 +331,7 @@ class Bundler::Thor
|
|
331
331
|
path = File.expand_path(path, destination_root)
|
332
332
|
|
333
333
|
say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
334
|
-
if !options[:pretend] &&
|
334
|
+
if !options[:pretend] && File.exist?(path)
|
335
335
|
require "fileutils"
|
336
336
|
::FileUtils.rm_rf(path)
|
337
337
|
end
|
@@ -106,11 +106,12 @@ class Bundler::Thor
|
|
106
106
|
# Adds the content to the file.
|
107
107
|
#
|
108
108
|
def replace!(regexp, string, force)
|
109
|
+
return if pretend?
|
109
110
|
content = File.read(destination)
|
110
111
|
if force || !content.include?(replacement)
|
111
112
|
success = content.gsub!(regexp, string)
|
112
113
|
|
113
|
-
File.open(destination, "wb") { |file| file.write(content) }
|
114
|
+
File.open(destination, "wb") { |file| file.write(content) }
|
114
115
|
success
|
115
116
|
end
|
116
117
|
end
|
@@ -161,8 +161,6 @@ class Bundler::Thor
|
|
161
161
|
# to the block you provide. The path is set back to the previous path when
|
162
162
|
# the method exits.
|
163
163
|
#
|
164
|
-
# Returns the value yielded by the block.
|
165
|
-
#
|
166
164
|
# ==== Parameters
|
167
165
|
# dir<String>:: the directory to move to.
|
168
166
|
# config<Hash>:: give :verbose => true to log and use padding.
|
@@ -181,18 +179,16 @@ class Bundler::Thor
|
|
181
179
|
FileUtils.mkdir_p(destination_root)
|
182
180
|
end
|
183
181
|
|
184
|
-
result = nil
|
185
182
|
if pretend
|
186
183
|
# In pretend mode, just yield down to the block
|
187
|
-
|
184
|
+
block.arity == 1 ? yield(destination_root) : yield
|
188
185
|
else
|
189
186
|
require "fileutils"
|
190
|
-
FileUtils.cd(destination_root) {
|
187
|
+
FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield }
|
191
188
|
end
|
192
189
|
|
193
190
|
@destination_stack.pop
|
194
191
|
shell.padding -= 1 if verbose
|
195
|
-
result
|
196
192
|
end
|
197
193
|
|
198
194
|
# Goes to the root and execute the given block.
|
@@ -102,14 +102,9 @@ class Bundler::Thor
|
|
102
102
|
end
|
103
103
|
|
104
104
|
if Correctable
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
DidYouMean::SPELL_CHECKERS.merge!(
|
110
|
-
'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
|
111
|
-
'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
|
112
|
-
)
|
113
|
-
end
|
105
|
+
DidYouMean::SPELL_CHECKERS.merge!(
|
106
|
+
'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
|
107
|
+
'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
|
108
|
+
)
|
114
109
|
end
|
115
110
|
end
|
@@ -45,7 +45,6 @@ class Bundler::Thor
|
|
45
45
|
@switches = {}
|
46
46
|
@extra = []
|
47
47
|
@stopped_parsing_after_extra_index = nil
|
48
|
-
@is_treated_as_value = false
|
49
48
|
|
50
49
|
options.each do |option|
|
51
50
|
@switches[option.switch_name] = option
|
@@ -75,19 +74,8 @@ class Bundler::Thor
|
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
78
|
-
def shift
|
79
|
-
@is_treated_as_value = false
|
80
|
-
super
|
81
|
-
end
|
82
|
-
|
83
|
-
def unshift(arg, is_value: false)
|
84
|
-
@is_treated_as_value = is_value
|
85
|
-
super(arg)
|
86
|
-
end
|
87
|
-
|
88
77
|
def parse(args) # rubocop:disable MethodLength
|
89
78
|
@pile = args.dup
|
90
|
-
@is_treated_as_value = false
|
91
79
|
@parsing_options = true
|
92
80
|
|
93
81
|
while peek
|
@@ -100,10 +88,7 @@ class Bundler::Thor
|
|
100
88
|
when SHORT_SQ_RE
|
101
89
|
unshift($1.split("").map { |f| "-#{f}" })
|
102
90
|
next
|
103
|
-
when EQ_RE
|
104
|
-
unshift($2, is_value: true)
|
105
|
-
switch = $1
|
106
|
-
when SHORT_NUM
|
91
|
+
when EQ_RE, SHORT_NUM
|
107
92
|
unshift($2)
|
108
93
|
switch = $1
|
109
94
|
when LONG_RE, SHORT_RE
|
@@ -163,7 +148,6 @@ class Bundler::Thor
|
|
163
148
|
# Two booleans are returned. The first is true if the current value
|
164
149
|
# starts with a hyphen; the second is true if it is a registered switch.
|
165
150
|
def current_is_switch?
|
166
|
-
return [false, false] if @is_treated_as_value
|
167
151
|
case peek
|
168
152
|
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
|
169
153
|
[true, switch?($1)]
|
@@ -175,7 +159,6 @@ class Bundler::Thor
|
|
175
159
|
end
|
176
160
|
|
177
161
|
def current_is_switch_formatted?
|
178
|
-
return false if @is_treated_as_value
|
179
162
|
case peek
|
180
163
|
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE
|
181
164
|
true
|
@@ -185,7 +168,6 @@ class Bundler::Thor
|
|
185
168
|
end
|
186
169
|
|
187
170
|
def current_is_value?
|
188
|
-
return true if @is_treated_as_value
|
189
171
|
peek && (!parsing_options? || super)
|
190
172
|
end
|
191
173
|
|
@@ -103,23 +103,6 @@ class Bundler::Thor
|
|
103
103
|
stdout.flush
|
104
104
|
end
|
105
105
|
|
106
|
-
# Say (print) an error to the user. If the sentence ends with a whitespace
|
107
|
-
# or tab character, a new line is not appended (print + flush). Otherwise
|
108
|
-
# are passed straight to puts (behavior got from Highline).
|
109
|
-
#
|
110
|
-
# ==== Example
|
111
|
-
# say_error("error: something went wrong")
|
112
|
-
#
|
113
|
-
def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
114
|
-
return if quiet?
|
115
|
-
|
116
|
-
buffer = prepare_message(message, *color)
|
117
|
-
buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
|
118
|
-
|
119
|
-
stderr.print(buffer)
|
120
|
-
stderr.flush
|
121
|
-
end
|
122
|
-
|
123
106
|
# Say a status with the given color and appends the message. Since this
|
124
107
|
# method is used frequently by actions, it allows nil or false to be given
|
125
108
|
# in log_status, avoiding the message from being shown. If a Symbol is
|
@@ -128,14 +111,13 @@ class Bundler::Thor
|
|
128
111
|
def say_status(status, message, log_status = true)
|
129
112
|
return if quiet? || log_status == false
|
130
113
|
spaces = " " * (padding + 1)
|
131
|
-
status = status.to_s.rjust(12)
|
132
|
-
margin = " " * status.length + spaces
|
133
|
-
|
134
114
|
color = log_status.is_a?(Symbol) ? log_status : :green
|
115
|
+
|
116
|
+
status = status.to_s.rjust(12)
|
135
117
|
status = set_color status, color, true if color
|
136
118
|
|
137
|
-
|
138
|
-
buffer = "#{
|
119
|
+
buffer = "#{status}#{spaces}#{message}"
|
120
|
+
buffer = "#{buffer}\n" unless buffer.end_with?("\n")
|
139
121
|
|
140
122
|
stdout.print(buffer)
|
141
123
|
stdout.flush
|
@@ -21,7 +21,7 @@ class Bundler::Thor
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module Shell
|
24
|
-
SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :
|
24
|
+
SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
|
25
25
|
attr_writer :shell
|
26
26
|
|
27
27
|
autoload :Basic, File.expand_path("shell/basic", __dir__)
|
@@ -211,7 +211,7 @@ class Bundler::Thor
|
|
211
211
|
#
|
212
212
|
def globs_for(path)
|
213
213
|
path = escape_globs(path)
|
214
|
-
["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks
|
214
|
+
["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"]
|
215
215
|
end
|
216
216
|
|
217
217
|
# Return the path to the ruby interpreter taking into account multiple
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# = uri/common.rb
|
4
4
|
#
|
5
5
|
# Author:: Akira Yamada <akira@ruby-lang.org>
|
6
|
-
# Revision:: $Id$
|
7
6
|
# License::
|
8
7
|
# You can redistribute it and/or modify it under the same term as Ruby.
|
9
8
|
#
|
@@ -61,82 +60,6 @@ module Bundler::URI
|
|
61
60
|
module_function :make_components_hash
|
62
61
|
end
|
63
62
|
|
64
|
-
# Module for escaping unsafe characters with codes.
|
65
|
-
module Escape
|
66
|
-
#
|
67
|
-
# == Synopsis
|
68
|
-
#
|
69
|
-
# Bundler::URI.escape(str [, unsafe])
|
70
|
-
#
|
71
|
-
# == Args
|
72
|
-
#
|
73
|
-
# +str+::
|
74
|
-
# String to replaces in.
|
75
|
-
# +unsafe+::
|
76
|
-
# Regexp that matches all symbols that must be replaced with codes.
|
77
|
-
# By default uses <tt>UNSAFE</tt>.
|
78
|
-
# When this argument is a String, it represents a character set.
|
79
|
-
#
|
80
|
-
# == Description
|
81
|
-
#
|
82
|
-
# Escapes the string, replacing all unsafe characters with codes.
|
83
|
-
#
|
84
|
-
# This method is obsolete and should not be used. Instead, use
|
85
|
-
# CGI.escape, Bundler::URI.encode_www_form or Bundler::URI.encode_www_form_component
|
86
|
-
# depending on your specific use case.
|
87
|
-
#
|
88
|
-
# == Usage
|
89
|
-
#
|
90
|
-
# require 'bundler/vendor/uri/lib/uri'
|
91
|
-
#
|
92
|
-
# enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
|
93
|
-
# # => "http://example.com/?a=%09%0D"
|
94
|
-
#
|
95
|
-
# Bundler::URI.unescape(enc_uri)
|
96
|
-
# # => "http://example.com/?a=\t\r"
|
97
|
-
#
|
98
|
-
# Bundler::URI.escape("@?@!", "!?")
|
99
|
-
# # => "@%3F@%21"
|
100
|
-
#
|
101
|
-
def escape(*arg)
|
102
|
-
warn "Bundler::URI.escape is obsolete", uplevel: 1
|
103
|
-
DEFAULT_PARSER.escape(*arg)
|
104
|
-
end
|
105
|
-
alias encode escape
|
106
|
-
#
|
107
|
-
# == Synopsis
|
108
|
-
#
|
109
|
-
# Bundler::URI.unescape(str)
|
110
|
-
#
|
111
|
-
# == Args
|
112
|
-
#
|
113
|
-
# +str+::
|
114
|
-
# String to unescape.
|
115
|
-
#
|
116
|
-
# == Description
|
117
|
-
#
|
118
|
-
# This method is obsolete and should not be used. Instead, use
|
119
|
-
# CGI.unescape, Bundler::URI.decode_www_form or Bundler::URI.decode_www_form_component
|
120
|
-
# depending on your specific use case.
|
121
|
-
#
|
122
|
-
# == Usage
|
123
|
-
#
|
124
|
-
# require 'bundler/vendor/uri/lib/uri'
|
125
|
-
#
|
126
|
-
# enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
|
127
|
-
# # => "http://example.com/?a=%09%0D"
|
128
|
-
#
|
129
|
-
# Bundler::URI.unescape(enc_uri)
|
130
|
-
# # => "http://example.com/?a=\t\r"
|
131
|
-
#
|
132
|
-
def unescape(*arg)
|
133
|
-
warn "Bundler::URI.unescape is obsolete", uplevel: 1
|
134
|
-
DEFAULT_PARSER.unescape(*arg)
|
135
|
-
end
|
136
|
-
alias decode unescape
|
137
|
-
end # module Escape
|
138
|
-
|
139
|
-
extend Escape
|
140
63
|
include REGEXP
|
141
64
|
|
142
65
|
@@schemes = {}
|
@@ -145,6 +68,20 @@ module Bundler::URI
|
|
145
68
|
@@schemes
|
146
69
|
end
|
147
70
|
|
71
|
+
#
|
72
|
+
# Construct a Bundler::URI instance, using the scheme to detect the appropriate class
|
73
|
+
# from +Bundler::URI.scheme_list+.
|
74
|
+
#
|
75
|
+
def self.for(scheme, *arguments, default: Generic)
|
76
|
+
if scheme
|
77
|
+
uri_class = @@schemes[scheme.upcase] || default
|
78
|
+
else
|
79
|
+
uri_class = default
|
80
|
+
end
|
81
|
+
|
82
|
+
return uri_class.new(scheme, *arguments)
|
83
|
+
end
|
84
|
+
|
148
85
|
#
|
149
86
|
# Base class for all Bundler::URI exceptions.
|
150
87
|
#
|
@@ -315,7 +252,7 @@ module Bundler::URI
|
|
315
252
|
#
|
316
253
|
# Returns a Regexp object which matches to Bundler::URI-like strings.
|
317
254
|
# The Regexp object returned by this method includes arbitrary
|
318
|
-
# number of capture group (parentheses). Never rely on
|
255
|
+
# number of capture group (parentheses). Never rely on its number.
|
319
256
|
#
|
320
257
|
# == Usage
|
321
258
|
#
|
@@ -362,7 +299,7 @@ module Bundler::URI
|
|
362
299
|
# If +enc+ is given, convert +str+ to the encoding before percent encoding.
|
363
300
|
#
|
364
301
|
# This is an implementation of
|
365
|
-
#
|
302
|
+
# https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
|
366
303
|
#
|
367
304
|
# See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
|
368
305
|
def self.encode_www_form_component(str, enc=nil)
|
@@ -403,7 +340,7 @@ module Bundler::URI
|
|
403
340
|
# This method doesn't handle files. When you send a file, use
|
404
341
|
# multipart/form-data.
|
405
342
|
#
|
406
|
-
# This refers
|
343
|
+
# This refers https://url.spec.whatwg.org/#concept-urlencoded-serializer
|
407
344
|
#
|
408
345
|
# Bundler::URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
|
409
346
|
# #=> "q=ruby&lang=en"
|
@@ -4,7 +4,6 @@
|
|
4
4
|
#
|
5
5
|
# Author:: Akira Yamada <akira@ruby-lang.org>
|
6
6
|
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
7
|
-
# Revision:: $Id$
|
8
7
|
#
|
9
8
|
# See Bundler::URI for general documentation
|
10
9
|
#
|
@@ -1098,7 +1097,7 @@ module Bundler::URI
|
|
1098
1097
|
# # => "http://my.example.com/main.rbx?page=1"
|
1099
1098
|
#
|
1100
1099
|
def merge(oth)
|
1101
|
-
rel = parser.
|
1100
|
+
rel = parser.__send__(:convert_to_uri, oth)
|
1102
1101
|
|
1103
1102
|
if rel.absolute?
|
1104
1103
|
#raise BadURIError, "both Bundler::URI are absolute" if absolute?
|
@@ -1183,7 +1182,7 @@ module Bundler::URI
|
|
1183
1182
|
|
1184
1183
|
# :stopdoc:
|
1185
1184
|
def route_from0(oth)
|
1186
|
-
oth = parser.
|
1185
|
+
oth = parser.__send__(:convert_to_uri, oth)
|
1187
1186
|
if self.relative?
|
1188
1187
|
raise BadURIError,
|
1189
1188
|
"relative Bundler::URI: #{self}"
|
@@ -1291,7 +1290,7 @@ module Bundler::URI
|
|
1291
1290
|
# #=> #<Bundler::URI::Generic /main.rbx?page=1>
|
1292
1291
|
#
|
1293
1292
|
def route_to(oth)
|
1294
|
-
parser.
|
1293
|
+
parser.__send__(:convert_to_uri, oth).route_from(self)
|
1295
1294
|
end
|
1296
1295
|
|
1297
1296
|
#
|
@@ -1405,7 +1404,7 @@ module Bundler::URI
|
|
1405
1404
|
# Returns an Array of the components defined from the COMPONENT Array.
|
1406
1405
|
def component_ary
|
1407
1406
|
component.collect do |x|
|
1408
|
-
self.
|
1407
|
+
self.__send__(x)
|
1409
1408
|
end
|
1410
1409
|
end
|
1411
1410
|
protected :component_ary
|
@@ -1430,7 +1429,7 @@ module Bundler::URI
|
|
1430
1429
|
def select(*components)
|
1431
1430
|
components.collect do |c|
|
1432
1431
|
if component.include?(c)
|
1433
|
-
self.
|
1432
|
+
self.__send__(c)
|
1434
1433
|
else
|
1435
1434
|
raise ArgumentError,
|
1436
1435
|
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
|