Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove completely unusued application infrastructure.

There are a number of examples in otp of libraries that have .app files w/o a
mod section.  So it appears that it is perfectly valid to not keep around a
bunch of erlang/otp application infrastructure that is never used.

There is also as has been pointed out many times no good reason to ever
call application:start(mochiweb) and the current incarnation of
mochiweb:start() didn't do anything correctly anyway because we have a
dependence on the inets application which we don't start.

The most reasonable thing to do seems like to remove this infrastructure and
only care about the .app file as it's needed by rebar and other tools like
dialyzer.
  • Loading branch information...
commit 044e70b9efae2f7e47fe829bb93898758880ae7f 1 parent 3af91fb
David Reid authored
View
1  src/mochiweb.app.src
@@ -4,6 +4,5 @@
{vsn, "2.0.0"},
{modules, []},
{registered, []},
- {mod, {mochiweb_app, []}},
{env, []},
{applications, [kernel, stdlib, crypto, inets]}]}.
View
33 src/mochiweb.erl
@@ -6,23 +6,9 @@
-module(mochiweb).
-author('bob@mochimedia.com').
--export([start/0, stop/0]).
-export([new_request/1, new_response/1]).
-export([all_loaded/0, all_loaded/1, reload/0]).
-%% @spec start() -> ok
-%% @doc Start the MochiWeb server.
-start() ->
- ensure_started(crypto),
- application:start(mochiweb).
-
-%% @spec stop() -> ok
-%% @doc Stop the MochiWeb server.
-stop() ->
- Res = application:stop(mochiweb),
- application:stop(crypto),
- Res.
-
reload() ->
[c:l(Module) || Module <- all_loaded()].
@@ -78,17 +64,6 @@ new_response({Request, Code, Headers}) ->
Code,
mochiweb_headers:make(Headers)).
-%% Internal API
-
-ensure_started(App) ->
- case application:start(App) of
- ok ->
- ok;
- {error, {already_started, App}} ->
- ok
- end.
-
-
%%
%% Tests
%%
@@ -138,11 +113,11 @@ multiple_https_GET_test() ->
do_GET(ssl, 3).
hundred_http_GET_test_() -> % note the underscore
- {timeout, ?LARGE_TIMEOUT,
+ {timeout, ?LARGE_TIMEOUT,
fun() -> ?assertEqual(ok, do_GET(plain,100)) end}.
hundred_https_GET_test_() -> % note the underscore
- {timeout, ?LARGE_TIMEOUT,
+ {timeout, ?LARGE_TIMEOUT,
fun() -> ?assertEqual(ok, do_GET(ssl,100)) end}.
single_128_http_POST_test() ->
@@ -170,11 +145,11 @@ multiple_100K_https_POST_test() ->
do_POST(ssl, 102400, 3).
hundred_128_http_POST_test_() -> % note the underscore
- {timeout, ?LARGE_TIMEOUT,
+ {timeout, ?LARGE_TIMEOUT,
fun() -> ?assertEqual(ok, do_POST(plain, 128, 100)) end}.
hundred_128_https_POST_test_() -> % note the underscore
- {timeout, ?LARGE_TIMEOUT,
+ {timeout, ?LARGE_TIMEOUT,
fun() -> ?assertEqual(ok, do_POST(ssl, 128, 100)) end}.
do_GET(Transport, Times) ->
View
27 src/mochiweb_app.erl
@@ -1,27 +0,0 @@
-%% @author Bob Ippolito <bob@mochimedia.com>
-%% @copyright 2007 Mochi Media, Inc.
-
-%% @doc Callbacks for the mochiweb application.
-
--module(mochiweb_app).
--author('bob@mochimedia.com').
-
--behaviour(application).
--export([start/2,stop/1]).
-
-%% @spec start(_Type, _StartArgs) -> ServerRet
-%% @doc application start callback for mochiweb.
-start(_Type, _StartArgs) ->
- mochiweb_sup:start_link().
-
-%% @spec stop(_State) -> ServerRet
-%% @doc application stop callback for mochiweb.
-stop(_State) ->
- ok.
-
-%%
-%% Tests
-%%
--ifdef(TEST).
--include_lib("eunit/include/eunit.hrl").
--endif.
View
41 src/mochiweb_sup.erl
@@ -1,41 +0,0 @@
-%% @author Bob Ippolito <bob@mochimedia.com>
-%% @copyright 2007 Mochi Media, Inc.
-
-%% @doc Supervisor for the mochiweb application.
-
--module(mochiweb_sup).
--author('bob@mochimedia.com').
-
--behaviour(supervisor).
-
-%% External exports
--export([start_link/0, upgrade/0]).
-
-%% supervisor callbacks
--export([init/1]).
-
-%% @spec start_link() -> ServerRet
-%% @doc API for starting the supervisor.
-start_link() ->
- supervisor:start_link({local, ?MODULE}, ?MODULE, []).
-
-%% @spec upgrade() -> ok
-%% @doc Add processes if necessary.
-upgrade() ->
- {ok, {_, Specs}} = init([]),
- lists:foreach(fun(S) -> supervisor:start_child(?MODULE, S) end, Specs),
- ok.
-
-%% @spec init([]) -> SupervisorTree
-%% @doc supervisor callback, ensures yaws is in embedded mode and then
-%% returns the supervisor tree.
-init([]) ->
- Processes = [],
- {ok, {{one_for_one, 10, 10}, Processes}}.
-
-%%
-%% Tests
-%%
--ifdef(TEST).
--include_lib("eunit/include/eunit.hrl").
--endif.
Please sign in to comment.
Something went wrong with that request. Please try again.