%{?nodejs_find_provides_and_requires} %global packagename woothee %global enable_tests 1 Name: nodejs-woothee Version: 1.4.0 Release: 2%{?dist} Summary: User-Agent string parser (js implementation) License: ASL 2.0 URL: https://github.com/woothee/woothee-js.git Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz # No license file, requested at https://github.com/woothee/woothee-js/pull/7 Source1: LICENSE-Apache2 BuildArch: noarch %if 0%{?fedora} >= 19 ExclusiveArch: %{nodejs_arches} noarch %else ExclusiveArch: %{ix86} x86_64 %{arm} noarch %endif BuildRequires: nodejs-packaging BuildRequires: npm(js-yaml) %if 0%{?enable_tests} BuildRequires: mocha BuildRequires: npm(chai) BuildRequires: npm(should) %endif %description User-Agent string parser (js implementation) %prep %autosetup -n package cp -p %{SOURCE1} . %build %nodejs_symlink_deps --check # rebuild lib/dataset.js rm lib/dataset.js %{__nodejs} scripts/dataset_yaml2js.js # rebuild release/woothee.js rm release/woothee.js %{__nodejs} scripts/jsbuilder.js # clean up rm -rf node_modules %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} cp -pr package.json lib/ release/ \ %{buildroot}%{nodejs_sitelib}/%{packagename} %nodejs_symlink_deps %check %nodejs_symlink_deps --check %{__nodejs} -e 'require("./")' %if 0%{?enable_tests} NODE_ENV=test %{_bindir}/mocha -R spec %else %{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" %endif %files %{!?_licensedir:%global license %doc} %license LICENSE-Apache2 %doc *.md %{nodejs_sitelib}/%{packagename} %changelog * Wed Jul 13 2016 Jared Smith - 1.4.0-2 - Rebuild lib/dataset.js and release/woothee.js as part of package creation * Thu Jul 7 2016 Jared Smith - 1.4.0-1 - Initial packaging