<div class="gmail_quote">On 5 October 2011 15:29, Joel Reymont <span dir="ltr"><<a href="mailto:joelr1@gmail.com">joelr1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
rebar is being too clever here.<br><br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Suppose you are using git and are in the top level of the project when building, as you should be.<br>
<br>
rebar will default the version to "git describe --always --tags `git log -n 1 --pretty=format:%h .`".<br>
<br>
</blockquote><div><br></div><div>So at the moment if you do {vsn, git} that is what rebar will do. As an alternative, it would be nice if rebar would allow {vsn, {scm, CmdString}} so you can customise this. *BUT*... </div>
<div><br></div><div>Rebar already has a few ways to customise what's happening. There are plugins written in Erlang, which can hook into any command and run either before, during or after the command is executed, or can add completely new commands. There are also shell hooks that can run before or after any known command. I suspect there is a need for the maintainers to keep the number of extensibility points/hooks to a minimum in order to remain sane.</div>
<div><br></div><div>Nevertheless, I've patched rebar to support this syntax here: <a href="https://github.com/hyperthunk/rebar/tree/custom-vsn-commands">https://github.com/hyperthunk/rebar/tree/custom-vsn-commands</a> - I might make a pull request of it but let's see what people think first as it might not be the best approach. You would use it like so:</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; background-color: rgb(230, 241, 246); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal 'Bitstream Vera Sans Mono', Courier, monospace; max-width: 100%; white-space: pre-wrap; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 14px; color: rgb(115, 127, 132); text-shadow: rgba(255, 255, 255, 0.496094) 0px 1px; ">
{application, doodah,
 [
  {vsn, {scm, "git rev-parse --short HEAD"}}]}.</pre></span></div><div><br></div><div><br></div></div>