couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [3/3] git commit: updated refs/heads/1994-merge-rcouch to c1521cb
Date Tue, 07 Jan 2014 19:49:31 GMT
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 <benoitc@apache.org>
Authored: Tue Jan 7 20:44:42 2014 +0100
Committer: Benoit Chesneau <benoitc@apache.org>
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.


Mime
View raw message