Skip to content
Browse files

Update application file, change error messages.

  • Loading branch information...
1 parent 0a509eb commit 03054c301b1d2e7ab11065ad2964196be2d4e7a2 @rustyio committed
Showing with 9 additions and 18 deletions.
  1. +1 −0 ebin/.gitignore
  2. +0 −8 ebin/sync.app
  3. +1 −4 src/sync.app.src
  4. +7 −6 src/sync_worker.erl
View
1 ebin/.gitignore
@@ -1 +1,2 @@
+*.app
*.beam
View
8 ebin/sync.app
@@ -1,8 +0,0 @@
-{application,sync,
- [{description,"Sync - Automatic Code Reloader"},
- {vsn,"0.1"},
- {registered,[]},
- {applications,[kernel,stdlib]},
- {mod,{sync,[]}},
- {env,[{compile_inteval,1000},{out_file,"/tmp/sync.out"}]},
- {modules,[sync,sync_worker]}]}.
View
5 src/sync.app.src
@@ -1,11 +1,8 @@
{application, sync, [
{description, "Sync - Automatic Code Reloader"},
+ {applications, [kernel, stdlib]},
{vsn, "0.1"},
{registered, []},
- {applications, [
- kernel,
- stdlib
- ]},
{mod, { sync, []}},
{env, [
{compile_inteval, 1000},
View
13 src/sync_worker.erl
@@ -154,7 +154,7 @@ possibly_compile(Module) ->
put_cache({Module, warnings}, Warnings),
Msg = [
format_errors(File, Warnings, []),
- io_lib:format("~s:: Recompiled with ~p warnings~n", [File, length(Warnings)])
+ io_lib:format("~s:0: Recompiled with ~p warnings~n", [File, length(Warnings)])
],
log_sync_out_file(Msg),
error_logger:info_msg(Msg),
@@ -198,13 +198,13 @@ transform_options(Module, File, Options) ->
%% Print error messages in a pretty and user readable way.
format_errors(File, Warnings, Errors) ->
AllErrors1 = lists:sort(lists:flatten([X || {_, X} <- Errors])),
- AllErrors2 = [{Line, "error", Module, Description} || {Line, Module, Description} <- AllErrors1],
+ AllErrors2 = [{Line, "Error", Module, Description} || {Line, Module, Description} <- AllErrors1],
AllWarnings1 = lists:sort(lists:flatten([X || {_, X} <- Warnings])),
- AllWarnings2 = [{Line, "warning", Module, Description} || {Line, Module, Description} <- AllWarnings1],
+ AllWarnings2 = [{Line, "Warning", Module, Description} || {Line, Module, Description} <- AllWarnings1],
Everything = lists:sort(AllErrors2 ++ AllWarnings2),
F = fun({Line, Prefix, Module, ErrorDescription}) ->
Msg = Module:format_error(ErrorDescription),
- io_lib:format("~s:~p: (~s) ~s~n", [File, Line - 1, Prefix, Msg])
+ io_lib:format("~s:~p: ~s: ~s~n", [File, Line - 1, Prefix, Msg])
end,
[F(X) || X <- Everything].
@@ -331,8 +331,9 @@ write_sync_out_file() ->
Other ->
File = get_env(out_file, "/tmp/sync.out"),
{{Y,M,D}, {HH,MM,SS}} = calendar:local_time(),
- TS = io_lib:format("~nLast updated ~p-~p-~p ~p:~p:~p.", [Y, M, D, HH, MM, SS]),
- ok = file:write_file(File, [Other, TS])
+ Header = "-*- mode: compilation; mode: auto-revert; buffer-read-only: true; auto-revert-interval: 0.1 -*-\n\n",
+ Footer = io_lib:format("~n - Updated ~5p-~p-~p ~p\:~p\:~p~n", [Y, M, D, HH, MM, SS]),
+ ok = file:write_file(File, [Header, Other, Footer])
end.
get_env(Var, Default) ->

0 comments on commit 03054c3

Please sign in to comment.
Something went wrong with that request. Please try again.