nodejs-promises-aplus-tests/nodejs-promises-aplus-tests.spec
2020-08-20 14:45:09 +08:00

87 lines
2.2 KiB
RPMSpec

%{?nodejs_find_provides_and_requires}
%global packagename promises-aplus-tests
%global enable_tests 1
Name: nodejs-promises-aplus-tests
Version: 2.1.2
Release: 1
Summary: Compliance test suite for Promises/A+
License: WTFPL
URL: https://github.com/promises-aplus/promises-tests.git
Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
#git clone https://github.com/promises-aplus/promises-tests.git
#cd promises-tests
#git archive --prefix='tests/' --format=tar ${gittag}:tests/ \
# | bzip2 > "$pwd"/tests-${tag}.tar.bz2
Source1: tests-%{version}.tar.bz2
#git archive --prefix='scripts/' --format=tar ${gittag}:scripts/ \
# | bzip2 > "$pwd"/scripts-${tag}.tar.bz2
Source2: scripts-%{version}.tar.bz2
# Grab the readme, as it isn't in the npm tarball
Source11: https://raw.githubusercontent.com/promises-aplus/promises-tests/%{version}/README.md
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging npm(underscore)
%if 0%{?enable_tests}
BuildRequires: mocha
%endif
%description
Compliance test suite for Promises/A+
%prep
%setup -q -n package
# setup the tests and scripts
%setup -q -T -D -a 1 -n package
%setup -q -T -D -a 2 -n package
# copy the readme
cp -p %{SOURCE11} .
chmod +x ./lib/cli.js
%nodejs_fixdep mocha
%nodejs_fixdep underscore '^1.8.3'
%build
%{__nodejs} ./scripts/generateTestFiles.js
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json lib/ \
%{buildroot}%{nodejs_sitelib}/%{packagename}
mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/%{packagename}/lib/cli.js \
%{buildroot}%{_bindir}/promises-aplus-tests
%nodejs_symlink_deps
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%{_bindir}/mocha -R spec
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE.txt
%{nodejs_sitelib}/%{packagename}
%{_bindir}/promises-aplus-tests
%changelog
* Wed Aug 19 2020 wangxiao <wangxiao65@huawei.com> - 2.1.2-1
- package init