Module reloader

Erlang module for automatically reloading modified modules during development.

Copyright © 2007 Mochi Media, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Behaviours: gen_server.

Authors: Matthew Dempsky (matthew@mochimedia.com).

Description

Erlang module for automatically reloading modified modules during development.

Function Index

all_changed/0Return a list of beam modules that have changed.
code_change/3gen_server code_change callback (trivial).
handle_call/3gen_server callback.
handle_cast/2gen_server callback.
handle_info/2gen_server callback.
init/1gen_server init, opens the server in an initial state.
is_changed/1true if the loaded module is a beam with a vsn attribute and does not match the on-disk beam file, returns false otherwise.
reload_modules/1code:purge/1 and code:load_file/1 the given list of modules in order, return the results of code:load_file/1.
start/0Start the reloader.
start_link/0Start the reloader.
stop/0Stop the reloader.
terminate/2gen_server termination callback.

Function Details

all_changed/0

all_changed() -> [atom()]

Return a list of beam modules that have changed.

code_change/3

code_change(Vsn::_OldVsn, State, Extra::_Extra) -> State

gen_server code_change callback (trivial).

handle_call/3

handle_call(Req::Args, From, State) -> tuple()

gen_server callback.

handle_cast/2

handle_cast(Req::Cast, State) -> tuple()

gen_server callback.

handle_info/2

handle_info(Info, State) -> tuple()

gen_server callback.

init/1

init(X1::[]) -> {ok, State}

gen_server init, opens the server in an initial state.

is_changed/1

is_changed(M::atom()) -> boolean()

true if the loaded module is a beam with a vsn attribute and does not match the on-disk beam file, returns false otherwise.

reload_modules/1

reload_modules(Modules::[atom()]) -> [{module, atom()} | {error, term()}]

code:purge/1 and code:load_file/1 the given list of modules in order, return the results of code:load_file/1.

start/0

start() -> ServerRet

Start the reloader.

start_link/0

start_link() -> ServerRet

Start the reloader.

stop/0

stop() -> ok

Stop the reloader.

terminate/2

terminate(Reason, State) -> ok

gen_server termination callback.


Generated by EDoc