%bcond_with bootstrap
%global gem_name activesupport
Name:                rubygem-%{gem_name}
Epoch:               2
Version:             5.2.3
Release:             1
Summary:             A support libraries and Ruby core extensions extracted from the Rails framework
License:             MIT
URL:                 http://rubyonrails.org
Source0:             https://rubygems.org/gems/activesupport-5.2.3.gem
Source1:             https://github.com/rails/rails/archive/v5.2.3.tar.gz
Requires:            rubygem(bigdecimal) rubygem(json)
BuildRequires:       ruby(release) rubygems-devel ruby >= 2.2.2 rubygem(bigdecimal) rubygem(builder)
BuildRequires:       rubygem(concurrent-ruby) rubygem(connection_pool) rubygem(dalli)
BuildRequires:       (rubygem(i18n) >= 0.7 with rubygem(i18n) < 2) rubygem(minitest) >= 5.0.0
BuildRequires:       rubygem(rack) rubygem(tzinfo) >= 1.1 rubygem(listen) rubygem(redis) memcached
BuildArch:           noarch
%description
A toolkit of support libraries and Ruby core extensions extracted from the
Rails framework. Rich support for multibyte strings, internationalization,
time zones, and testing.

%package doc
Summary:             Documentation for %{name}
Requires:            %{name} = %{epoch}:%{version}-%{release}
BuildArch:           noarch
%description doc
Documentation for %{name}.

%prep
%setup -q -n %{gem_name}-%{version}

%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

%if %{with bootstrap}
%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
cd rails-%{version}/%{gem_name}
for f in \
  test/evented_file_update_checker_test.rb \
  test/cache/stores/redis_cache_store_test.rb # failed to require "redis/connection/hiredis"
do
  mv $f{,.disable}
done
sed -i '/def test_iso8601_output_and_reparsing$/,/^  end$/ s/^/#/' test/core_ext/duration_test.rb
memcached &
mPID=$!
sleep 1
ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
kill -15 $mPID
popd
%endif

%files
%dir %{gem_instdir}
%license %{gem_instdir}/MIT-LICENSE
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/README.rdoc

%changelog
* Sat Sep 5 2020 liyanan <liyanan32@huawei.com> - 5.2.3-2
- fix build fail

* Wed Aug 12 2020 chengzihan <chengzihan2@huawei.com> - 5.2.3-1
- Package init
