[Pkg-javascript-commits] [sockjs-client] 434/434: Use optimist for option parsing rather than optparse-js, which hardly anybody uses at all.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit 20ab062f4891846a9d369eb45171f9a2fbb1de15
Author: Tonnerre LOMBARD <tonnerre at ancient-solutions.com>
Date:   Wed Jan 8 01:44:11 2014 +0100

    Use optimist for option parsing rather than optparse-js, which hardly
    anybody uses at all.
---
 debian/control                                 |  2 +-
 debian/patches/fix-coffee-path.patch           | 23 ++++++++-
 debian/patches/series                          |  1 +
 debian/patches/use-optimist-not-optparse.patch | 70 ++++++++++++++++++++++++++
 4 files changed, 93 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index c22b646..adc5f25 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: sockjs-client
 Section: web
 Priority: optional
 Maintainer: Tonnerre LOMBARD <tonnerre at ancient-solutions.com>
-Build-Depends: coffeescript, debhelper (>= 9), libjs-optparse, node-static,
+Build-Depends: coffeescript, debhelper (>= 9), node-optimist, node-static,
  node-uglify, nodejs
 Standards-Version: 3.9.5
 Homepage: https://github.com/sockjs/sockjs-client
diff --git a/debian/patches/fix-coffee-path.patch b/debian/patches/fix-coffee-path.patch
index dc10a05..7750440 100644
--- a/debian/patches/fix-coffee-path.patch
+++ b/debian/patches/fix-coffee-path.patch
@@ -12,8 +12,8 @@ Last-Update: 2013-12-31
 
 Index: sockjs/Makefile
 ===================================================================
---- sockjs.orig/Makefile	2013-12-31 15:41:41.000000000 +0100
-+++ sockjs/Makefile	2013-12-31 19:26:42.848006583 +0100
+--- sockjs.orig/Makefile	2014-01-08 00:55:02.649234975 +0100
++++ sockjs/Makefile	2014-01-08 01:18:15.155428456 +0100
 @@ -1,6 +1,6 @@
  .PHONY: all build tests test serve clean
  
@@ -22,6 +22,25 @@ Index: sockjs/Makefile
  
  all: sockjs.js
  
+@@ -8,15 +8,15 @@
+ 
+ sockjs.js: lib/*js version
+ 	@$(COFFEE) -v > /dev/null
+-	$(COFFEE) bin/render.coffee --set-version $(VER) lib/all.js > $@
++	$(COFFEE) bin/render.coffee --set-version "$(VER)" lib/all.js > $@
+ 
+ sockjs.min.js: lib/*js version
+ 	@$(COFFEE) -v > /dev/null
+-	$(COFFEE) bin/render.coffee --set-version $(VER) --minify lib/all.js > $@
++	$(COFFEE) bin/render.coffee --set-version "$(VER)" --minify lib/all.js > $@
+ 
+ sockjs.pretty.js: lib/*js version
+ 	@$(COFFEE) -v > /dev/null
+-	$(COFFEE) bin/render.coffee --set-version $(VER) --minify --pretty lib/all.js > $@
++	$(COFFEE) bin/render.coffee --set-version "$(VER)" --minify --pretty lib/all.js > $@
+ 
+ tests/html/lib/sockjs.js: sockjs.js
+ 	cp $< $@
 @@ -31,7 +31,7 @@
  
  test: tests
diff --git a/debian/patches/series b/debian/patches/series
index 5567c73..668336f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix-coffee-path.patch
+use-optimist-not-optparse.patch
diff --git a/debian/patches/use-optimist-not-optparse.patch b/debian/patches/use-optimist-not-optparse.patch
new file mode 100644
index 0000000..f28898d
--- /dev/null
+++ b/debian/patches/use-optimist-not-optparse.patch
@@ -0,0 +1,70 @@
+Description: Use optimist instead of optparse-js
+ Most JavaScript projects use optimist to parse arguments. Using optparse-js
+ for the build scripts here adds an unnecessary dependency on a package
+ most people don't use anyway, so we patch it out.
+Author: Tonnerre LOMBARD <tonnerre at ancient-solutions.com>
+Forwarded: no
+Last-Update: 2014-01-08
+
+Index: sockjs/bin/render.coffee
+===================================================================
+--- sockjs.orig/bin/render.coffee	2014-01-08 01:19:14.872211594 +0100
++++ sockjs/bin/render.coffee	2014-01-08 01:41:23.549438721 +0100
+@@ -9,7 +9,7 @@
+ 
+ fs = require('fs')
+ uglify = require('uglify-js')
+-optparse = require('optparse')
++optimist = require('optimist')
+ 
+ array_flatten = (arr, acc) ->
+     if typeof acc is 'undefined'
+@@ -86,20 +86,34 @@
+ 
+ 
+ main = ->
+-    switches = [
+-        ['-p', '--pretty', 'Prettify javascript']
+-        ['-m', '--minify', 'Minify javascript']
+-        ['-s', '--set-version [VERSION]', 'Set the value of version tag']
+-    ]
+-    options = {minify: false, toplevel: true, version: 'unknown'}
+-    parser = new optparse.OptionParser(switches)
+-    parser.on 'pretty', ->
+-                   options.beautify = true
+-    parser.on 'minify', ->
+-                   options.minify = true
+-    parser.on 'set-version', (_, version) ->
+-                   options.version = version
+-    filenames = parser.parse((process.ARGV || process.argv).slice(2))
++    argv = optimist.options({
++        'c': {
++            alias: 'comment',
++            default: false,
++            describe: 'Add comments',
++        },
++        'm': {
++            alias: 'minify',
++            default: true,
++            describe: 'Minify javascript',
++        },
++        'p': {
++            alias: 'pretty',
++            default: true,
++            describe: 'Prettify javascript',
++        },
++        's': {
++            alias: 'set-version',
++            default: 'unknown',
++            describe: 'Set the value of version tag',
++        }})
++        .boolean('c')
++        .boolean('m')
++        .boolean('p')
++        .string('s')
++        .argv
++    options = {comment: argv.comment, minify: argv.minify, pretty: argv.pretty, toplevel: true, version: (argv.s || "unknown")}
++    filenames = argv._
+ 
+     content = for filename in filenames
+         render(filename, '', options)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list