Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 68EAB10CF1 for ; Tue, 7 Jan 2014 19:49:30 +0000 (UTC) Received: (qmail 71722 invoked by uid 500); 7 Jan 2014 19:49:30 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 71640 invoked by uid 500); 7 Jan 2014 19:49:30 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 71492 invoked by uid 99); 7 Jan 2014 19:49:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jan 2014 19:49:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 162A839E7D; Tue, 7 Jan 2014 19:49:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benoitc@apache.org To: commits@couchdb.apache.org Date: Tue, 07 Jan 2014 19:49:31 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: updated refs/heads/1994-merge-rcouch to c1521cb generate main.js and main-coffee.js Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c1521cb8 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c1521cb8 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c1521cb8 Branch: refs/heads/1994-merge-rcouch Commit: c1521cb814c742ab90f7897766f9094cc305ab86 Parents: ee937a6 Author: Benoit Chesneau Authored: Tue Jan 7 20:44:42 2014 +0100 Committer: Benoit Chesneau Committed: Tue Jan 7 20:44:42 2014 +0100 ---------------------------------------------------------------------- rebar.config | 2 ++ support/build_js.escript | 47 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/c1521cb8/rebar.config ---------------------------------------------------------------------- diff --git a/rebar.config b/rebar.config index 1770f5f..d224e9e 100644 --- a/rebar.config +++ b/rebar.config @@ -46,3 +46,5 @@ "apps/couch_rel", "rel" ]}. + +{post_hooks, [{compile, "escript support/build_js.escript"}]}. http://git-wip-us.apache.org/repos/asf/couchdb/blob/c1521cb8/support/build_js.escript ---------------------------------------------------------------------- diff --git a/support/build_js.escript b/support/build_js.escript new file mode 100644 index 0000000..538dda9 --- /dev/null +++ b/support/build_js.escript @@ -0,0 +1,47 @@ +%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ft=erlang ts=4 sw=4 et + +%% Licensed under the Apache License, Version 2.0 (the "License"); you may not +%% use this file except in compliance with the License. You may obtain a copy of +%% the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +%% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +%% License for the specific language governing permissions and limitations under +%% the License. +%% +%% + +-export([main/1]). + + +main([]) -> + JsFiles = ["share/server/json2.js", + "share/server/filter.js", + "share/server/mimeparse.js", + "share/server/render.js", + "share/server/state.js", + "share/server/util.js", + "share/server/validate.js", + "share/server/views.js", + "share/server/loop.js"], + + CoffeeFiles = ["share/server/coffee-script.js", + "share/server/loop.js"], + + + Concat = fun(Files, To) -> + AccBin = lists:foldl(fun(Path, Acc) -> + {ok, Bin} = file:read_file(Path), + [Bin | Acc] + end, [], Files), + FinalBin = iolist_to_binary(lists:reverse(AccBin)), + file:write_file(To, FinalBin) + end, + + ok = Concat(JsFiles, "share/server/main.js"), + ok = Concat(CoffeeFiles, "share/server/main-coffee.js"), + ok.