Make it more erlang-esque

pmods are going away, use prefixed namespaces.
This commit is contained in:
Carlos Martín Nieto
2013-01-23 16:12:48 +01:00
parent 7ac46fbf5e
commit 6dea8e6930
6 changed files with 57 additions and 52 deletions

35
src/geef_repo.erl Normal file
View File

@@ -0,0 +1,35 @@
-module(geef_repo).
-export([open/1, init/2, path/1, workdir/1, is_bare/1, references/1]).
-record(repo, {handle}).
path(#repo{handle=Handle}) ->
geef:repository_get_path(Handle).
workdir(#repo{handle=Handle}) ->
geef:repository_get_workdir(Handle).
is_bare(#repo{handle=Handle}) ->
geef:repository_is_bare(Handle).
references(#repo{handle=Handle}) ->
geef:reference_list(Handle).
-spec open(iolist()) -> {ok, term()} | {error, term()}.
open(Path) ->
case geef:repository_open(Path) of
{ok, Handle} ->
{ok, #repo{handle=Handle}};
Other ->
Other
end.
-spec init(iolist(), boolean()) -> {ok, term()} | {error, term()}.
init(Path, Bare) ->
case geef:repository_init(Path, Bare) of
{ok, Handle} ->
{ok, #repo{handle=Handle}};
Other ->
Other
end.