# This macro is needed at the start for building on EL6
%{?nodejs_find_provides_and_requires}
%global enable_tests 0
%global barename socks-proxy-agent
Name: nodejs-socks-proxy-agent
Version: 0.1.2
Release: 1%{?dist}
Summary: A SOCKS (v4a) proxy http.Agent implementation
Group: Development/Libraries
License: MIT
URL: https://www.npmjs.org/package/socks-proxy-agent
Source0: http://registry.npmjs.org/%{barename}/-/%{barename}-%{version}.tgz
BuildArch: noarch
%if 0%{?fedora} >= 19
ExclusiveArch: %{nodejs_arches} noarch
%else
ExclusiveArch: %{ix86} x86_64 %{arm} noarch
%endif
BuildRequires: nodejs-packaging >= 6
BuildRequires: npm(agent-base)
BuildRequires: npm(rainbowsocks)
BuildRequires: npm(extend)
Requires: npm(agent-base)
Requires: npm(rainbowsocks)
Requires: npm(extend)
%if 0%{?enable_tests}
BuildRequires: npm(mocha)
%endif
%description
This module provides an http.Agent implementation that connects to a specified
SOCKS (v4a) proxy server, and can be used with the built-in http or https
modules.
It can also be used in conjunction with the ws module to establish a WebSocket
connection over a SOCKS proxy.
%prep
%setup -q -n package
# Remove bundled node_modules if there are any..
rm -rf node_modules/
%nodejs_fixdep --caret
%build
%nodejs_symlink_deps --build
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/socks-proxy-agent
cp -pr package.json socks-proxy-agent.js \
%{buildroot}%{nodejs_sitelib}/socks-proxy-agent
%nodejs_symlink_deps
%check
%if 0%{?enable_tests}
%nodejs_symlink_deps --check
mocha --reporter spec
%endif
%files
%doc README.md
%{nodejs_sitelib}/socks-proxy-agent/
%changelog
* Tue Jul 22 2014 Ralph Bean <rbean@redhat.com> - 0.1.2-1
- Initial packaging for Fedora.