!112 将power_assert组件inspector.rb模块中导入'io/console/size'设置为可选项
From: @tong_1001 Reviewed-by: @small_leek Signed-off-by: @small_leek
This commit is contained in:
commit
75a7afb52f
38
backport-Make-io-console-size-as-optional-dependency.patch
Normal file
38
backport-Make-io-console-size-as-optional-dependency.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 0b262057287952e4dbd5171bc958eaf709276b29 Mon Sep 17 00:00:00 2001
|
||||
From: Sutou Kouhei <kou@clear-code.com>
|
||||
Date: Tue, 11 Oct 2022 10:52:48 +0000
|
||||
Subject: [PATCH] Make `io/console/size` as optional dependency
|
||||
|
||||
Because `io/console` family is unavailable on WebAssembly and WASI due
|
||||
to missing termio APIs.
|
||||
---
|
||||
.../gems/power_assert-2.0.1/lib/power_assert/inspector.rb | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb b/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
||||
index 50bb646..6a4d8b6 100644
|
||||
--- a/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
||||
+++ b/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
||||
@@ -1,5 +1,8 @@
|
||||
require 'power_assert/configuration'
|
||||
-require 'io/console/size'
|
||||
+begin
|
||||
+ require 'io/console/size'
|
||||
+rescue LoadError
|
||||
+end
|
||||
|
||||
module PowerAssert
|
||||
class InspectedValue
|
||||
@@ -44,7 +47,8 @@ module PowerAssert
|
||||
def inspect
|
||||
if PowerAssert.configuration.colorize_message
|
||||
if PowerAssert.configuration.inspector == :pp
|
||||
- width = [IO.console_size[1] - 1 - @indent, 10].max
|
||||
+ console_width = IO.respond_to?(:console_size) ? IO.console_size[1] : 80
|
||||
+ width = [console_width - 1 - @indent, 10].max
|
||||
IRB::ColorPrinter.pp(@value, '', width)
|
||||
else
|
||||
IRB::Color.colorize_code(@value.to_s, ignore_error: true)
|
||||
--
|
||||
2.39.1
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
Name: ruby
|
||||
Version: %{ruby_version}
|
||||
Release: 132
|
||||
Release: 133
|
||||
Summary: Object-oriented scripting language interpreter
|
||||
License: (Ruby or BSD) and Public Domain and MIT and CC0 and zlib and UCD
|
||||
URL: https://www.ruby-lang.org/en/
|
||||
@ -88,6 +88,7 @@ Patch6007: backport-CVE-2019-16163.patch
|
||||
Patch6008: backport-Fix-test_cgi_cookie_new_with_domain-to-pass-on-older.patch
|
||||
Patch6009: backport-Loosen-the-domain-regex-to-accept-.-29.patch
|
||||
Patch6010: backport-irb-Drop-hard-dependency-on-RDoc.patch
|
||||
Patch6011: backport-Make-io-console-size-as-optional-dependency.patch
|
||||
|
||||
Provides: %{name}-libs = %{version}-%{release}
|
||||
Obsoletes: %{name}-libs < %{version}-%{release}
|
||||
@ -884,6 +885,9 @@ make runruby TESTRUN_SCRIPT=%{SOURCE13}
|
||||
%{gem_dir}/specifications/matrix-%{matrix_version}.gemspec
|
||||
|
||||
%changelog
|
||||
* Mon Mar 20 2023 shixuantong <shixuantong1@huawei.com> - 3.1.3-133
|
||||
- Make 'io/console/size' as optional dependency
|
||||
|
||||
* Mon Mar 13 2023 shixuantong <shixuantong1@huawei.com> - 3.1.3-132
|
||||
- ruby/irb Drop hard dependency on RDoc
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user