Permalink
Browse files

Add a rescan method. Update readme.

  • Loading branch information...
1 parent c9833b5 commit 3be84c773d18d2cc4899f5da8729753afcaed338 @rustyio committed Apr 15, 2011
Showing with 19 additions and 29 deletions.
  1. +1 −22 README.markdown
  2. +6 −1 src/sync.erl
  3. +12 −6 src/sync_scanner.erl
View
@@ -9,25 +9,4 @@ 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.
-
-*** EMACS PRO TIP ***
-
-Sync outputs Emacs friendly compiler messages. This means you can
-navigate directly to your error messages with a single click.
-
-Simply:
-
-1. Open a `shell` or `eshell` buffer.
-2. `tail -f *` on your log directory.
-3. Turn on `compilation-minor-mode`.
-
-
-# New Solution
-+ Create an index of every module in the system to every file on disk.
-+ Using the modules, create an index of .hrl files to .beam files.
-+ Create a list of unique directories in modules from previous step.
-+ Create an index of every .hrl file in every directory, including the local directory.
-+ Create an index of every .erl file in every directory, including the local directory.
-+ Check the last update time of each src file.
-+ If it's newer than the module, then recompile.
+Compilation errors are logged using the error_logger.
View
@@ -8,6 +8,7 @@
%% API.
-export ([
+ start/0,
go/0,
stop/0
]).
@@ -27,9 +28,13 @@
%% API
%% ----------------------------------------------------------------------
-go() ->
+start() ->
application:start(sync).
+go() ->
+ application:start(sync),
+ sync_scanner:rescan().
+
stop() ->
application:stop(sync).
View
@@ -5,7 +5,8 @@
%% API
-export([
- start_link/0
+ start_link/0,
+ rescan/0
]).
%% gen_server callbacks
@@ -33,16 +34,21 @@
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
-init([]) ->
- %% Trap exits to catch failing processes...
- erlang:process_flag(trap_exit, true),
-
- %% Kick off the discovery process...
+rescan() ->
+ io:format("Scanning source files...~n"),
gen_server:cast(?SERVER, discover_modules),
gen_server:cast(?SERVER, discover_src_dirs),
gen_server:cast(?SERVER, discover_src_files),
gen_server:cast(?SERVER, compare_beams),
gen_server:cast(?SERVER, compare_src_files),
+ ok.
+
+init([]) ->
+ %% Trap exits to catch failing processes...
+ erlang:process_flag(trap_exit, true),
+
+ %% Kick off the discovery process...
+ rescan(),
%% Create the state and return...
State = #state {

0 comments on commit 3be84c7

Please sign in to comment.