summaryrefslogtreecommitdiff
path: root/src/rebar_templater.erl
Commit message (Collapse)AuthorAgeFilesLines
* OTP-21 readiness, Full Unicode supportFred Hebert2017-11-161-1/+2
| | | | | | | | | | | | This replaces all deprecated function usage by alternative ones based on a version switch enacted at compile time, preventing all warnings. This will likely introduce some possible runtime errors in using a Rebar3 compiled on OTP-20 or OTP-21 back in versions 19 and earlier, but we can't really work around that. A bunch of dependencies have been updated to support OTP-21 without warnings as well.
* Unicode support in all the placesFred Hebert2017-08-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done through 3 main change groups: - replacing `~s` by `~ts` in format strings, so that strings that contain unicode are properly printed rather than crashing - adding the `unicode` argument to all function of the `re` module to ensure transformations on strings containing unicode data are valid instead of crashing (see issue #1302) - replacing `ec_cnv:to_binary/1` and `ec_cnv:to_list/1` with matching functions in `rebar_utils`. The last point has been done, rather than modifying and updating erlware commons, because binary and list conversions can be a contentious subject. For example, if what is being handled is actually bytes from a given binary stream, then forcing a byte-oriented interpretation of the data can corrupt it. As such, it does not appear safe to modify erlware commons' conversion functions since it may not be safe for all its users. Instead, rebar3 reimplements a subset of them (only converting atoms and chardata, ignoring numbers) with the explicit purpose of handling unicode string data. Tests were left as unchanged as possible. This may impact the ability to run rebar3's own suites in a unicode path, but respects a principle of least change for such a large patch.
* Add support for global plugin-defined templatesFred Hebert2017-02-061-0/+11
| | | | | Did not really know how to automate the testing for this, did it by hand.
* See template local install same builtin as escriptFred Hebert2017-01-211-7/+13
| | | | | | | | | | | | When the `new` command is run from a locally installed rebar3 (`rebar3 local install`), the builtin templates would be labelled as custom because of directories. This patch fixes it by splitting off the rebar3 priv dir from the user's configured plugin path for custom ones, and introducing a new internal label for builtins (since handling must remain different from escripts) This fixes issue #819
* Fix regex match for ignored fileFred Hebert2016-12-091-1/+1
| | | | | | | The regex mistakenly matched too many files (any character followed by an underscore) rather than only files starting in '._' This properly escapes the expressions to work in all cases.
* Restrict regexp to match on files starting with '._'Roberto Aloi2016-12-061-1/+1
|
* template_dir option was forgotten in documentation plus recurse in directory ↵Sébastien Serre2016-07-231-1/+1
| | | | added
* Unquote templates, add a warning instead.Fred Hebert2016-01-101-0/+25
|
* Plugin templates enabledFred Hebert2015-12-191-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets a plugin define templates to be loaded: $ rebar3 new ... proper (plugin): A basic PropEr suite for an OTP application ... $ rebar3 new help proper proper: plugin template (...) Description: A basic PropEr suite for an OTP application Variables: name="suite" (...) ... → rebar3 new proper fakesuite ===> Writing test/prop_fakesuite.erl In this case, proper is a fake template file I've put by hand in _build/default/plugins/rebar3_proper/priv/<somename>/, meaning it will only work as far as it's called from the project's root. The priority order of plugins is now .config > plugin > built-in, such that someone could ensure plugins do not crush their own private templates, but also that custom or plugin templates do overtake built-in ones. It used to be Built-in > .config only. Templates are searched for recursively in the priv/ directory of plugins.
* A bad template index does not crash; shows warningFred Hebert2015-12-181-6/+12
| | | | | | | | This should fix #955 The test is implicit as a bad index previously silently crashed rebar3. By adding the bad index to the `new` suite's files, we can show that things keep running.
* hooks/artifacts are always run/resolved from an app unless at top of umbrellaTristan Sloughter2015-09-061-1/+2
|
* use bbmustache packageTristan Sloughter2015-06-211-1/+1
|
* update mustache to v0.3.0 and relx to 2.0.0Tristan Sloughter2015-05-081-1/+1
|
* use mustache as a depTristan Sloughter2015-05-061-1/+1
|
* switch mustache imlementation to https://github.com/soranoba/mustacheTristan Sloughter2015-05-051-5/+1
|
* remove use of erlydtl in rebarTristan Sloughter2015-04-291-57/+24
|
* support templates even when not run as escriptTristan Sloughter2015-04-241-7/+25
|
* support for 18.0+Tristan Sloughter2015-04-231-1/+1
|
* update hg username and email match in templatesTristan Sloughter2015-03-171-1/+1
|
* fix debug format to avoid crash with custom templateMariano Guerra2015-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | error before: ===> Uncaught error: {'EXIT', {badarg, [{io,format, [<0.23.0>, "\e[0;36m===> Skipping template ~p, due to presence of a custom template at ~s~n~n\e[0m", ["/home/mariano/.config/rebar3/templates/fn_app/fn_app.template"]], []}, {rebar_templater,prioritize_templates,2, [{file,"src/rebar_templater.erl"},{line,330}]}, {rebar_templater,find_templates,1, [{file,"src/rebar_templater.erl"},{line,274}]}, {rebar_templater,new,4, [{file,"src/rebar_templater.erl"},{line,47}]}, {rebar_prv_new,do,1, [{file,"src/rebar_prv_new.erl"},{line,44}]}, {rebar_core,do,2, [{file,"src/rebar_core.erl"},{line,129}]}, {rebar3,main,1, [{file,"src/rebar3.erl"},{line,46}]}, {escript,run,2, [{file,"escript.erl"},{line,752}]}]}}
* templater: return error, don't throw, if git or hg failTristan Sloughter2015-03-081-3/+3
|
* use git or hg configs if exist for default user and email in templatesTristan Sloughter2015-03-051-2/+29
|
* follow xdg standard. fixes #122Tristan Sloughter2015-02-191-13/+11
|
* Add support for custom templates in subdirectoriesFred Hebert2014-12-231-1/+1
| | | | - Includes tests for templates and their application
* don't store global state variables in opts dictTristan Sloughter2014-12-061-1/+1
|
* move dir functions from utils to new module rebar_dirTristan Sloughter2014-12-011-2/+2
|
* Drop search for templates in cwdFred Hebert2014-11-231-2/+1
| | | | | | | | | | | | Templates should only be in ~/.rebar3/templates and the built-in ones, bar some specific overrides someone may want. Looking recursively for templates in the CWD (.) may end up searching nearly forever if the project is being created at the top of a very deep directory tree, with extremely unlikely chances to find relevant templates. It causes more problems than benefits.
* Minor template fixesFred Hebert2014-11-141-1/+1
| | | | | | - The OTP app template now adds the supevisor - The default apps_dir value does not contain the trailing '/' that the template index already added.
* use CONFIG_DIR of rebar3 for config directoriesTristan Sloughter2014-11-101-4/+4
|
* Allow to forcibly overwrite files with templatesFred Hebert2014-11-111-24/+24
|
* Redo templates with docs and whatnotFred Hebert2014-11-101-286/+197
| | | | | This totally breaks compatibility with rebar2, and maybe it shouldn't have.
* handle throw by relxTristan Sloughter2014-11-081-5/+5
|
* down to last 2 dialyzer errorsTristan Sloughter2014-09-211-1/+1
|
* more dialyzer fun. no likey opaque typesTristan Sloughter2014-09-211-1/+1
|
* add plugin templateTristan Sloughter2014-09-201-0/+2
|
* wip: move to erlydtl for rebar templatesTristan Sloughter2014-09-171-16/+30
|
* update templatingTristan Sloughter2014-09-161-13/+14
|
* use INFO instead of CONSOLE in templaterTristan Sloughter2014-08-241-3/+3
|
* add some templatesTristan Sloughter2014-08-241-5/+4
|
* rename deps providerTristan Sloughter2014-08-231-31/+31
|
* allow new project dir for templateTristan Sloughter2014-08-231-9/+11
|
* add back templatingTristan Sloughter2014-08-231-54/+17
|
* Fix OS X resource fork handling (Reported-by: Richard O'Keefe)Tuncer Ayaz2014-07-251-1/+1
| | | | | | | | | If you happen to fetch a zip archive of the git repo and try to build from that, you may, for example, ask erlc to build src/._rebar.erl. ._* are OS X resource forks and not real .erl files. This may also happen with network filesystems on OS X. To fix that, limit the files compiled by rebar to include only those which start with a letter or a digit.
* Merge pull request #195 from fgallaire/switch_template_instructionsTristan Sloughter2014-06-141-0/+12
|\ | | | | Switch template instructions
| * A switch variable can have multiple valuesFlorent Gallaire2013-12-111-3/+4
| |
| * Support switch template instructionsFlorent Gallaire2013-12-111-0/+11
| |
* | Fix #226Tuncer Ayaz2014-03-111-1/+2
| | | | | | | | | | | | Running 'rebar list-templates' can take quite a long time, when it has to search the file system. To fix that, make list-templates not recurse by default. To enable recursion, run 'rebar -r list-templates'.
* | Fix #187 (rename mustache to rebar_mustache)Tuncer Ayaz2014-01-011-1/+1
| |
* | Add a library templatePierre Fenoll2013-12-191-0/+11
|/
* Support conditional template instructionsEvax Software2013-09-191-0/+21
|