diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e13f05a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/string-width-1.0.1.tgz diff --git a/.rh-nodejs6-nodejs-string-width.metadata b/.rh-nodejs6-nodejs-string-width.metadata new file mode 100644 index 0000000..fb0a440 --- /dev/null +++ b/.rh-nodejs6-nodejs-string-width.metadata @@ -0,0 +1 @@ +c92129b6f1d7f52acf9af424a26e3864a05ceb0a SOURCES/string-width-1.0.1.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/test.js b/SOURCES/test.js new file mode 100644 index 0000000..e618cbd --- /dev/null +++ b/SOURCES/test.js @@ -0,0 +1,15 @@ +'use strict'; +var test = require('ava'); +var fn = require('./'); + +test(function (t) { + t.assert(fn('abcde') === 5); + t.assert(fn('古池や') === 6); + t.assert(fn('あいうabc') === 9); + t.assert(fn('ノード.js') === 9); + t.assert(fn('你好') === 4); + t.assert(fn('안녕하세요') === 10); + t.assert(fn('A\ud83c\ude00BC') === 5, 'surrogate'); + t.assert(fn('\u001b[31m\u001b[39m') === 0); + t.end(); +}); diff --git a/SPECS/nodejs-string-width.spec b/SPECS/nodejs-string-width.spec new file mode 100644 index 0000000..4dfb9dc --- /dev/null +++ b/SPECS/nodejs-string-width.spec @@ -0,0 +1,71 @@ +%{?scl:%scl_package nodejs-string-width} +%{!?scl:%global pkg_name %{name}} + +%{?nodejs_find_provides_and_requires} + +%global packagename string-width +%global enable_tests 0 +# tests disabled until such time as 'ava' is packaged for Fedora + +Name: %{?scl_prefix}nodejs-string-width +Version: 1.0.1 +Release: 3%{?dist} +Summary: Get the visual width of a string + +License: MIT +URL: https://github.com/sindresorhus/string-width +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +# Get the test from the upstream repo, as the npm tarball doesn't contain tests +Source1: https://raw.githubusercontent.com/sindresorhus/string-width/f279cfd14835f0a3c8df69ba18e9a3960156e135/test.js + + +ExclusiveArch: %{nodejs_arches} noarch +BuildArch: noarch + +%if 0%{?enable_tests} +BuildRequires: %{?scl_prefix}npm(ava) +%endif + +%description +Get the visual width of a string - the number of columns required to display it + +%prep +%setup -q -n package +# setup the tests +cp -r %{SOURCE1} . + +%build +# nothing to do! + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json index.js \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +#%check +#%nodejs_symlink_deps --check +#%{__nodejs} -e 'require("./")' +#%if 0%{?enable_tests} +#%{__nodejs} test.js +#%else +#%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +#%endif + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license license +%{nodejs_sitelib}/%{packagename} + +%changelog +* Thu Sep 15 2016 Zuzana Svetlikova - 1.0.1-3 +- Built for RHSCL +- Remove %%BuildRequires + +* Wed Mar 02 2016 Jared Smith - 1.0.1-2 +- Fix BuildRequires + +* Fri Oct 23 2015 Jared Smith - 1.0.1-1 +- Initial packaging