diff --git a/.gitignore b/.gitignore index e69de29..403e2d1 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/tests-3.0.0.tar.bz2 +/transformers-3.0.0.tgz diff --git a/dl-tests.sh b/dl-tests.sh new file mode 100644 index 0000000..af5db84 --- /dev/null +++ b/dl-tests.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +tag=3.0.0 + +set -e + +tmp=$(mktemp -d) + +trap cleanup EXIT +cleanup() { + set +e + [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp" +} + +unset CDPATH +pwd=$(pwd) + +pushd "$tmp" +git clone git://github.com/ForbesLindesay/transformers.git +cd transformers +git archive --prefix="test/" --format=tar tags/${tag}:test/ \ + | bzip2 > "$pwd"/tests-${tag}.tar.bz2 +popd diff --git a/nodejs-transformers-3.0.0-Add-trailing-semicolons-to-uglify-css-test-files.patch b/nodejs-transformers-3.0.0-Add-trailing-semicolons-to-uglify-css-test-files.patch new file mode 100644 index 0000000..df22961 --- /dev/null +++ b/nodejs-transformers-3.0.0-Add-trailing-semicolons-to-uglify-css-test-files.patch @@ -0,0 +1,53 @@ +From ef6414b87fbc36a688ae49d11c9f0c623d4eb192 Mon Sep 17 00:00:00 2001 +From: Jamie Nguyen +Date: Mon, 3 Mar 2014 20:39:38 +0000 +Subject: [PATCH 1/2] Add trailing semicolons to uglify-css test files + +--- + test/simple/uglify-css/sample-a-expected.txt | 2 +- + test/simple/uglify-css/sample-a.txt | 2 +- + test/simple/uglify-css/sample-b-expected.txt | 2 +- + test/simple/uglify-css/sample-b.txt | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/simple/uglify-css/sample-a-expected.txt b/test/simple/uglify-css/sample-a-expected.txt +index bf80f1e..c921c34 100644 +--- a/test/simple/uglify-css/sample-a-expected.txt ++++ b/test/simple/uglify-css/sample-a-expected.txt +@@ -1 +1 @@ +-tobi{name:"tobi"} +\ No newline at end of file ++tobi{name:"tobi";} +\ No newline at end of file +diff --git a/test/simple/uglify-css/sample-a.txt b/test/simple/uglify-css/sample-a.txt +index bac0d3f..a62f5eb 100644 +--- a/test/simple/uglify-css/sample-a.txt ++++ b/test/simple/uglify-css/sample-a.txt +@@ -1,3 +1,3 @@ + tobi { +- name: "tobi" ++ name: "tobi"; + } +\ No newline at end of file +diff --git a/test/simple/uglify-css/sample-b-expected.txt b/test/simple/uglify-css/sample-b-expected.txt +index 01859af..fb31855 100644 +--- a/test/simple/uglify-css/sample-b-expected.txt ++++ b/test/simple/uglify-css/sample-b-expected.txt +@@ -1 +1 @@ +-tobi{name:"bob"} +\ No newline at end of file ++tobi{name:"bob";} +\ No newline at end of file +diff --git a/test/simple/uglify-css/sample-b.txt b/test/simple/uglify-css/sample-b.txt +index e55a457..07989a1 100644 +--- a/test/simple/uglify-css/sample-b.txt ++++ b/test/simple/uglify-css/sample-b.txt +@@ -1,3 +1,3 @@ + tobi { +- name: "bob" ++ name: "bob"; + } +\ No newline at end of file +-- +1.8.5.3 + diff --git a/nodejs-transformers.spec b/nodejs-transformers.spec new file mode 100644 index 0000000..9b09322 --- /dev/null +++ b/nodejs-transformers.spec @@ -0,0 +1,90 @@ +%{?nodejs_find_provides_and_requires} + +%global enable_tests 1 + +Name: nodejs-transformers +Version: 3.0.0 +Release: 2%{?dist} +Summary: String/Data transformations for Node.js +License: MIT +Group: System Environment/Libraries +URL: https://github.com/ForbesLindesay/transformers +Source0: http://registry.npmjs.org/transformers/-/transformers-%{version}.tgz +# The test files are not included in the npm tarball. +# Source1 is generated by running Source10, which pulls from the upstream +# version control repository. +Source1: tests-%{version}.tar.bz2 +Source10: dl-tests.sh + +# https://github.com/ForbesLindesay/transformers/pull/31 +Patch0: %{name}-3.0.0-Add-trailing-semicolons-to-uglify-css-test-files.patch + +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(css) +BuildRequires: npm(expect.js) +BuildRequires: npm(promise) +BuildRequires: uglify-js +# A lot (>30) of missing devDependencies not listed here. +%endif + +%description +String/Data transformations for use in templating libraries, static site +generators and web frameworks. This gathers the most useful transformations +you can apply to text or data into one library with a consistent API. +Transformations can be pretty much anything but most are either compilers +or templating engines. + + +%prep +%setup -q -n package +%setup -q -T -D -a 1 -n package +# Fix wrong-file-end-of-line-encoding +for i in history.md LICENSE README.md; do + sed -i -e 's/\r$//' "${i}" +done +%patch0 -p1 + +%nodejs_fixdep css '~1.6' +%nodejs_fixdep promise '4.x' + + +%build +#nothing to do + + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/transformers +cp -pr package.json lib/ \ + %{buildroot}%{nodejs_sitelib}/transformers + +%nodejs_symlink_deps + + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +/usr/bin/mocha +%endif + + +%files +%doc history.md LICENSE README.md +%{nodejs_sitelib}/transformers + + +%changelog +* Mon Mar 03 2014 Jamie Nguyen - 3.0.0-2 +- add patch for failing tests + +* Sun Mar 02 2014 Jamie Nguyen - 3.0.0-1 +- initial package diff --git a/sources b/sources index e69de29..05cd566 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +fcfc129ff53fc261f80e656c8c46b746 tests-3.0.0.tar.bz2 +2d51d8b590c5bd75e240c425ed4854fa transformers-3.0.0.tgz