!2 fix check failed

From: @lyn1001 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2022-02-22 02:50:37 +00:00 committed by Gitee
commit dcd8a592b8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 269 additions and 2 deletions

View File

@ -0,0 +1,148 @@
From 33222dbc543b600c91621770f34d62cd81903c32 Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Thu, 30 May 2019 17:24:05 +0200
Subject: [PATCH] Replace problematic AnsiColor module with simple
implementation
Backport from master
---
lib/aruba/colorizer.rb | 109 +++----------------------------
lib/aruba/platforms/announcer.rb | 2 +-
2 files changed, 11 insertions(+), 100 deletions(-)
diff --git a/lib/aruba/colorizer.rb b/lib/aruba/colorizer.rb
index 2db79c710..fc479c68d 100644
--- a/lib/aruba/colorizer.rb
+++ b/lib/aruba/colorizer.rb
@@ -1,108 +1,19 @@
+# Aruba
module Aruba
- # The ANSIColor module can be used for namespacing and mixed into your own
- # classes.
- module AnsiColor
- # :stopdoc:
- ATTRIBUTES = [
- [ :clear , 0 ],
- [ :reset , 0 ], # synonym for :clear
- [ :bold , 1 ],
- [ :dark , 2 ],
- [ :italic , 3 ], # not widely implemented
- [ :underline , 4 ],
- [ :underscore , 4 ], # synonym for :underline
- [ :blink , 5 ],
- [ :rapid_blink , 6 ], # not widely implemented
- [ :negative , 7 ], # no reverse because of String#reverse
- [ :concealed , 8 ],
- [ :strikethrough, 9 ], # not widely implemented
- [ :black , 30 ],
- [ :red , 31 ],
- [ :green , 32 ],
- [ :yellow , 33 ],
- [ :blue , 34 ],
- [ :magenta , 35 ],
- [ :cyan , 36 ],
- [ :white , 37 ],
- [ :on_black , 40 ],
- [ :on_red , 41 ],
- [ :on_green , 42 ],
- [ :on_yellow , 43 ],
- [ :on_blue , 44 ],
- [ :on_magenta , 45 ],
- [ :on_cyan , 46 ],
- [ :on_white , 47 ]
- ].freeze
-
- ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
- # :startdoc:
-
- # Returns true, if the coloring function of this module
- # is switched on, false otherwise.
- def self.coloring?
- @coloring
- end
-
- # Turns the coloring on or off globally, so you can easily do
- # this for example:
- # Cucumber::Term::ANSIColor::coloring = STDOUT.isatty
- def self.coloring=(val)
- @coloring = val
- end
- self.coloring = true
-
- ATTRIBUTES.each do |c, v|
- define_method(c) do |string|
- result = ''
- result << "\e[#{v}m" if Aruba::AnsiColor.coloring?
- if block_given?
- result << yield
- elsif string
- result << string
- elsif respond_to?(:to_str)
- result << to_str
- else
- return result #only switch on
- end
- result << "\e[0m" if Aruba::AnsiColor.coloring?
- result
- end
- end
-
- # Regular expression that is used to scan for ANSI-sequences while
- # uncoloring strings.
- COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/
+ # Simple colorizer class. Only supports the color cyan
+ class Colorizer
+ class << self
+ attr_accessor :coloring
- def self.included(klass)
- if klass == String
- ATTRIBUTES.delete(:clear)
- ATTRIBUTE_NAMES.delete(:clear)
- end
+ alias coloring? coloring
end
- # Returns an uncolored version of the string, that is all
- # ANSI-sequences are stripped from the string.
- def uncolored(string = nil) # :yields:
- if block_given?
- yield.gsub(COLORED_REGEXP, '')
- elsif string
- string.gsub(COLORED_REGEXP, '')
- elsif respond_to?(:to_str)
- to_str.gsub(COLORED_REGEXP, '')
+ def cyan(string)
+ if self.class.coloring?
+ "\e[36m#{string}\e[0m"
else
- ''
+ string
end
end
-
- # Returns an array of all Aruba::Platforms::AnsiColor attributes as symbols.
- def attributes
- ATTRIBUTE_NAMES
- end
- end
-end
-
-module Aruba
- class Colorizer
- include Aruba::AnsiColor
end
end
diff --git a/lib/aruba/platforms/announcer.rb b/lib/aruba/platforms/announcer.rb
index 9b6a65b43..778b56115 100644
--- a/lib/aruba/platforms/announcer.rb
+++ b/lib/aruba/platforms/announcer.rb
@@ -1,7 +1,7 @@
require 'shellwords'
require 'aruba/colorizer'
-Aruba::AnsiColor.coloring = false if !STDOUT.tty? && !ENV.key?("AUTOTEST")
+Aruba::Colorizer.coloring = false if !STDOUT.tty? && !ENV.key?("AUTOTEST")
# Aruba
module Aruba

View File

