Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding a compile escript for use with make.

  • Loading branch information...
commit c07aa509ffd79238224f17e72da1883f770f0056 1 parent d9937dc
@archaelus archaelus authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 bin/erlydtl_compile
View
25 bin/erlydtl_compile
@@ -0,0 +1,25 @@
+#!/usr/bin/env escript
+%% -*- mode: erlang -*-
+-export([main/1]).
+
+%% External API
+
+main([Prefix, File]) ->
+ ensure(),
+ Basename = filename:basename(File, ".dtl"),
+ ModuleName = list_to_atom(string:to_lower(lists:flatten([Prefix, "_", Basename]))),
+ erlydtl_compiler:compile(File, ModuleName, [{out_dir, filename:dirname(File)}]);
+main(_) ->
+ usage().
+
+ensure() ->
+ code:add_patha("ebin"),
+ code:add_patha("lib/erlydtl/ebin"),
+ [D1,D2|_] = code:get_path(),
+ io:format("Code Path: ~p~n", [[D1,D2]]).
+
+
+usage() ->
+ io:format("usage: ~s name [destdir]~n",
+ [filename:basename(escript:script_name())]),
+ halt(1).
Please sign in to comment.
Something went wrong with that request. Please try again.