From 384832ef95bde8e7f7635e8a8b0b89f2c60e2462 Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Apr 02 2014 19:17:14 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore index e69de29..77d5dc0 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,3 @@ +/docs-v0.4.0.tar.bz2 +/grunt-contrib-uglify-0.4.0.tgz +/tests-v0.4.0.tar.bz2 diff --git a/Gruntfile-v0.4.0.js b/Gruntfile-v0.4.0.js new file mode 100644 index 0000000..70230ad --- /dev/null +++ b/Gruntfile-v0.4.0.js @@ -0,0 +1,266 @@ +/* + * grunt-contrib-uglify + * http://gruntjs.com/ + * + * Copyright (c) 2014 "Cowboy" Ben Alman, contributors + * Licensed under the MIT license. + */ + +'use strict'; + +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + jshint: { + all: [ + 'Gruntfile.js', + 'tasks/**/*.js', + '<%= nodeunit.tests %>' + ], + options: { + jshintrc: '.jshintrc' + } + }, + + // Before generating any new files, remove any previously-created files. + clean: { + tests: ['tmp'] + }, + + // Configuration to be run (and then tested). + uglify: { + compress: { + files: { + 'tmp/compress.js': ['test/fixtures/src/simple.js'] + }, + options: { + mangle: false + } + }, + compress_mangle: { + files: { + 'tmp/compress_mangle.js': ['test/fixtures/src/simple.js'] + } + }, + compress_mangle_banner: { + files: { + 'tmp/compress_mangle_banner.js': ['test/fixtures/src/simple.js'] + }, + options : { + banner : '// banner without sourcemap\n' + } + }, + no_src: { + files: { + 'tmp/compress_mangle.js': [] + } + }, + compress_mangle_except: { + files: { + 'tmp/compress_mangle_except.js': ['test/fixtures/src/simple.js'] + }, + options: { + mangle: { + except: ['argumentC'] + } + } + }, + compress_mangle_beautify: { + files: { + 'tmp/compress_mangle_beautify.js': ['test/fixtures/src/simple.js'] + }, + options: { + beautify: true + } + }, + enclose: { + files: { + 'tmp/enclose.js': ['test/fixtures/src/simple.js'] + }, + options: { + beautify: true, + compress: false, + enclose: { + 'window.argA': 'paramA', + 'window.argB': 'paramB' + }, + mangle: false + } + }, + multifile: { + files: { + 'tmp/multifile.js': ['test/fixtures/src/simple.js','test/fixtures/src/comments.js'] + }, + options: { + mangle: false + } + }, + comments: { + src: 'test/fixtures/src/comments.js', + dest: 'tmp/comments.js', + options: { + mangle: false, + preserveComments: 'some' + } + }, + wrap: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/wrap.js', + options: { + mangle: false, + wrap: 'testExport' + } + }, + exportAll: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/exportAll.js', + options: { + mangle: false, + wrap: 'testExport', + exportAll: true + } + }, + sourcemap_basic: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/sourcemap_basic.js', + options: { + sourceMap: true + } + }, + sourcemap_customName: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/sourcemap_customName.js', + options: { + sourceMap: true, + sourceMapName: 'tmp/source_map_custom_name' + } + }, + sourcemap_customDir: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/sourcemap_customDir.js', + options: { + sourceMap: true, + sourceMapName: 'tmp/deep/directory/location/source_map.js.map' + } + }, + sourcemap_functionName: { + src: 'test/fixtures/src/simple.js', + dest: 'tmp/sourcemap_functionName.js', + options: { + sourceMap: true, + sourceMapName: function( dest ) { + return dest + ".fn.map"; + } + } + }, + sourcemap_multiple: { + files: { + 'tmp/sourcemaps_multiple1.js': ['test/fixtures/src/simple.js'], + 'tmp/sourcemaps_multiple2.js': ['test/fixtures/src/comments.js'] + }, + options: { + sourceMap: true + } + }, + sourcemap_multipleFunctionNames: { + files: { + 'tmp/sourcemaps_multiple1_fnName.js': ['test/fixtures/src/simple.js'], + 'tmp/sourcemaps_multiple2_fnName.js': ['test/fixtures/src/comments.js'] + }, + options: { + sourceMap: true, + sourceMapName: function( dest ) { + return dest+'.fn.map'; + } + } + }, + sourcemapin: { + files: { + 'tmp/sourcemapin.js': ['test/fixtures/src/simple2.js'] + }, + options: { + mangle: false, + banner: '// Hello World\n', + sourceMap: true, + sourceMapIn: function() { + return 'test/fixtures/src/simple2.map'; + } + } + }, + sourcemap_sources: { + files: { + 'tmp/sourcemap_sources.js': ['test/fixtures/src/simple.js'] + }, + options: { + sourceMap: true, + sourceMapIncludeSources: true + } + }, + }, + + // Unit tests. + nodeunit: { + tests: ['test/*_test.js'] + } + + }); + + // task that expects its argument (another task) to fail + grunt.registerTask('expectFail', function(){ + var task = this.args.join(':'); + + var done = this.async(); + + function onComplete(error, result, code) { + grunt.log.write("\n > " + result.stdout.split("\n").join("\n > ") + "\n"); + var rv = error ? true : new Error("Task " + task + " unexpectedly passed."); + done(rv); + } + + grunt.util.spawn({ + grunt : true, + args : task + }, onComplete); + }); + + // Actually load this plugin's task(s). + grunt.loadTasks('tasks'); + + // These plugins provide necessary tasks. + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-nodeunit'); + grunt.loadNpmTasks('grunt-contrib-internal'); + + // Whenever the "test" task is run, first clean the "tmp" dir, then run this + // plugin's task(s), then test the result. + grunt.registerTask('test', [ + 'clean', + 'uglify:compress', + 'uglify:compress_mangle', + 'uglify:compress_mangle_banner', + 'uglify:no_src', + 'uglify:compress_mangle_except', + 'uglify:compress_mangle_beautify', + 'uglify:multifile', + 'uglify:sourcemap_sources', + 'uglify:comments', + 'uglify:wrap', + 'uglify:exportAll', + 'uglify:enclose', + 'uglify:sourcemap_basic', + 'uglify:sourcemap_customName', + 'uglify:sourcemap_customDir', + 'uglify:sourcemap_functionName', + 'uglify:sourcemap_multiple', + 'uglify:sourcemap_multipleFunctionNames', + 'uglify:sourcemapin', + 'uglify:sourcemap_sources', + 'nodeunit' + ]); + + // By default, lint and run all tests. + grunt.registerTask('default', ['jshint', 'test', 'build-contrib']); + +}; diff --git a/dl-tests.sh b/dl-tests.sh new file mode 100644 index 0000000..1974f4e --- /dev/null +++ b/dl-tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +tag=v0.4.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/gruntjs/grunt-contrib-uglify.git +cd grunt-contrib-uglify +git archive --prefix="test/" --format=tar tags/${tag}:test/ \ + | bzip2 > "$pwd"/tests-${tag}.tar.bz2 +git archive --prefix="docs/" --format=tar tags/${tag}:docs/ \ + | bzip2 > "$pwd"/docs-${tag}.tar.bz2 +popd diff --git a/nodejs-grunt-contrib-uglify-0.4.0-Remove-failing-test.patch b/nodejs-grunt-contrib-uglify-0.4.0-Remove-failing-test.patch new file mode 100644 index 0000000..fdf99b1 --- /dev/null +++ b/nodejs-grunt-contrib-uglify-0.4.0-Remove-failing-test.patch @@ -0,0 +1,24 @@ +From 70ef157f0454fcb643866334c001d7e9ee8b94ba Mon Sep 17 00:00:00 2001 +From: Jamie Nguyen +Date: Thu, 13 Mar 2014 17:53:00 +0000 +Subject: [PATCH] Remove failing test + +--- + test/uglify_test.js | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/test/uglify_test.js b/test/uglify_test.js +index c35388d..6505e90 100644 +--- a/test/uglify_test.js ++++ b/test/uglify_test.js +@@ -27,7 +27,6 @@ exports.contrib_uglify = { + 'sourcemap_functionName.js.fn.map', + 'deep/directory/location/source_map.js.map', + 'sourcemapin.js', +- 'sourcemapin.map', + 'sourcemap_sources.map', + 'sourcemaps_multiple1.js', + 'sourcemaps_multiple1.map', +-- +1.8.5.3 + diff --git a/nodejs-grunt-contrib-uglify.spec b/nodejs-grunt-contrib-uglify.spec new file mode 100644 index 0000000..1cd6129 --- /dev/null +++ b/nodejs-grunt-contrib-uglify.spec @@ -0,0 +1,96 @@ +%{?nodejs_find_provides_and_requires} + +%global enable_tests 0 + +Name: nodejs-grunt-contrib-uglify +Version: 0.4.0 +Release: 2%{?dist} +Summary: Minify files with UglifyJS +License: MIT +Group: System Environment/Libraries +URL: https://github.com/gruntjs/grunt-contrib-uglify +Source0: http://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-%{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-v%{version}.tar.bz2 +Source2: docs-v%{version}.tar.bz2 +Source10: dl-tests.sh +# wget https://raw.github.com/gruntjs/grunt-contrib-uglify/eb7480384888e1e09113edd7591a47f244da79a3/Gruntfile.js +Source20: Gruntfile-v%{version}.js + +# One test failing which is also failing in the upstream Travis instance. +Patch0: %{name}-0.4.0-Remove-failing-test.patch + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging + +BuildRequires: npm(grunt-cli) +BuildRequires: uglify-js + +%if 0%{?enable_tests} +BuildRequires: npm(chalk) +BuildRequires: npm(maxmin) +BuildRequires: npm(grunt-contrib-clean) +BuildRequires: npm(grunt-contrib-internal) +BuildRequires: npm(grunt-contrib-nodeunit) +%endif + +%description +%{summary}. + + +%prep +%setup -q -n package +%setup -q -T -D -a 1 -n package +%setup -q -T -D -a 2 -n package +%patch0 -p1 +cp -p %{SOURCE20} Gruntfile.js + +%nodejs_fixdep uglify-js '~2.4' + + +%build +#nothing to do + + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/grunt-contrib-uglify +cp -pr package.json tasks/ \ + %{buildroot}%{nodejs_sitelib}/grunt-contrib-uglify + +%nodejs_symlink_deps + + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +/usr/bin/grunt test +%endif + + +%files +%doc LICENSE-MIT README.md docs/ +%{nodejs_sitelib}/grunt-contrib-uglify + + +%changelog +* Wed Mar 19 2014 Jamie Nguyen - 0.4.0-2 +- 'nodejs_fixdep uglify-js' required because our dependency handler doesn't yet + support the package.json '^' notation + +* Wed Mar 12 2014 Jamie Nguyen - 0.4.0-1 +- update to upstream release 0.4.0 + +* Mon Feb 24 2014 Jamie Nguyen - 0.3.2-1 +- update to upstream release 0.3.2 + +* Fri Jun 21 2013 Jamie Nguyen - 0.2.2-1 +- initial package + diff --git a/sources b/sources index e69de29..c00af08 100644 --- a/sources +++ b/sources @@ -0,0 +1,3 @@ +a754ecc5425305f9ab698ce36bbc277f docs-v0.4.0.tar.bz2 +a695dd7d615e35bf40090b6795109d56 grunt-contrib-uglify-0.4.0.tgz +cdc7649739ce720272f62c71b1c915ce tests-v0.4.0.tar.bz2