Skip to content

Commit

Permalink
Add startup message. Update README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyio committed Jun 30, 2011
1 parent 25bb9ea commit ce6edad
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
50 changes: 41 additions & 9 deletions README.markdown
@@ -1,12 +1,44 @@
# Sync: Recompile and Reload Changed Erlang Code
# Stay in Sync

## What is it?

Sync is an Erlang utility that helps you code faster by automatically compiling and hot-loading code into a running system.

## How can I use sync?

The recommended approach is to put sync in your $ERL_LIBS directory.

cd $ERL_LIBS
git clone git@github.com:rustyio/sync.git
(cd sync; make)

Then, go in the Erlang console of an application you are developing, run `sync:go().`. You can also start sync using `application:start(sync).`

## How does it work?

Upon startup, Sync gathers information about loaded modules, ebin directories, source files, compilation options, etc.

Sync then periodically checks the last modified date of source files. If a file has changed since the last scan, then Sync automatically recompiles the module using the previous set of compilation options. If compilation was successful, it loads the updated module. Otherwise, it prints compilation errors to the console.

Sync also periodically checks the last modified date of any beam files, and automatically reloads the file if it has changed.

The scanning process adds 1% to 2% CPU load on a running Erlang VM. Much care has been taken to keep this low. Shouldn't have to say this, but this is for development mode only, don't run it in production.

## Growl Notifications

If you are running a Mac and have [Growl](http://growl.info) and the **growlnotify** utility installed, Sync will pop up Growl notifications with compilation results:

Successful compilation:

![Successful compilation image.](http://rusty.io.s3.amazonaws.com/sync/sync_01.png)

Warnings:

![Compilation warnings image.](http://rusty.io.s3.amazonaws.com/sync/sync_02.png)

Errors:

![Compilation errors image.](http://rusty.io.s3.amazonaws.com/sync/sync_03.png)

Sync is a developer tool to help you hot-load changed code in an
Erlang system.

When you start the application using `sync:go()` or
`application:start(sync)`, the system automatically starts checking
for changes to all loaded modules (except for Erlang system
modules). Sync will recompile and reload the module if the source has
changed, or if any include files for a module have changed.

Compilation errors are logged using the error_logger.
3 changes: 3 additions & 0 deletions src/sync_scanner.erl
Expand Up @@ -56,6 +56,9 @@ init([]) ->
%% Kick off the discovery process...
rescan(),

%% Display startup message...
growl("success", "Sync", "The Sync utility is now running."),

%% Create the state and return...
State = #state {
modules = [],
Expand Down

0 comments on commit ce6edad

Please sign in to comment.