Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global packagename promises-aplus-tests
%global enable_tests 1

Name:		nodejs-promises-aplus-tests
Version:	2.1.2
Release:	4%{?dist}
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
# The test files are not included in the npm tarball.
# Source{1-9} are generated by running Source10, which pulls from the upstream
# version control repository.
Source1:	tests-%{version}.tar.bz2
Source2:	scripts-%{version}.tar.bz2
Source10:	dl-tests.sh

# 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
BuildRequires:	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
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sun Jul 24 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.2-1
- Update to upstream 2.1.2 release

* Tue Feb 16 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.1-3
- Fix executable permissions on cli.js

* Mon Feb 15 2016 Jared Smith <jsmith@fedoraproject.org> - 2.1.1-2
- Add promises-aplus-tests binary

* Wed Nov 11 2015 Jared Smith <jsmith@fedoraproject.org> - 2.1.1-1
- Initial packaging