Skip to content

Commit

Permalink
rebar plugin now working
Browse files Browse the repository at this point in the history
fix #4
  • Loading branch information
zkessin committed Aug 3, 2014
1 parent af09d96 commit e1b9153
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
%% {cover_export_enabled, false}.
{cover_enabled, true}.
{cover_print_enabled, true}.

%{erl_first_files, ["src/erlog_make_server.erl"]}.
{plugins, [erlog_server_plugin]}.
14 changes: 7 additions & 7 deletions src/erlog_make_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ compile_files(false,_) ->
compile_files(true, Directory) ->
Files = filelib:wildcard(Directory ++"/*.pl"),
ModuleNames = lists:map(fun(File) ->
{ok, Module, Binary} = compile_file(File, make_module_name(File)),
BeamFile = filename:join([rebar_utils:get_cwd(),"ebin", atom_to_list(make_module_name(File) ++ ".beam")]),
ok = file:write_file(BeamFile, Binary),
make_module_name(File)
end, Files),
{ok, _Module, Binary} = compile_file(File, make_module_name(File)),
BeamFile = filename:join([rebar_utils:get_cwd(),"ebin", atom_to_list(make_module_name(File)) ++ ".beam"]),
ok = file:write_file(BeamFile, Binary),
make_module_name(File)
end, Files),
{ok,ModuleNames}.

make_module_name(File) -> list_to_atom(filename:basename(File, ".pl")).
Expand All @@ -54,8 +54,8 @@ make_module_name(File) -> list_to_atom(filename:basename(File, ".pl")).


compile_file(File,Module) when is_atom(Module)->
{ok,PL@} = erlog:new(),
{ok,PL@} = erlog:consult(PL@,File),
{ok, PL@} = erlog:new(),
{ok, PL@} = erlog:consult(PL@,File),
{ok, PL@} = erlog:consult(PL@, "src/erlog_make_server.pl"),
{Exports,PL@} = find_exports(PL@),
{ok, AST@} = load_base_ast(),
Expand Down

0 comments on commit e1b9153

Please sign in to comment.