%{?scl:%scl_package nodejs-wcwidth}
%{!?scl:%global pkg_name %{name}}

%{?nodejs_find_provides_and_requires}

%global enable_tests 1

Name:		%{?scl_prefix}nodejs-wcwidth
Version:	1.0.0
Release:	6%{?dist}
Summary:	Port of C's wcwidth() and wcswidth()
License:	MIT
Url:		https://www.npmjs.com/package/wcwidth
Source:		http://registry.npmjs.org/wcwidth/-/wcwidth-%{version}.tgz
BuildRequires:	nodejs-packaging
BuildArch:	noarch
ExclusiveArch:	%{nodejs_arches} noarch

%if 0%{enable_tests}
BuildRequires:	npm(tape)
%endif

BuildRequires:	npm(defaults)

%description
Determine columns needed for a fixed-size wide-character string.

%prep
%setup -q -n package
%{nodejs_fixdep} defaults

%build

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

%{nodejs_symlink_deps}

%if 0%{?enable_tests}
%check
%{nodejs_symlink_deps} --check
tape test/*.js
%endif

%files
%doc docs/index.md Readme.md
%license LICENSE
%{nodejs_sitelib}/wcwidth

%changelog
* Sat May 23 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 1.0.0-6
- Moved nodejs-defaults dependency outside conditional

* Fri Mar 20 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 1.0.0-5
- Added npm(defaults) to test dependencies
- fixed URL

* Tue Mar 10 2015 Zuzana Svetlikova - 1.0.0-4
- Removed Group, BuildRoot and %%defattr
- changed ExclusiveArch
- added %%nodejs_fixdep, %%license and %%check

* Wed Feb 25 2015 Zuzana Svetlikova <zsvetlik@redhat.com> - 1.0.0-3
- Fixed dependency on nodejs-packaging

* Mon Jan 12 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.0-2
- Initial build