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

Judson Lester <>
Fri Feb 1 21:41:05 CET 2013


On a related note, has anyone written Common Test hooks to compile/reload
the CUT modules before running tests?  When I get back to Erlang, it's the
top of my list, but I really wouldn't complain if it's been done already.

Judson


On Fri, Feb 1, 2013 at 12:01 PM, Diego Llarrull
<>wrote:

> Hello everyone,
>
> I'm working on a riak_core based project, that is, one which uses rebar +
> GNU make and where the src files are located  in different folders than the
> beam files, which are inside inside zipped (.ez) files.
>
> sync + libnotify will do the trick for unzipped files, but some extra
> trickery was needed to load the new .beam files
>
> a) compile the modified sources
> b) (create and) run a script that generates the .zip files containing the
> .beams and deploys those files in their destination directory
> c) run the following code:
>
> reload() ->
>     Modules = [ X || {X,L} <- code:all_loaded(), is_list(L),string:str(L,
> ?PATH_TO_CODE_DIR) =/= 0],
>     lists:map(fun(X) -> c:l(X) end, Modules).
>
> Hope this helps anyone, right now I'm trying out ssync to see if it is
> able to handle zipped files.
>
> Best regards,
>
> Diego
>
>
> On 01/02/13 16:09, Serge Aleynikov wrote:
>
>> Hi Scott,
>>
>> Nice to know I'm not the only one finding it useful!  ;-)
>>
>> Other than for auto-compilation/loading of erlydtl templates, I also
>> find that having control over the moment of code loading is more
>> advantageous, as the function shows what modules were loaded, so you
>> know what version of code is running.
>>
>> Concerning the user_default, I believe I added a couple more useful
>> functions there (i.e tc/2, tc/4) after I published this module a while
>> back.  Enjoy!  ;-)
>>
>> Serge
>>
>> On 2/1/2013 1:21 PM, Scott Lystig Fritchie wrote:
>>
>>> Serge Aleynikov <> wrote:
>>>
>>> sa> [1] https://github.com/saleyn/**util/blob/master/src/user_**
>>> default.erl<https://github.com/saleyn/util/blob/master/src/user_default.erl>
>>>
>>> Howdy, Serge.  I've been using the l() function from that
>>> user_default.erl module for years.  It's tremendously handy.  There are
>>> times where I want to reload several modules after recompiling but load
>>> them sometime at my choosing rather than immediately after the compiler
>>> is done.  l() does that.
>>>
>>> -Scott
>>>
>>>  ______________________________**_________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>>
>
> ______________________________**_________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130201/2e99dc6d/attachment.html>


More information about the erlang-questions mailing list