Commit graph

42 commits

Author SHA1 Message Date
Pierre Fenoll
c83d037404 Add a library template 2013-12-19 22:01:25 +00:00
Evax Software
2970fab4b7 Support conditional template instructions 2013-09-19 07:11:37 +02:00
Dave Smith
e36b9c1bff Merge pull request #59 from Vagabond/adt-read-lists-from-files
Support reading mustache 'lists' from files
2013-02-26 07:23:26 -08:00
Andrew Thompson
ee8919420d Support reading mustache 'lists' from files
This commit add support for reading mustache 'lists' from files, so you
can use the list section functionality when templating things.

An example of the list syntax is as follows:

{package_commands, {list, [[{name, "riak"}], [{name, "riak-admin"}], [{name, "search-cmd"}]]}}.

Then you can, for each of the list elements, render some text:

{{#package_commands}}
chmod +x bin/{{name}}
{{/package_commands}}
2013-01-30 16:43:29 -05:00
Tuncer Ayaz
4b8c81fb53 Implement 'rebar help CMD1 CMD2' and extend common 'rebar help' msg
* allow plugins to print help message for implemented commands
* append core rebar.config options to common 'rebar help' message
2012-12-31 20:45:11 +01:00
Tuncer Ayaz
252757c753 Do not use application:set_env 2012-07-23 13:17:11 +02:00
Tuncer Ayaz
e1c9d69d1d Do not use rebar_config:set_global in rebar_templater 2012-07-13 21:43:30 +02:00
Tuncer Ayaz
d9e6cc3d90 Do not use process dict in rebar_templater 2012-07-13 21:43:14 +02:00
Tuncer Ayaz
fd0697239d Use lists:foreach because result is ignored 2012-06-30 23:17:22 +02:00
Tuncer Ayaz
385e3f09ba Decrease indentation in list-templates printout 2012-06-30 22:28:30 +02:00
Tuncer Ayaz
49f3cc4108 Fix crash introduced in 4414f65 via pull/245 2012-06-30 22:14:08 +02:00
Tuncer Ayaz
0c27fd4f7f rebar_templater: fix comment 2012-06-30 22:13:26 +02:00
Tuncer Ayaz
8d81b322ed Fix whitespace errors 2012-06-11 19:33:16 +02:00
hirschen
4414f6548a List substitution variable names in 'list-templates' command. 2012-06-11 15:01:12 +02:00
Jesse Gumm
4f6f41cabb Fix typos in rebar_templater 2012-02-17 12:41:34 +01:00
Tuncer Ayaz
74ca540939 Use same variable names as file:make_link/2 2011-10-21 17:59:29 +02:00
Przemysław Dąbek
eb23571b8b Add possibility to make symbolic links
Simple feature, useful to make link to something without copying it.
2011-10-20 20:29:16 +02:00
Tuncer Ayaz
edf4bbc370 Fix error handling bug in {copy,In,Out} template 2011-07-18 18:58:20 +02:00
Tuncer Ayaz
a4ffe1ce62 Use filename:join/1 2011-07-18 18:58:15 +02:00
cloudhead
dd9adac8c4 Add support for {copy, src, dst} to templater 2011-07-08 11:32:23 -06:00
Dave Smith
bda6ee0e48 Centralize variable resolution; add target_dir variable 2011-04-10 16:12:50 -06:00
Dave Smith
c4907b6297 Add support for loading template vars from external file 2011-04-10 16:12:50 -06:00
Tuncer Ayaz
63de05d914 Clean up code 2011-02-06 17:41:04 +01:00
Tuncer Ayaz
c466076ffb Clean up emacs file local variables 2011-01-31 17:55:36 +01:00
Tuncer Ayaz
3b0568ebb7 Simplify and cleanup rebar_templater 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
58fd80917a Fix file existence checks 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
a8870807fc Fix code clarity 2011-01-13 17:39:14 +01:00
David Reid
63d5ceb61d Support single level of nested template variables
Add support for defining template variables of the following form:

{variables, [{appid, "mochiwebapp"},
         {author, "Mochi Media <dev@mochimedia.com>"},
         {year, "2010"},
         {version, "0.1"},
         {port, 8080},
         {dest, "{{appid}}"}]}.

Where dest may be overridden on the commandline but will default to
being the appid. Mochiweb uses this so that we can create new
projects from the template in a configurable directory.

So

$ rebar create template=mochiwebapp dest=foo appid=bar

I thought about special casing dest but figured it might be generally
useful to be able to nest template vars.

However this patch only does one level of resolution. So if

{variables, [{foo, "{{bar}}"},
                {bar, "{{foo}}"}]}.

then bar will end up being the literal string {{bar}} and foo the
literal string {{foo}}.
2010-12-22 17:56:52 +01:00
Kostis Sagonas
7dc76d578e Tidier improvements 2010-10-26 00:38:51 +02:00
Kostis Sagonas
e024778599 Dialyzer related cleanups 2010-10-10 14:11:13 -06:00
Dave Smith
b32eeeafb7 Add support for specifying template directory on the command line 2010-08-28 08:04:47 -06:00
Dave Smith
b063d3b8df Fix bug 438; add support for listing available templates 2010-08-20 09:30:37 -06:00
Tuncer Ayaz
dfb5af4049 Add forward-compatible escript_foldl function
escript:foldl/3 was undocumented and has been replaced with
better APIs post-R13B04. The new exported funs are officially
documented.
2010-03-05 22:56:31 +01:00
Dave Smith
28d3b75641 Fix bug in templater where escript was not found in subdirs were specified in rebar.config; minor formatting cleanups 2010-02-20 20:15:07 -07:00
Bryan Fink
f6feac493d provide separate 'file' and 'template' directives, instead of one 'file' directive with a boolean Render flag 2010-02-13 14:14:29 -05:00
Bryan Fink
60629e8516 add chmod template directive for changing file file permission
usage: {chmod, Mode, File}
where: Mode is an integer, as specified by the 'mode' field of the file_info record
       (see docs for file:write_file_info/2)
2010-02-04 17:45:05 -05:00
Bryan Fink
4c2dade0f4 add Render flag to 'file' template directive
{file,In,Out,true} = render with mustache
{file,In,Out,false} = do not render with mustache (leave as-is)

old-form {file,In,Out} is equivalent to {file,In,Out,true}
2010-02-04 15:52:44 -05:00
Bryan Fink
4e01b32d5d look for templates in local directory as well 2010-02-04 14:30:10 -05:00
Dave Smith
47e70f308a Add support for forcibly overwriting output files; courtesy of OJ Reeves 2010-01-30 09:56:06 -07:00
Dave Smith
ec4e805898 Adding sketch of functionality for creating a reltool node from template 2010-01-08 12:16:57 -07:00
Dave Smith
8c4f35a294 Basic implementation of templater is complete 2010-01-08 10:54:43 -07:00
Dave Smith
2d9af6cf48 Sketching out templating system 2010-01-07 22:18:55 -07:00