Blob Blame History Raw
# This macro is needed at the start for building on EL6
%{?nodejs_find_provides_and_requires}

%global enable_tests 0

%global barename pac-proxy-agent

Name:               nodejs-pac-proxy-agent
Version:            1.0.0
Release:            4%{?dist}
Summary:            A PAC file proxy `http.Agent` implementation for HTTP

License:            MIT
URL:                https://www.npmjs.org/package/pac-proxy-agent
Source0:            https://registry.npmjs.org/%{barename}/-/%{barename}-%{version}.tgz
Patch0:             0001-update-stream-to-buffer-to-raw-body-stream-to-buffer.patch
BuildArch:          noarch
%if 0%{?fedora} >= 19
ExclusiveArch:      %{nodejs_arches} noarch
%else
ExclusiveArch:      %{ix86} x86_64 %{arm} noarch
%endif

BuildRequires:      nodejs-packaging >= 6

%if 0%{?enable_tests}
BuildRequires:      npm(mocha)
BuildRequires:      npm(socksv5)
BuildRequires:      npm(proxy)
%endif

%description
This module provides an `http.Agent` implementation that retrieves the
specified PAC proxy file and uses it to resolve which HTTP, HTTPS, or SOCKS
proxy, or if a direct connection should be used to connect to the HTTP endpoint.

%prep
%setup -q -n package

# stream-to-buffer module is deprecated, patch to use raw-body module
%patch0 -p1

# Remove bundled node_modules if there are any..
rm -rf node_modules/

%nodejs_fixdep --caret
%nodejs_fixdep stream-to-array ~x
%nodejs_fixdep extend
%nodejs_fixdep debug
%nodejs_fixdep raw-body

%build
# Nothing to build.

%install
mkdir -p %{buildroot}%{nodejs_sitelib}/pac-proxy-agent
cp -pr package.json index.js \
    %{buildroot}%{nodejs_sitelib}/pac-proxy-agent

%nodejs_symlink_deps


%check
%if 0%{?enable_tests}
%nodejs_symlink_deps --check
mocha --reporter spec
%endif


%files
%doc README.md
%{nodejs_sitelib}/pac-proxy-agent/

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Aug 31 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.0.0-3
- patch out stream-to-buffer

* Mon Aug 31 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.0.0-2
- add fixdep npm(debug) and widen npm(extend)

* Sun Aug 30 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.0.0-1
- Update to new version

* Sat Jul 25 2015 Parag Nemade <pnemade AT fedoraproject DOT org> - 0.1.2-3
- fixdep npm(extend)

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Jul 22 2014 Ralph Bean <rbean@redhat.com> - 0.1.2-1
- Initial packaging for Fedora.