init package

This commit is contained in:
PokeHuang 2020-08-28 12:10:58 +08:00
parent 5b1529e881
commit 6c7af1b686
5 changed files with 226 additions and 0 deletions

BIN
rspec-core-2.14.8.gem Normal file

Binary file not shown.

32
rspec2 Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/ruby
#
# This file was modified from the file generated by RubyGems.
#
# The application 'rspec-core' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = "~> 2.14.0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
gem 'rspec-core', version
begin
gem 'rspec-mocks', version
gem 'rspec-expectations', version
rescue
end
begin
gem 'rspec', version
rescue
end
load Gem.bin_path('rspec-core', 'rspec', version)

View File

@ -0,0 +1,65 @@
--- rspec-core-2.14.8/spec/spec_helper.rb.aruba 2017-02-17 16:22:33.309398987 +0900
+++ rspec-core-2.14.8/spec/spec_helper.rb 2017-02-17 18:53:34.740609923 +0900
@@ -17,7 +17,7 @@
Spork.prefork do
require 'rspec/autorun'
require 'autotest/rspec2'
- require 'aruba/api'
+ #require 'aruba/api'
if RUBY_PLATFORM == 'java'
# Works around https://jira.codehaus.org/browse/JRUBY-5678
@@ -96,14 +96,53 @@
end
end
+ # bollowed from Aruba 0.6.2
+ class RSpec::Core::ExampleGroup
+ def write_file(file_name, file_content)
+ _create_file(file_name, file_content, false)
+ end
+
+ def current_dir
+ #File.join(*dirs)
+ # Fixme
+ "tmp/aruba"
+ end
+
+ def in_current_dir(&block)
+ _mkdir(current_dir)
+ Dir.chdir(current_dir, &block)
+ end
+
+ def _create_file(file_name, file_content, check_presence)
+ in_current_dir do
+ file_name = File.expand_path(file_name)
+
+ raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name)
+
+ _mkdir(File.dirname(file_name))
+ File.open(file_name, 'w') { |f| f << file_content }
+ end
+
+ self
+ end
+
+ def _mkdir(dir_name)
+ dir_name = File.expand_path(dir_name)
+
+ FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
+ end
+ end
+
RSpec.configure do |c|
# structural
c.alias_it_behaves_like_to 'it_has_behavior'
c.around {|example| Sandboxing.sandboxed { example.run }}
c.include(RSpecHelpers)
+ '''
c.include Aruba::Api, :example_group => {
:file_path => /spec\/command_line/
}
+ '''
c.expect_with :rspec do |expectations|
expectations.syntax = :expect

View File

@ -0,0 +1,22 @@
--- rspec-core-2.14.8/spec/rspec/core/memoized_helpers_spec.rb.ruby24 2017-02-17 16:22:33.306398976 +0900
+++ rspec-core-2.14.8/spec/rspec/core/memoized_helpers_spec.rb 2017-02-17 19:01:54.597667276 +0900
@@ -380,7 +380,7 @@
end
its([:a]) { should eq("Symbol: a") }
its(['a']) { should eq("String: a") }
- its([:b, 'c', 4]) { should eq("Symbol: b; String: c; Fixnum: 4") }
+ its([:b, 'c', 4]) { should eq("Symbol: b; String: c; Integer: 4") }
its(:name) { should eq("George") }
context "when referring to an attribute without the proper array syntax" do
context "it raises an error" do
--- rspec-core-2.14.8/lib/rspec/core/rake_task.rb.ruby24 2017-02-17 16:22:33.288398906 +0900
+++ rspec-core-2.14.8/lib/rspec/core/rake_task.rb 2017-02-17 16:48:35.937522005 +0900
@@ -115,7 +115,7 @@
def initialize(*args, &task_block)
setup_ivars(args)
- desc "Run RSpec code examples" unless ::Rake.application.last_comment
+ desc "Run RSpec code examples" unless ::Rake.application.last_description
task name, *args do |_, task_args|
RakeFileUtils.send(:verbose, verbose) do

107
rubygem-rspec2-core.spec Normal file
View File

