From 82aea119013e63c3d4864baea690c84f56890008 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Tue, 7 Oct 2008 07:01:10 +0000 Subject: [PATCH 1/1] MOD modification de jsmin.js pour traiter le js depuis stdin --- tools/jsmin.js | 27 ++++++++++--------- tools/{mise_en_prod.erl => update_server.erl} | 7 +---- 2 files changed, 16 insertions(+), 18 deletions(-) rename tools/{mise_en_prod.erl => update_server.erl} (98%) diff --git a/tools/jsmin.js b/tools/jsmin.js index 55ee654..95c275b 100644 --- a/tools/jsmin.js +++ b/tools/jsmin.js @@ -1,3 +1,5 @@ +#!/usr/bin/env rhino + /* jsmin.js - 2006-08-31 Author: Franck Marcia This work is an adaptation of jsminc.c published by Douglas Crockford. @@ -324,16 +326,17 @@ function jsmin(comment, input, level) { return comment + ret; } - -(function (a) { - if (!a[0]) { - print("Usage: jsmin.js file.js"); - quit(1); - } - var input = readFile(a[0]); - if (!input) { - print("jslint: Couldn't open file '" + a[0] + "'."); - quit(1); - } - print(jsmin(input)); + +importPackage(java.io); +(function (a) { + // in is a reserved javascript word, so we need to use [] for access + var readingIn = new BufferedReader(new InputStreamReader(java.lang.System["in"])); + var sInput = ""; + var str = ""; + while(str != null) { + sInput += str + '\n'; + + str = readingIn.readLine(); + } + print(jsmin(sInput)); })(arguments); \ No newline at end of file diff --git a/tools/mise_en_prod.erl b/tools/update_server.erl similarity index 98% rename from tools/mise_en_prod.erl rename to tools/update_server.erl index 933aceb..4211772 100755 --- a/tools/mise_en_prod.erl +++ b/tools/update_server.erl @@ -35,9 +35,4 @@ copier_bd(Node) -> rpc:call(Node, mnesia, restore, [Fichier2, [{default_op, recreate_tables}]]), rpc:call(yaws@overnux, file, delete, [Fichier]), rpc:call(Node, file, delete, [Fichier2]). - - - - - - + \ No newline at end of file -- 2.43.0