Browse Source

rebar3 web

Namdak Tonpa 6 years ago
parent
commit
1407bfb80d
5 changed files with 7 additions and 3 deletions
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 1 1
      priv/web/src/routes.erl
  4. 2 1
      priv/web/src/sample.app.src
  5. 3 0
      priv/web/src/sample.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"36d943").
+-define(VERSION,"376b70").

BIN
mad


+ 1 - 1
priv/web/src/routes.erl

@@ -4,7 +4,7 @@
 
 finish(State, Ctx) -> {ok, State, Ctx}.
 init(State, #cx{req=Req}=Cx) ->
-    Path = case application:get_env(n2o,cowboy_spec,cow1) of
+    Path = case sample:ver() of
                 cow1 -> n2o_cowboy:path(Req); % cowboy 1.0
                 cow2 -> #{path:=P}=Req, P     % cowboy 2.5
            end,

+ 2 - 1
priv/web/src/sample.app.src

@@ -2,6 +2,7 @@
     [{description, "REVIEW WS Application"},
      {vsn, "5.11"},
      {registered, []},
-     {applications, [public_key, asn1, kernel, stdlib, kvs, cowboy, n2o]},
+     {applications, [public_key,asn1,kernel,stdlib,mnesia,
+                     kvs,cowlib,ranch,cowboy,gproc,n2o]},
      {mod, { sample, []}},
      {env, []}]}.

+ 3 - 0
priv/web/src/sample.erl

@@ -16,3 +16,6 @@ cow1()     -> [spec()].
 port()     -> application:get_env(n2o,port,8001).
 env()      -> [ { env, [ { dispatch, n2o_cowboy:points() } ] } ].
 spec()     -> ranch:child_spec(http,100,ranch_tcp,[{port,port()}],cowboy_protocol,env()).
+rebar3()   -> {ok,[{_,R,L}]}=file:consult(code:lib_dir(sample)++"/ebin/sample.app"),
+              [ application:start(X) || X <- proplists:get_value(applications,L,[]) ],
+              application:start(R).