%global enable_tests 1
%global module_name timed-out
Name: nodejs-%{module_name}
Version: 2.0.0
Release: 2%{?dist}
Summary: Timeout HTTP/HTTPS requests
License: MIT
URL: https://github.com/floatdrop/timed-out
Source0: http://registry.npmjs.org/%{module_name}/-/%{module_name}-%{version}.tgz
Source1: https://raw.githubusercontent.com/floatdrop/timed-out/master/license
Source2: https://raw.githubusercontent.com/floatdrop/timed-out/master/test.js
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: npm(mocha)
%endif
%description
Timeout HTTP/HTTPS requests. Emit Error object with code property
equal ETIMEDOUT or ESOCKETTIMEDOUT when ClientRequest is hanged.
%prep
%setup -q -n package
rm -rf node_modules
cp -p %{SOURCE1} %{SOURCE2} .
%build
# nothing to build
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{module_name}
cp -pr package.json *.js %{buildroot}%{nodejs_sitelib}/%{module_name}
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
mocha
%endif
%files
%doc readme.md license
%{nodejs_sitelib}/%{module_name}
%changelog
* Sun Dec 07 2014 Parag Nemade <pnemade AT redhat DOT com> - 2.0.0-2
- Add test.js from upstream and enable tests
* Thu Dec 04 2014 Parag Nemade <pnemade AT redhat DOT com> - 2.0.0-1
- Initial packaging