Expand daemon public interface; minor fix.
Added: - zx_daemon:dir/1 - zx_daemon:dirv/1 - zx_daemon:argv/0 - zx_daemon:meta/0 Fixed: - `zx remove mirror`
This commit is contained in:
parent
107a3e466b
commit
fac2aaf6b6
@ -1 +1 @@
|
||||
0.10.6
|
||||
0.10.7
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{application,zx,
|
||||
[{description,"An Erlang development tool and Zomp user client"},
|
||||
{vsn,"0.10.6"},
|
||||
{vsn,"0.10.7"},
|
||||
{applications,[stdlib,kernel]},
|
||||
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
|
||||
zx_lib,zx_local,zx_net,zx_peer,zx_peer_man,
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -24,7 +24,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -47,7 +47,7 @@
|
||||
user_id/0, user_name/0, contact_info/0, user_data/0,
|
||||
lower0_9/0, label/0,
|
||||
ss_tag/0, search_tag/0, description/0, package_type/0,
|
||||
outcome/0]).
|
||||
outcome/0, core_dir/0]).
|
||||
|
||||
-include("zx_logger.hrl").
|
||||
|
||||
@ -102,6 +102,9 @@
|
||||
| {error, Code :: non_neg_integer()}
|
||||
| {error, Info :: string(), Code :: non_neg_integer()}.
|
||||
|
||||
-type core_dir() :: etc | var | tmp | log | key | zsp | lib.
|
||||
|
||||
|
||||
|
||||
|
||||
%%% Command Dispatch
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_auth).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn_sup).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -138,16 +138,16 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_daemon).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
|
||||
-export([get_home/0]).
|
||||
-export([get_home/0, dir/1, dirv/1, meta/0, argv/0]).
|
||||
|
||||
-export([zomp_mode/0]).
|
||||
-export([pass_meta/3, argv/0,
|
||||
-export([pass_meta/3,
|
||||
subscribe/1, unsubscribe/1,
|
||||
list/0, list/1, list/2, list/3, list_type/1, latest/1,
|
||||
describe/1, provides/2, list_deps/1, search/1,
|
||||
@ -179,7 +179,7 @@
|
||||
%%% Type Definitions
|
||||
|
||||
-record(s,
|
||||
{meta = none :: none | zx:package_meta(),
|
||||
{meta = none :: none | zx_zsp:meta(),
|
||||
home = none :: none | file:filename(),
|
||||
argv = [] :: [string()],
|
||||
conf = load_conf() :: conf(),
|
||||
@ -334,6 +334,32 @@ get_home() ->
|
||||
gen_server:call(?MODULE, get_home).
|
||||
|
||||
|
||||
-spec dir(zx:core_dir() | home) -> file:filename().
|
||||
|
||||
dir(home) ->
|
||||
get_home();
|
||||
dir(Type) ->
|
||||
gen_server:call(?MODULE, {dir, Type}).
|
||||
|
||||
|
||||
-spec dirv(zx:core_dir()) -> file:filename().
|
||||
|
||||
dirv(Type) ->
|
||||
gen_server:call(?MODULE, {dirv, Type}).
|
||||
|
||||
|
||||
-spec meta() -> zx_zsp:meta().
|
||||
|
||||
meta() ->
|
||||
gen_server:call(?MODULE, meta).
|
||||
|
||||
|
||||
-spec argv() -> [string()].
|
||||
|
||||
argv() ->
|
||||
gen_server:call(?MODULE, argv).
|
||||
|
||||
|
||||
%%% Zomp Internal Interface
|
||||
|
||||
-spec zomp_mode() -> ok.
|
||||
@ -358,12 +384,6 @@ pass_meta(Meta, Dir, ArgV) ->
|
||||
gen_server:cast(?MODULE, {pass_meta, Meta, Dir, ArgV}).
|
||||
|
||||
|
||||
-spec argv() -> [string()].
|
||||
|
||||
argv() ->
|
||||
gen_server:call(?MODULE, argv).
|
||||
|
||||
|
||||
-spec subscribe(Package) -> ok
|
||||
when Package :: zx:package().
|
||||
%% @doc
|
||||
@ -811,10 +831,20 @@ idle() ->
|
||||
%% @private
|
||||
%% gen_server callback for OTP calls
|
||||
|
||||
handle_call(argv, _, State = #s{argv = ArgV}) ->
|
||||
{reply, ArgV, State};
|
||||
handle_call(get_home, _, State = #s{home = Home}) ->
|
||||
{reply, Home, State};
|
||||
handle_call({dir, Type}, _, State = #s{meta = Meta}) ->
|
||||
{Realm, Name, _} = maps:get(package_id, Meta),
|
||||
Result = zx_lib:ppath(Type, {Realm, Name}),
|
||||
{reply, Result, State};
|
||||
handle_call({dirv, Type}, _, State = #s{meta = Meta}) ->
|
||||
PackageID = maps:get(package_id, Meta),
|
||||
Result = zx_lib:ppath(Type, PackageID),
|
||||
{reply, Result, State};
|
||||
handle_call(meta, _, State = #s{meta = Meta}) ->
|
||||
{reply, Meta, State};
|
||||
handle_call(argv, _, State = #s{argv = ArgV}) ->
|
||||
{reply, ArgV, State};
|
||||
handle_call({request, list}, _, State = #s{cx = CX}) ->
|
||||
Realms = cx_realms(CX),
|
||||
{reply, {ok, Realms}, State};
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_key).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_lib).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -39,8 +39,6 @@
|
||||
-include("zx_logger.hrl").
|
||||
|
||||
|
||||
-type core_dir() :: etc | var | tmp | log | key | zsp | lib.
|
||||
|
||||
|
||||
%%% Functions
|
||||
|
||||
@ -76,7 +74,7 @@ find_zomp_dir() ->
|
||||
end.
|
||||
|
||||
|
||||
-spec path(core_dir()) -> file:filename().
|
||||
-spec path(zx:core_dir()) -> file:filename().
|
||||
%% @private
|
||||
%% Return the top-level path of the given type in the Zomp/ZX system.
|
||||
|
||||
@ -89,7 +87,7 @@ path(zsp) -> filename:join(zomp_dir(), "zsp");
|
||||
path(lib) -> filename:join(zomp_dir(), "lib").
|
||||
|
||||
|
||||
-spec path(core_dir(), zx:realm()) -> file:filename().
|
||||
-spec path(zx:core_dir(), zx:realm()) -> file:filename().
|
||||
%% @private
|
||||
%% Return the realm-level path of the given type in the Zomp/ZX system.
|
||||
|
||||
@ -97,7 +95,7 @@ path(Type, Realm) ->
|
||||
filename:join(path(Type), Realm).
|
||||
|
||||
|
||||
-spec path(core_dir(), zx:realm(), zx:name()) -> file:filename().
|
||||
-spec path(zx:core_dir(), zx:realm(), zx:name()) -> file:filename().
|
||||
%% @private
|
||||
%% Return the package-level path of the given type in the Zomp/ZX system.
|
||||
|
||||
@ -105,7 +103,7 @@ path(Type, Realm, Name) ->
|
||||
filename:join([path(Type), Realm, Name]).
|
||||
|
||||
|
||||
-spec path(core_dir(), zx:realm(), zx:name(), zx:version()) -> file:filename().
|
||||
-spec path(zx:core_dir(), zx:realm(), zx:name(), zx:version()) -> file:filename().
|
||||
%% @private
|
||||
%% Return the version-specific level path of the given type in the Zomp/ZX system.
|
||||
|
||||
@ -114,7 +112,7 @@ path(Type, Realm, Name, Version) ->
|
||||
filename:join([path(Type), Realm, Name, VersionString]).
|
||||
|
||||
|
||||
-spec ppath(core_dir(), zx:package_id()) -> file:filename().
|
||||
-spec ppath(zx:core_dir(), zx:package_id()) -> file:filename().
|
||||
%% @private
|
||||
%% An alias for path/3,4, but more convenient when needing a path from a closed
|
||||
%% package_id().
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_local).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -2701,7 +2701,7 @@ add_mirror(Address, PortString) ->
|
||||
-spec drop_mirror() -> ok.
|
||||
|
||||
drop_mirror() ->
|
||||
case zx_daemon:list_mirrors() of
|
||||
case zx_daemon:conf(mirrors) of
|
||||
{ok, []} ->
|
||||
io:format("No mirrors to drop!~n");
|
||||
{ok, Current} ->
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_net).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_man).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_sup).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peers).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_proxy).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_sup).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_tty).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_userconf).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_zsp).
|
||||
-vsn("0.10.6").
|
||||
-vsn("0.10.7").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
{license,"MIT"}.
|
||||
{modules,[]}.
|
||||
{name,"zx"}.
|
||||
{package_id,{"otpr","zx",{0,10,6}}}.
|
||||
{package_id,{"otpr","zx",{0,10,7}}}.
|
||||
{prefix,"zx_"}.
|
||||
{repo_url,"https://gitlab.com/zxq9/zx"}.
|
||||
{tags,["tools","package manager","erlang"]}.
|
||||
Loading…
x
Reference in New Issue
Block a user