@ -0,0 +1,107 @@
%global majorver 2.14.8
%global rpmminorver .%(echo %preminorver | sed -e 's|^\\.\\.*||')
%global fullver %{majorver}%{?preminorver}
%global gem_name rspec-core
%global rpmgem_name rspec2-core
%global need_bootstrap_set 0
Summary: Rspec 2 runner and formatters
Name: rubygem-%{rpmgem_name}
Version: %{majorver}
Release: 1
License: MIT
URL: http://github.com/rspec/rspec-core
Source0: http://rubygems.org/gems/%{gem_name}-%{fullver}.gem
# Fix for ruby24
Patch0: rubygem-rspec-core-2.14.8-ruby24.patch
# F-26 uses aruba 0.14.x, which uses rspec3 and so incompatible with rspec2.
# Remove aruba dependency
Patch1: rubygem-rspec-core-2.14.8-remove-aruba-dependency.patch
Source1: rspec2
BuildRequires: ruby(release) rubygems-devel
%if 0%{?need_bootstrap_set} < 1
BuildRequires: rubygem(ZenTest) rubygem(nokogiri) rubygem(rake) rubygem(rspec2)
BuildRequires: rubygem(rspec2-expectations) rubygem(aruba)
%endif
Requires: rubygem(rake)
Provides: rubygem(%{rpmgem_name}) = %{version}-%{release}
Obsoletes: rubygem-rspec-core < 2.14.8-1
BuildArch: noarch
%description
Behaviour Driven Development for Ruby.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
Obsoletes: rubygem-rspec-core-doc < %{version}-%{release}
%description doc
This package contains documentation for %{name}.
%prep
gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
sed -i \
-e '\@#!/usr/bin/env@d' \
lib/rspec/core/mocking/with_flexmock.rb
sed -i \
-e 's|SAFE = 3|SAFE = 1|' \
spec/support/helper_methods.rb
%patch0 -p1
%patch1 -p1
gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%build
gem build %{gem_name}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{_prefix}
cp -a .%{_prefix}/* %{buildroot}%{_prefix}/
mv %{buildroot}%{_bindir}/autospec{,2}
mv %{buildroot}%{_bindir}/rspec{,2}
install -cpm 0755 %{SOURCE1} \
%{buildroot}%{_bindir}/rspec2
rm -f %{buildroot}%{gem_instdir}/{.document,.gitignore,.treasure_map.rb,.rspec,.travis.yml,spec.txt,.yardopts}
%if 0%{?need_bootstrap_set} < 1
%check
LANG=C.UTF-8
pushd .%{gem_instdir}
sed -i.bak \
-e "\@configures streams before command line options@s|do|, :broken => true do|" \
spec/rspec/core/command_line_spec.rb
sed -i.bak \
-e "\@produces HTML identical to the one we designed manually@s|do|, :broken => true do|" \
spec/rspec/core/formatters/text_mate_formatter_spec.rb
sed -i.bak \
-e "\@warns when HOME env var is not set@s|do|, :broken => true do|" \
spec/rspec/core/configuration_options_spec.rb
sed -i.bak spec/rspec/core/example_spec.rb \
-e "\@leaves a raised exception unmodified@s|do|, :broken => true do|"
sed -i.bak spec/support/mathn_integration_support.rb \
-e "\@require.*mathn@d"
sed -i.bak spec/rspec/core/memoized_helpers_spec.rb \
-e "\@is still a private method@s|do|, :broken => true do|"
ruby -rrubygems -Ilib/ %{buildroot}%{_bindir}/rspec2 spec || \
ruby -rrubygems -Ilib/ %{buildroot}%{_bindir}/rspec2 spec --tag ~broken
popd
%endif
%files
%dir %{gem_instdir}
%license %{gem_instdir}/License.txt
%doc %{gem_instdir}/*.md
%{_bindir}/autospec2
%{_bindir}/rspec2
%{gem_instdir}/exe/
%{gem_instdir}/lib/
%exclude %{gem_cache}
%{gem_spec}
%files doc
%{gem_docdir}
%{gem_instdir}/features/
%exclude %{gem_instdir}/spec/
%changelog
* Mon Aug 24 2020 huangyangke <huangyangke@huawei.com> - %{majorver}-1
- package init