%{?nodejs_find_provides_and_requires} %global packagename path-dirname %global enable_tests 1 Name: nodejs-path-dirname Version: 1.0.2 Release: 1%{?dist} Summary: Node.js path.dirname() ponyfill License: MIT URL: https://github.com/es128/path-dirname Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz # The test files are not included in the npm tarball. Source1: https://raw.githubusercontent.com/es128/%{packagename}/v%{version}/test.js Patch0: path-dirname_fix-directory-name.patch ExclusiveArch: %{nodejs_arches} noarch BuildArch: noarch BuildRequires: nodejs-packaging %if 0%{?enable_tests} #BuildRequires: %endif %description Node.js path.dirname() ponyfill %prep %setup -q -n package # setup the tests cp -p %{SOURCE1} . %patch0 -p1 %build # nothing to do! %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} cp -pr package.json index.js \ %{buildroot}%{nodejs_sitelib}/%{packagename} %nodejs_symlink_deps %check %nodejs_symlink_deps --check %{__nodejs} -e 'require("./")' %if 0%{?enable_tests} %{_bindir}/node test.js && %{_bindir}/echo -e "\e[102m -=#=- Tests pass -=#=- \e[0m" %else %{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" %endif %files %doc %license %{nodejs_sitelib}/%{packagename} %changelog * Mon Dec 19 2016 Jared Smith - 1.0.2-1 - Initial packaging