%{?nodejs_find_provides_and_requires}

%global enable_tests 1

Name:           nodejs-esprima
Version:        2.7.2
Release:        6%{?dist}
Summary:        ECMAScript parsing infrastructure for multipurpose analysis

License:        BSD
URL:            https://github.com/jquery/esprima
Source0:        https://github.com/jquery/esprima/archive/%{version}/%{name}-%{version}.tar.gz
BuildArch:      noarch
ExclusiveArch:  %{nodejs_arches} noarch

BuildRequires:  nodejs-packaging

BuildRequires:  npm(glob)
#BuildRequires:  npm(everything.js)
BuildRequires:  npm(json-diff)
BuildRequires:  npm(lodash)


%description
%{summary}.


%prep
%autosetup -n esprima-%{version}


%build
#nothing to do


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

mkdir -p %{buildroot}%{_bindir}
for i in esparse.js esvalidate.js; do
    install -p -D -m0755 bin/${i} %{buildroot}%{nodejs_sitelib}/esprima/bin/${i}
    ln -s %{nodejs_sitelib}/esprima/bin/${i} %{buildroot}%{_bindir}/${i}
done

%nodejs_symlink_deps


%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
%__nodejs tools/generate-fixtures.js
%__nodejs test/unit-tests.js
#%__nodejs test/grammar-tests.js
%__nodejs test/regression-tests.js
%endif


%files
%doc README.md ChangeLog
%license LICENSE.BSD
%{nodejs_sitelib}/esprima
%{_bindir}/esparse.js
%{_bindir}/esvalidate.js


%changelog
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

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

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

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

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

* Thu Feb 11 2016 Tom Hughes <tom@compton.nu> - 2.7.2-1
- Update to 2.7.2 upstream release

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

* Fri Jan  1 2016 Tom Hughes <tom@compton.nu> - 2.7.1-1
- Update to 2.7.1 upstream release
- Enable unit tests and regression tests

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

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Apr 18 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.1.1-1
- update to upstream release 1.1.1

* Wed Sep 04 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.0.4-1
- update to upstream release 1.0.4

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Jul 21 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.0.3-3
- restrict to compatible arches

* Fri May 31 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.0.3-2
- add comment about how man pages were generated
- add comment about downloading of test directory

* Wed May 29 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.0.3-1
- update to upstream release 1.0.3

* Sun Feb 17 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 1.0.2-1
- initial package
