[erlang-questions] "Automatic" recompile app from a console

Sergej Jurecko sergej.jurecko@REDACTED
Sat Feb 2 09:58:16 CET 2013

We actually were not aware of sync and developed our own similar solution. 
It simply works by monitoring ~/ebin, ~/etc, ~/src,~/include,~/apps/../ebin,~/apps/.../src,~/apps/.../dtl,~/deps/../ebin
We have a lot of django template files and we put them in dtl folders. They get compiled with erlydtl.
If a .hrl file gets changed, all source files get compiled for that project as well. For instance hrlname.hrl, will cause all sources that start with hrlname_ to get compiled. 
Same with base django template files. if file name is projectname_base.dtl, every .dtl file that starts with projectname_ will get compiled.

We use one large repository for all projects and because there are quite a few apps at the moment, we have simple C/C++ programs that use platform specific APIs for file notifications (FSEvents for osx, inotify for linux). They are pretty trivial one file sources that get compiled automatically on erlang startup if they are not compiled yet. Then they are run with open_port and communicate via stdout.

If anyone wants to make use of those C/C++ file notification programs we can gladly open source them. 


On Feb 2, 2013, at 9:39 AM, Dmitry Klionsky wrote:

> We use modified version of sync https://github.com/ten0s/sync that supports releases, detects new files, and monitors changes in include files (at least it should, don't use this feature often) as far as the next requirements are met:
> 1. Make sync somehow available to your release. Include it into your release or put it in the erlang libs.
> 2. Build the project with debug_info.
> 3. Remove {debug_info, strip} from reltool.config
> 4. Add {excl_archive_filters, [".*"]} to reltool.config
> 5. Start sync:start() before making any changes.
> 6. Disable any growl notifications (optional)
> We also edit files in emacs with flymake mode enabled using custom erlang syntax checker for *.erl, *.hrl, *.config files https://github.com/ten0s/syntaxerl
> In general our workflow is:
> 1. Build the project with rebar
> $ make
> 2. Start it in the console mode
> $ make console
> 3. Start sync
> > sync:start().
> 4. Now start edit files. Whenever flymake says that the file is OK pretty soon sync will reload it. This workflow works fine until you need to make big changes like adding a child to a supervisor or make a new application. In this case go to point 1 and start over.
> Hope this helps.
> On 02/01/2013 12:08 AM, John Kemp wrote:
>> Hi,
>> I have been writing an application using rebar to build the app. I run the server and open a console. I then change the source code and apparently I need to leave the console, 'make rel' and restart the app and the console.
>> I'm sure there's a better way to do what I'm doing.
>> One project I found is https://github.com/rustyio/sync, but this did not (yet) work for me according to the instructions.
>> How can I have my rebar (or just Erlang) app automatically recompile ('make rel') when one of the source files changes, or run a command from within the console to do this?
>> Cheers,
>> JohnK
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> -- 
> Best regards,
> Dmitry Klionsky
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list