Skip to content

List support for doc_root and source_ext options. #257

Closed
wants to merge 1 commit into from

3 participants

@glejeune
glejeune commented Apr 5, 2014

doc_root and source_ext can now receive lists as parameters. This is
particularly useful when using ErlyDTL if you want to have multiple
extensions (.html, .xml, ...) in many locations. Example :

{erlydtl opts, [
    {doc_root, ["xml", "html"]},
    {source_ext, [".xml", ".html"]},
]}.

Note that the current format (with just a string) is still supported.

@glejeune glejeune List support for doc_root and source_ext options.
doc_root and source_ext can now receive lists as parameters. This is
particularly useful when using ErlyDTL if you want to have multiple
extensions (.html, .xml, ...) in many locations. Example :

    {erlydtl opts, [
        {doc_root, ["xml", "html"]},
        {source_ext, [".xml", ".html"]},
    ]}.

Note that the current format (with just a string) is still supported.
859145a
@tuncer
tuncer commented May 29, 2014

Not sure about this, but before it can be merged, it's best to extend at least eunit and erlc tests and document the new feature. Also, the changes in rebar_base_compiler.erl should be formatted with erlang.el (erlang-mode).

@tuncer tuncer commented on the diff May 29, 2014
src/rebar_base_compiler.erl
@@ -59,6 +59,21 @@ run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt,
run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt,
Compile3Fn, Opts) ->
+ ListExt = case is_flat_list(SourceExt) of
+ true -> [SourceExt];
+ _ -> SourceExt
+ end,
+ ListDir = case is_flat_list(SourceDir) of
+ true -> [SourceDir];
+ _ -> SourceDir
+ end,
+ lists:foldl(fun({SourceDir1, SourceExt1}, _) ->
+ run_(Config, FirstFiles, SourceDir1, SourceExt1,
+ TargetDir, TargetExt, Compile3Fn, Opts)
+ end, ok, [{D, E} || D <- ListDir, E <- ListExt]).
@tuncer
tuncer added a note May 29, 2014

If you want to ignore the result of the lists:foldl call, please change it to _ = lists:foldl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ferd ferd added the enhancement label Jun 16, 2014
@tuncer
tuncer commented Apr 2, 2015

ping?

@tuncer
tuncer commented May 12, 2015

ping?

@tuncer
tuncer commented Jun 1, 2015

ping?

@ferd
ferd commented Jun 1, 2015

This is obviously dead. 1 year since the last involvement of the author, over a month of pings. Closing. If anything else comes up, we'll reopen and handle it.

@ferd ferd closed this Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.