@ -0,0 +1,112 @@
From 6ef7ea6be0d395868b4cf055b9470f9a8cf7a909 Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Sat, 28 Dec 2019 09:58:55 +0100
Subject: [PATCH 1/4] Silence keyword argument warnings on Ruby 2.7
---
lib/aruba/platforms/unix_platform.rb | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb
index a656130ce..f3bb76767 100644
--- a/lib/aruba/platforms/unix_platform.rb
+++ b/lib/aruba/platforms/unix_platform.rb
@@ -125,7 +125,8 @@ def mkdir(dir_name)
def rm(paths, options = {})
paths = Array(paths).map { |p| ::File.expand_path(p) }
- FileUtils.rm_r(paths, options)
+ FileUtils.rm_r(paths, :force => options[:force], :noop => options[:noop],
+ :verbose => options[:verbose], :secure => options[:secure])
end
# Get current working directory
@@ -144,7 +145,8 @@ def chdir(dir_name, &block)
# Touch file, directory
def touch(args, options)
- FileUtils.touch(args, options)
+ FileUtils.touch(args, :noop => options[:noop], :verbose => options[:verbose],
+ :mtime => options[:mtime], :nocreate => options[:nocreate])
end
# Copy file/directory
@@ -159,7 +161,8 @@ def mv(args, options)
# Change mode of file/directory
def chmod(mode, args, options)
- FileUtils.chmod_R(mode, args, options)
+ FileUtils.chmod_R(mode, args, :noop => options[:noop],
+ :verbose => options[:verbose], :force => options[:force])
end
# Exists and is file
From c37c40ad626ae1e17b01ca86b7c31e515a7a5a9f Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Sat, 28 Dec 2019 15:22:05 +0100
Subject: [PATCH 2/4] Clarify method parameter names
---
lib/aruba/platforms/unix_platform.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb
index f3bb76767..ccfd8434c 100644
--- a/lib/aruba/platforms/unix_platform.rb
+++ b/lib/aruba/platforms/unix_platform.rb
@@ -150,13 +150,13 @@ def touch(args, options)
end
# Copy file/directory
- def cp(args, options)
- FileUtils.cp_r(args, options)
+ def cp(src, dest)
+ FileUtils.cp_r(src, dest)
end
# Move file/directory
- def mv(args, options)
- FileUtils.mv(args, options)
+ def mv(src, dest)
+ FileUtils.mv(src, dest)
end
# Change mode of file/directory
From d0076164a85e41ada00fed71740a44448692a9ee Mon Sep 17 00:00:00 2001
From: Matijs van Zuijlen <matijs@matijs.net>
Date: Sat, 28 Dec 2019 15:10:58 +0100
Subject: [PATCH 3/4] Update scenario to pass on Ruby 2.7
When running under childprocess, IRB does not activate readline. This
means history is not collected and the history file is empty if saved.
In Ruby 2.7, the file is not even written to. This means saving the
history file cannot properly be tested on Ruby 2.7 using Aruba. Instead,
we check that the correct file is configured in IRB, and just assume IRB
will do the right thing with it.
---
features/cli/console.feature | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/features/cli/console.feature b/features/cli/console.feature
index 88f95dc99..b79a3a827 100644
--- a/features/cli/console.feature
+++ b/features/cli/console.feature
@@ -44,9 +44,12 @@ Feature: Aruba Console
"""
@unsupported-on-platform-java
- Scenario: Has history
+ Scenario: Has its own history file
Given I run `aruba console` interactively
- And I type "aruba_methods"
+ And I type "IRB.conf[:HISTORY_FILE]"
And I type "exit"
When I close the stdin stream
- Then the file "~/.aruba_history" should exist
+ Then the output should contain:
+ """
+ ~/.aruba_history
+ """

View File

@ -2,14 +2,16 @@
Summary: CLI Steps for Cucumber, hand-crafted for you in Aruba Summary: CLI Steps for Cucumber, hand-crafted for you in Aruba
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 0.14.9 Version: 0.14.9
Release: 1 Release: 2
License: MIT License: MIT
URL: https://github.com/cucumber/aruba URL: https://github.com/cucumber/aruba
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
Patch0: Replace-problematic-AnsiColor-module-with-simple.patch
Patch1: Silence-keyword-argument-warnings-on-Ruby-2.7.patch
BuildRequires: ruby(release) rubygems-devel ruby rubygem(cucumber) >= 1.3.19 BuildRequires: ruby(release) rubygems-devel ruby rubygem(cucumber) >= 1.3.19
BuildRequires: rubygem(childprocess) >= 0.5.6 rubygem(ffi) >= 1.9.10 rubygem(minitest) BuildRequires: rubygem(childprocess) >= 0.5.6 rubygem(ffi) >= 1.9.10 rubygem(minitest)
BuildRequires: rubygem(pry) rubygem(rspec) >= 3 rubygem(contracts) >= 0.9 BuildRequires: rubygem(pry) rubygem(rspec) >= 3 rubygem(contracts) >= 0.9
BuildRequires: rubygem(thor) >= 0.19 /usr/bin/python3 BuildRequires: rubygem(thor) >= 0.19 /usr/bin/python3 ruby-irb
BuildArch: noarch BuildArch: noarch
%description %description
Aruba is Cucumber extension for Command line applications written Aruba is Cucumber extension for Command line applications written
@ -25,6 +27,8 @@ Documentation for %{name}
%prep %prep
%setup -q -n %{gem_name}-%{version} %setup -q -n %{gem_name}-%{version}
%gemspec_remove_dep -g childprocess '>= 0.6.3' %gemspec_remove_dep -g childprocess '>= 0.6.3'
%patch0 -p1
%patch1 -p1
%build %build
gem build ../%{gem_name}-%{version}.gemspec gem build ../%{gem_name}-%{version}.gemspec
@ -105,5 +109,8 @@ popd
%{gem_instdir}/templates/ %{gem_instdir}/templates/
%changelog %changelog
* Mon Feb 21 2022 liyanan <liyanan32@huawei.com> - 0.14.9-2
- fix build error
* Wed Aug 19 2020 shenleizhao <shenleizhao@huawei.com> - 0.14.9-1 * Wed Aug 19 2020 shenleizhao <shenleizhao@huawei.com> - 0.14.9-1
- package init - package init