Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (33 sloc) 2.492 kB
ce6edad @rustyio Add startup message. Update README.md.
authored
1 # Stay in Sync
2
3 ## What is it?
4
b345b65 @rustyio Clean up spacing, streamline source directory detection.
authored
5 Sync is an Erlang utility that helps you code faster by automatically compiling and hot-loading changed code.
ce6edad @rustyio Add startup message. Update README.md.
authored
6
7 ## How can I use sync?
8
9 The recommended approach is to put sync in your $ERL_LIBS directory.
10
11 cd $ERL_LIBS
12 git clone git@github.com:rustyio/sync.git
13 (cd sync; make)
14
15 Then, go in the Erlang console of an application you are developing, run `sync:go().`. You can also start sync using `application:start(sync).`
16
17 ## How does it work?
18
19 Upon startup, Sync gathers information about loaded modules, ebin directories, source files, compilation options, etc.
20
21 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.
22
23 Sync also periodically checks the last modified date of any beam files, and automatically reloads the file if it has changed.
24
25 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.
26
b159a83 @choptastic update sync_utils:get_src_dir to include a Nitrogen mode, which keeps…
choptastic authored
27 ## Using it with Nitrogen
28
29 If you are running sync with the [Nitrogen Web Framework](http://www.nitrogenproject.com), be sure to add the following line to your etc/vm.args file:
30
31 -sync sync_mode nitrogen
32
33
ce6edad @rustyio Add startup message. Update README.md.
authored
34 ## Growl Notifications
35
313c1fb @choptastic Desktop notifications for Linux using notify-send
choptastic authored
36 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. This will also work on Linux if you have **notify-send** (Fedora: `libnotify` package, Ubuntu: `libnotify-bin` package):
ce6edad @rustyio Add startup message. Update README.md.
authored
37
38 Successful compilation:
39
40 ![Successful compilation image.](http://rusty.io.s3.amazonaws.com/sync/sync_01.png)
41
42 Warnings:
43
44 ![Compilation warnings image.](http://rusty.io.s3.amazonaws.com/sync/sync_02.png)
45
46 Errors:
47
48 ![Compilation errors image.](http://rusty.io.s3.amazonaws.com/sync/sync_03.png)
b6f019e @rustyio First commit.
authored
49
4448dd5 @choptastic Update readme with growl notification enabling/disabling.
choptastic authored
50 ### Disabling Growl Notifications
b6f019e @rustyio First commit.
authored
51
4448dd5 @choptastic Update readme with growl notification enabling/disabling.
choptastic authored
52 If you find the Growl/notify-send notifications annoying, you can choose to disable them with two ways:
aaf4e45 @rustyio Convert to an application, automatically compile and reload changed m…
authored
53
4448dd5 @choptastic Update readme with growl notification enabling/disabling.
choptastic authored
54 #### 1) As an environment variable called from the command line:
55
56 -sync growl false
57 -sync growl true #this is the default
58
59 #### 2) From within the Erlang shell:
60
61 sync:growl(true). % Enable notifications
62 sync:growl(false). % Disable notifications
Something went wrong with that request. Please try again.