Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global packagename jshint
# tests diabled due to missing dependencies, such as npm(phantom)
%global enable_tests 0

Name:		nodejs-jshint
Version:	2.9.2
Release:	3%{?dist}
Summary:	Static analysis tool for JavaScript

License:	MIT
URL:		https://github.com/jshint/jshint.git
Source0:	https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# The test files are not included in the npm tarball.
# Source{1-2} are generated by running Source10, which pulls from the upstream
# version control repository.
Source1:	tests-%{version}.tar.bz2
Source2:	examples-%{version}.tar.bz2
Source10:	dl-tests.sh


ExclusiveArch:	%{nodejs_arches} noarch
BuildArch:	noarch

BuildRequires:	nodejs-packaging
%if 0%{?enable_tests}
BuildRequires:	nodeunit
BuildRequires:	npm(browserify)
BuildRequires:	npm(phantom)
%endif

%description
Static analysis tool for JavaScript


%prep
%setup -q -n package

%nodejs_fixdep shelljs

# setup tests and examples
%setup -q -T -D -a 1 -n package
%setup -q -T -D -a 2 -n package


%nodejs_fixdep cli
%nodejs_fixdep lodash
%nodejs_fixdep minimatch

%build
# nothing to do, since we're not building a browser version of this

%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json data/ src/ \
	%{buildroot}%{nodejs_sitelib}/%{packagename}

mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}/bin
# fix the interpreter for these scripts
for file in bin/*
do
	sed -i '1!b;s/env node/node/' $file
done
install -p -D -m0755 bin/* %{buildroot}%{nodejs_sitelib}/%{packagename}/bin/

mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/%{packagename}/bin/jshint \
    %{buildroot}%{_bindir}/jshint

%nodejs_symlink_deps

%check
%nodejs_symlink_deps --check
%if 0%{?enable_tests}
%{_bindir}/nodeunit tests
%{_bindir}/nodeunit tests/regression
%{_bindir}/nodeunit tests/unit
%endif


%files
%{!?_licensedir:%global license %doc}
%doc *.md examples/
%license LICENSE
%{nodejs_sitelib}/%{packagename}
%{_bindir}/jshint



%changelog
* Wed Aug 03 2016 Jared Smith <jsmith@fedoraproject.org> - 2.9.2-3
- Fix shebang lines on scripts in bindir

* Sat Jul 30 2016 Jared Smith <jsmith@fedoraproject.org> - 2.9.2-2
- Relax dependency on npm(shelljs)

* Sat Jun 18 2016 Jared Smith <jsmith@fedoraproject.org> - 2.9.2-1
- Update to upstream 2.9.2 release

* Tue Jan 19 2016 Jared Smith <jsmith@fedoraproject.org> - 2.8.0-5
- Handle jshint binary appropriately

* Thu Oct 22 2015 Jared Smith <jsmith@fedoraproject.org> - 2.8.0-4
- Fix dependency version on npm(minimatch)

* Thu Oct 22 2015 Jared Smith <jsmith@fedoraproject.org> - 2.8.0-3
- Fix dependency version on npm(lodash)

* Thu Oct 22 2015 Jared Smith <jsmith@fedoraproject.org> - 2.8.0-2
- Fix dependency version on npm(cli)

* Thu Oct 15 2015 Jared Smith <jsmith@fedoraproject.org> - 2.8.0-1
- Initial packaging