[nodejs-maxmin] Update to 0.2.0 and patch out gzip-size on f20/f19/el6
Jamie Nguyen
jamielinux at fedoraproject.org
Thu May 8 19:47:10 UTC 2014
commit 8ab028cf9051f6767e05c0b11bd6dbc5d30d0cce
Author: Jamie Nguyen <j at jamielinux.com>
Date: Thu May 8 19:59:48 2014 +0100
Update to 0.2.0 and patch out gzip-size on f20/f19/el6
.gitignore | 1 +
nodejs-maxmin-0.2.0-Remove-use-of-gzip-size.patch | 56 +++++++++++++++++++++
nodejs-maxmin.spec | 20 ++++++-
sources | 2 +-
test.js | 8 ++--
5 files changed, 79 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2f5d9b5..06e1718 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/maxmin-0.1.0.tgz
+/maxmin-0.2.0.tgz
diff --git a/nodejs-maxmin-0.2.0-Remove-use-of-gzip-size.patch b/nodejs-maxmin-0.2.0-Remove-use-of-gzip-size.patch
new file mode 100644
index 0000000..44bb18d
--- /dev/null
+++ b/nodejs-maxmin-0.2.0-Remove-use-of-gzip-size.patch
@@ -0,0 +1,56 @@
+From 1b0d94ebf7d14c90c24022720ced6d21bcbac75d Mon Sep 17 00:00:00 2001
+From: Jamie Nguyen <j at jamielinux.com>
+Date: Thu, 8 May 2014 19:22:29 +0100
+Subject: [PATCH] Remove use of gzip-size
+
+---
+ index.js | 3 +--
+ package.json | 1 -
+ test.js | 2 +-
+ 3 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/index.js b/index.js
+index b764ac9..4bc7a29 100644
+--- a/index.js
++++ b/index.js
+@@ -1,5 +1,4 @@
+ 'use strict';
+-var gzipSize = require('gzip-size');
+ var prettyBytes = require('pretty-bytes');
+ var chalk = require('chalk');
+
+@@ -15,7 +14,7 @@ module.exports = function (max, min, useGzip) {
+ var ret = format(max.length) + ' → ' + format(min.length);
+
+ if (useGzip === true) {
+- ret += ' → ' + format(gzipSize.sync(min)) + chalk.gray(' (gzip)');
++ ret += ' → ' + chalk.gray('(gzip-size unavailable)');
+ }
+
+ return ret;
+diff --git a/package.json b/package.json
+index b1ab90c..859a770 100644
+--- a/package.json
++++ b/package.json
+@@ -35,7 +35,6 @@
+ },
+ "dependencies": {
+ "chalk": "^0.4.0",
+- "gzip-size": "^0.2.0",
+ "pretty-bytes": "^0.1.0"
+ }
+ }
+diff --git a/test.js b/test.js
+index 4cf16c6..0b495d5 100644
+--- a/test.js
++++ b/test.js
+@@ -8,5 +8,5 @@ var min = 'function smoothRangeRandom(b,c){var a=Math.floor(Math.random()*(c-b+1
+
+ it('should generate correct output', function () {
+ assert.strictEqual(chalk.stripColor(maxmin(max, min)), '390 B → 334 B');
+- assert.strictEqual(chalk.stripColor(maxmin(max, min, true)), '390 B → 334 B → 120 B (gzip)');
++ assert.strictEqual(chalk.stripColor(maxmin(max, min, true)), '390 B → 334 B → gzip-size unavailable');
+ });
+--
+1.9.0
+
diff --git a/nodejs-maxmin.spec b/nodejs-maxmin.spec
index 7f7b9d0..46ce34a 100644
--- a/nodejs-maxmin.spec
+++ b/nodejs-maxmin.spec
@@ -1,19 +1,25 @@
%{?nodejs_find_provides_and_requires}
-%global enable_tests 1
+%global enable_tests 0
Name: nodejs-maxmin
-Version: 0.1.0
+Version: 0.2.0
Release: 1%{?dist}
Summary: Get pretty output of the original, minified gzipped size of a string/buffer
License: MIT
Group: System Environment/Libraries
URL: https://github.com/sindresorhus/maxmin
Source0: http://registry.npmjs.org/maxmin/-/maxmin-%{version}.tgz
-Source1: https://raw.github.com/sindresorhus/maxmin/8c64d250ce94dddb817b80f6ef06bb9a67c3db7c/test.js
+Source1: https://raw.githubusercontent.com/sindresorhus/maxmin/84b50e3e9137aa5aab9295755aab3dd7d93e1e4f/test.js
# https://github.com/sindresorhus/maxmin/pull/1
Source2: LICENSE
+# gzip-size cannot be packaged for fedora<21 or rhel<7 due to the dependency
+# on js-zlib. To make maxmin available to these older branches, we can remove
+# the use of gzip-size. This is not ideal, but better than not having the
+# package available at all.
+Patch0: %{name}-0.2.0-Remove-use-of-gzip-size.patch
+
BuildArch: noarch
%if 0%{?fedora} >= 19
ExclusiveArch: %{nodejs_arches} noarch
@@ -39,6 +45,10 @@ BuildRequires: npm(mocha)
cp -p %{SOURCE1} .
cp -p %{SOURCE2} .
+%if 0%{?fedora} < 21 || 0%{?rhel} < 7
+%patch0 -p1
+%endif
+
%build
#nothing to do
@@ -65,5 +75,9 @@ cp -pr package.json index.js \
%changelog
+* Thu May 08 2014 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.2.0-1
+- update to upstream release 0.2.0
+- disable use of gzip-size on branches where js-zlib cannot be packaged
+
* Thu Mar 13 2014 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.1.0-1
- initial package
diff --git a/sources b/sources
index df11ef2..ee2db97 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-a0fc6f81ad571bbd8d8c202481e49da8 maxmin-0.1.0.tgz
+3f54f1236fda94818b13dbe47cab4517 maxmin-0.2.0.tgz
diff --git a/test.js b/test.js
index 3b55070..4cf16c6 100644
--- a/test.js
+++ b/test.js
@@ -3,10 +3,10 @@ var assert = require('assert');
var chalk = require('chalk');
var maxmin = require('./index');
-var max = 'function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};';
-var min = '(function(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.a=a===this.a?++a:a})()';
+var max = 'function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};';
+var min = 'function smoothRangeRandom(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.prev=a===this.prev?++a:a}function smoothRangeRandom(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.prev=a===this.prev?++a:a}function smoothRangeRandom(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.prev=a===this.prev?++a:a};';
it('should generate correct output', function () {
- assert.strictEqual(chalk.stripColor(maxmin(max, min)), '130 B → 91 B');
- assert.strictEqual(chalk.stripColor(maxmin(max, min, true)), '130 B → 91 B → 53 B (gzip)');
+ assert.strictEqual(chalk.stripColor(maxmin(max, min)), '390 B → 334 B');
+ assert.strictEqual(chalk.stripColor(maxmin(max, min, true)), '390 B → 334 B → 120 B (gzip)');
});
More information about the scm-commits
mailing list