%global enable_tests 0
%global srcname archiver
%global github_name node-archiver

%global commit0 b6e7725ab646ef83d1ac53f045487de43d87811a
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global owner archiverjs

Name:           nodejs-%{srcname}
Version:        1.0.1
Release:        1%{?dist}
Summary:        A streaming interface for archive generation
License:        MIT
URL:            https://github.com/archiverjs/node-archiver
# npm sources don't include tests so we use github
Source0:        https://github.com/%{owner}/%{github_name}/archive/%{commit0}.tar.gz#/%{github_name}-%{shortcommit0}.tar.gz

BuildArch:      noarch
ExclusiveArch:  %{nodejs_arches} noarch

BuildRequires:  nodejs-packaging

%if 0%{?enable_tests}
BuildRequires:  npm(archiver-utils)
BuildRequires:  npm(chai)
BuildRequires:  npm(mocha)
BuildRequires:  npm(async) >= 1.5.0
BuildRequires:  npm(lazystream)
BuildRequires:  npm(lodash)
BuildRequires:  npm(mkdirp)
BuildRequires:  npm(readable-stream)
BuildRequires:  npm(rimraf)
BuildRequires:  npm(tar)
BuildRequires:  npm(tar-stream)
BuildRequires:  npm(yauzl)
BuildRequires:  npm(zip-stream)
%endif


%description
%{summary}.


%prep
%setup -qn %{github_name}-%{commit0}
rm -rf node_modules/
%{nodejs_fixdep} async "^1.5"
%{nodejs_fixdep} glob "^6.0"
%{nodejs_fixdep} lodash "^3.10"
%{nodejs_fixdep} tar-stream "1.x"
%{nodejs_fixdep} zip-stream "0.x"


%build
#nothing to do


%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{srcname}
cp -pr package.json lib/ index.js \
    %{buildroot}%{nodejs_sitelib}/%{srcname}

%nodejs_symlink_deps


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


%files
%doc *.md examples/
%license LICENSE
%{nodejs_sitelib}/%{srcname}


%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Aug 29 2016 Piotr Popieluch <piotr1212@gmail.com> - - 1.0.1-1
- Update to 1.0.1

* Sat Feb 27 2016 Piotr Popieluch <piotr1212@gmail.com> - 0.21.0-1
- Update to 0.21.0

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jan 20 2016 Tom Hughes <tom@compton.nu> - 0.17.0-4
- Update npm(lazystream) dependency

* Fri Jan  1 2016 Tom Hughes <tom@compton.nu> - 0.17.0-3
- Update npm(glob) dependency

* Tue Dec 15 2015 Tom Hughes <tom@compton.nu> - 0.17.0-2
- Update npm(lodash) dependency

* Sat Nov 28 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.17.0-1
- Update to 0.17.0

* Sat Nov 21 2015 Tom Hughes <tom@compton.nu> - 0.16.0-1
- Update to 0.16.0 upstream release
- Update npm(async) dependency

* Thu Jul 23 2015 Parag Nemade <pnemade AT fedoraproject DOT org> - 0.14.4-4
- fixdep npm(readable-stream)

* Mon Jul 13 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.14.4-3
- Add fixdep for updated tar-stream

* Mon Jun 15 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.14.4-2
- Fixed package naming

* Sat Jun 13 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.14.4-1
- Update to upstream 0.14.4
- Added el6 macro
- Updated URL
- Capitalized summary
- Use github sources

* Sun Mar  8 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.14.3-1
- Update to upstream 0.14.3

* Sun Dec 21 2014 Piotr Popieluch <piotr1212@gmail.com> - 0.13.0-1
- Initial package
