From 14e81a0f91893f3e04ffd12223b995f0453ac6d0 Mon Sep 17 00:00:00 2001 From: Jared K. Smith Date: Feb 08 2016 15:06:31 +0000 Subject: Initial packaging --- diff --git a/.gitignore b/.gitignore index e69de29..ae8080b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/array-unique-0.2.1.tgz diff --git a/nodejs-array-unique.spec b/nodejs-array-unique.spec new file mode 100644 index 0000000..fd69b6e --- /dev/null +++ b/nodejs-array-unique.spec @@ -0,0 +1,72 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename array-unique +%global enable_tests 1 + +Name: nodejs-array-unique +Version: 0.2.1 +Release: 1%{?dist} +Summary: Return an array free of duplicate values + +License: MIT +URL: https://github.com/jonschlinkert/array-unique.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +# The test files are not included in the npm tarball, and releases aren't +# tagged in github, so we'll just pull from master for now +Source1: https://raw.githubusercontent.com/jonschlinkert/array-unique/master/test.js + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: mocha +BuildRequires: npm(should) +%endif + +%description +Return an array free of duplicate values. Fastest ES5 implementation. + + +%prep +%setup -q -n package +# setup the tests +cp -p %{SOURCE1} . + +chmod -x ./* + + +%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} +%{_bindir}/mocha -R spec +%else +%{_bindir}/echo "Tests disabled..." +%endif + + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license LICENSE +%{nodejs_sitelib}/%{packagename} + + +%changelog +* Wed Feb 3 2016 Jared Smith - 0.2.1-1 +- Initial packaging diff --git a/sources b/sources index e69de29..b422aa4 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +7b3ac4760380d655957c68e59748f438 array-unique-0.2.1.tgz diff --git a/test.js b/test.js new file mode 100644 index 0000000..9a40ce6 --- /dev/null +++ b/test.js @@ -0,0 +1,42 @@ +/*! + * array-unique + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +/* deps:mocha */ +var assert = require('assert'); +var should = require('should'); +var unique = require('./'); + +describe('unique', function () { + it('should throw an error if the value passed is not an array:', function () { + (function () { + unique('a', 'b', 'c'); + }).should.throw('array-unique expects an array.'); + }); + + it('should return an array with unique values:', function () { + unique(['a', 'b', 'c', 'a', 'b', 'd']).should.eql(['a', 'b', 'c', 'd']); + unique(['a', 'b', 'c', 'a', 'b', 'a', 'b', 'c', 'b', 'f', 'a', 'b']).should.eql(['a', 'b', 'c', 'f']); + unique(['a', 'b', 'c', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b', 'a', 'b', 'a', 'b', 'b', 'f', 'a', 'b', 'x', 'y', 'z', 'a', 'b']).should.eql(['a', 'b', 'c', 'f', 'x', 'y', 'z']); + unique(['foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/a.js', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/b.js', 'foo/bar/baz/quux/fez/test/fixtures/b.js', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/a.js', 'foo/bar/baz/quux/fez/test/fixtures/j.js', 'foo/bar/baz/quux/fez/test/fixtures/z.js', 'foo/bar/baz/quux/fez/test/fixtures/c.js', 'foo/bar/baz/quux/fez/test/fixtures/d.js', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/a.js', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/h.js', 'foo/bar/baz/quux/fez/test/fixtures/i.js', 'foo/bar/baz/quux/fez/test/fixtures/j.js', 'foo/bar/baz/quux/fez/test/fixtures/k.js', 'foo/bar/baz/quux/fez/test/fixtures/l.js', 'foo/bar/baz/quux/fez/test/fixtures/m.js', 'foo/bar/baz/quux/fez/test/fixtures', 'foo/bar/baz/quux/fez/test/fixtures/a.js']).should.eql([ + 'foo/bar/baz/quux/fez/test/fixtures', + 'foo/bar/baz/quux/fez/test/fixtures/a.js', + 'foo/bar/baz/quux/fez/test/fixtures/b.js', + 'foo/bar/baz/quux/fez/test/fixtures/j.js', + 'foo/bar/baz/quux/fez/test/fixtures/z.js', + 'foo/bar/baz/quux/fez/test/fixtures/c.js', + 'foo/bar/baz/quux/fez/test/fixtures/d.js', + 'foo/bar/baz/quux/fez/test/fixtures/h.js', + 'foo/bar/baz/quux/fez/test/fixtures/i.js', + 'foo/bar/baz/quux/fez/test/fixtures/k.js', + 'foo/bar/baz/quux/fez/test/fixtures/l.js', + 'foo/bar/baz/quux/fez/test/fixtures/m.js' + ]); + }); +}); +