Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global packagename qunitjs
%global enable_tests 1

Name:		nodejs-qunitjs
Version:	1.22.0
Release:	1%{?dist}
Summary:	An easy-to-use JavaScript Unit Testing framework

# Code is licensed under the MIT license, except for src/diff.js, which is a
# fork of https://code.google.com/p/google-diff-match-patch/ and is licensed
# under the Apache Software License, v2
License:	MIT and ASL 2.0
URL:		https://github.com/jquery/qunit.git
Source0:	https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# The test files are not included in the npm tarball.
# Sources 1-3 are generated by running Source10, which pulls from the upstream
# version control repository.
Source1:	tests-%{version}.tar.bz2
Source2:	src-%{version}.tar.bz2
Source3:	build-%{version}.tar.bz2
Source10:	dl-tests.sh

# The Gruntfile is not included in the npm tarball.
Source11:	https://raw.githubusercontent.com/jquery/qunit/%{version}/Gruntfile.js

ExclusiveArch:	%{nodejs_arches} noarch
BuildArch:	noarch

BuildRequires:	nodejs-packaging
BuildRequires:	npm(grunt-cli)
%if 0%{?enable_tests}
BuildRequires:	npm(async)
BuildRequires:	npm(grunt)
BuildRequires:	npm(grunt-contrib-concat)
BuildRequires:	npm(grunt-contrib-watch)
BuildRequires:	npm(grunt-contrib-nodeunit)
BuildRequires:	npm(grunt-contrib-internal)
BuildRequires:	npm(load-grunt-tasks)
BuildRequires:	npm(underscore.string)
%endif

Requires:	nodejs

%description
An easy-to-use JavaScript Unit Testing framework.


%prep
%setup -q -n package
# setup the tests
%setup -q -T -D -a 1 -n package
%setup -q -T -D -a 2 -n package
%setup -q -T -D -a 3 -n package
# setup the Gruntfile
cp -p %{SOURCE11} .

# remove pre-compiled files
rm qunit/*

# add license file for diff.js
head -n28 src/diff.js > LICENSE-diff.js.txt

%build
mkdir node_modules
%nodejs_symlink_deps --build
%{_bindir}/grunt build
cp dist/qunit.js qunit/
rm -rf ./node_modules/

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

%nodejs_symlink_deps

%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%{_bindir}/grunt test-on-node
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif


%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE.txt LICENSE-diff.js.txt
%{nodejs_sitelib}/%{packagename}



%changelog
* Wed Feb 24 2016 Jared Smith <jsmith@fedoraproject.org> - 1.22.0-1
- Update to upstream 1.22.0 release

* Mon Feb 22 2016 Jared Smith <jsmith@fedoraproject.org> - 1.21.0-3
- Use macro to link to build requirements

* Mon Feb 22 2016 Jared Smith <jsmith@fedoraproject.org> - 1.21.0-2
- Fixes for licensing of src/diff.js
- Remove pre-generated files, to ensure that we're building new ones
- Don't include qunit.css, as it's not needed

* Sat Feb 20 2016 Jared Smith <jsmith@fedoraproject.org> - 1.21.0-1
- Update to upstream 1.21.0 release

* Tue Jan 12 2016 Jared Smith <jsmith@fedoraproject.org> - 1.20.0-1
- Update to upstream 1.20.0 release

* Wed Oct 28 2015 Jared Smith <jsmith@fedoraproject.org> - 1.19.0-2
- rebuilt

* Tue Oct 20 2015 Jared Smith <jsmith@fedoraproject.org> - 1.19.0-1
- Initial packaging