%global enable_tests 1
Name: nodejs-agentkeepalive
Version: 0.1.5
Release: 2%{?dist}
Summary: Missing keep-alive http.Agent
License: MIT
URL: https://github.com/TBEDP/agentkeepalive
Source0: http://registry.npmjs.org/agentkeepalive/-/agentkeepalive-%{version}.tgz
Source1: nodejs-agentkeepalive-ssl.conf
# https://github.com/TBEDP/agentkeepalive/commit/18e834602e4d31f614e66966d7e6f4a262c1d7f9
Patch0: nodejs-agentkeepalive-test.patch
BuildArch: noarch
BuildRequires: nodejs-devel
%if 0%{?enable_tests}
BuildRequires: openssl
BuildRequires: npm(mocha)
BuildRequires: npm(should)
BuildRequires: npm(pedding)
%endif
%description
The nodejs's missing keep alive http.Agent. Support HTTP and HTTPS.
%prep
%setup -q -n package
%patch0 -p1
rm -rf node_modules
%build
%install
mkdir -p %{buildroot}/%{nodejs_sitelib}/agentkeepalive
cp -pr package.json index.js lib %{buildroot}/%{nodejs_sitelib}/agentkeepalive
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
#%nodejs_symlink_deps --check
ln -s %{nodejs_sitelib} .
pushd test/fixtures
OPENSSL_CONF=%{SOURCE1} sh genkey.sh
popd
NODE_TLS_REJECT_UNAUTHORIZED=0 %{nodejs_sitelib}/mocha/bin/mocha -R spec -t 10000
%endif
%files
%doc README.md AUTHORS example
%{nodejs_sitelib}/agentkeepalive
%changelog
* Sun May 26 2013 Tom Hughes <tom@compton.nu> - 0.1.5-2
- Fix rpmlint warnings.
* Mon Feb 25 2013 Tom Hughes <tom@compton.nu> - 0.1.5-1
- Initial build of 0.1.5