Permalink
Browse files

Removed mochiweb from trunk

  • Loading branch information...
1 parent 8c2b0d3 commit 5d0ac6e1aeea9ec10a34998ef5243edca664f892 Piotr Kaleta committed Aug 17, 2009
Showing with 0 additions and 6,754 deletions.
  1. +0 −9 lib/mochiweb-0.01/LICENSE
  2. +0 −11 lib/mochiweb-0.01/Makefile
  3. +0 −1 lib/mochiweb-0.01/README
  4. +0 −32 lib/mochiweb-0.01/ebin/mochiweb.app
  5. +0 −5 lib/mochiweb-0.01/priv/skel/Makefile
  6. +0 −8 lib/mochiweb-0.01/priv/skel/priv/www/index.html
  7. +0 −9 lib/mochiweb-0.01/priv/skel/src/Makefile
  8. +0 −14 lib/mochiweb-0.01/priv/skel/src/skel.app
  9. +0 −30 lib/mochiweb-0.01/priv/skel/src/skel.erl
  10. +0 −1 lib/mochiweb-0.01/priv/skel/src/skel.hrl
  11. +0 −22 lib/mochiweb-0.01/priv/skel/src/skel_app.erl
  12. +0 −84 lib/mochiweb-0.01/priv/skel/src/skel_deps.erl
  13. +0 −54 lib/mochiweb-0.01/priv/skel/src/skel_sup.erl
  14. +0 −43 lib/mochiweb-0.01/priv/skel/src/skel_web.erl
  15. +0 −3 lib/mochiweb-0.01/priv/skel/start-dev.sh
  16. +0 −3 lib/mochiweb-0.01/priv/skel/start.sh
  17. +0 −46 lib/mochiweb-0.01/priv/skel/support/include.mk
  18. +0 −27 lib/mochiweb-0.01/scripts/new_mochiweb.erl
  19. +0 −20 lib/mochiweb-0.01/src/Makefile
  20. +0 −426 lib/mochiweb-0.01/src/mochifmt.erl
  21. +0 −30 lib/mochiweb-0.01/src/mochifmt_records.erl
  22. +0 −23 lib/mochiweb-0.01/src/mochifmt_std.erl
  23. +0 −75 lib/mochiweb-0.01/src/mochihex.erl
  24. +0 −533 lib/mochiweb-0.01/src/mochijson.erl
  25. +0 −618 lib/mochiweb-0.01/src/mochijson2.erl
  26. +0 −289 lib/mochiweb-0.01/src/mochinum.erl
  27. +0 −32 lib/mochiweb-0.01/src/mochiweb.app
  28. +0 −110 lib/mochiweb-0.01/src/mochiweb.erl
  29. +0 −20 lib/mochiweb-0.01/src/mochiweb_app.erl
  30. +0 −295 lib/mochiweb-0.01/src/mochiweb_charref.erl
  31. +0 −257 lib/mochiweb-0.01/src/mochiweb_cookies.erl
  32. +0 −31 lib/mochiweb-0.01/src/mochiweb_echo.erl
  33. +0 −186 lib/mochiweb-0.01/src/mochiweb_headers.erl
  34. +0 −893 lib/mochiweb-0.01/src/mochiweb_html.erl
  35. +0 −142 lib/mochiweb-0.01/src/mochiweb_http.erl
  36. +0 −429 lib/mochiweb-0.01/src/mochiweb_multipart.erl
  37. +0 −790 lib/mochiweb-0.01/src/mochiweb_request.erl
  38. +0 −56 lib/mochiweb-0.01/src/mochiweb_response.erl
  39. +0 −73 lib/mochiweb-0.01/src/mochiweb_skel.erl
  40. +0 −248 lib/mochiweb-0.01/src/mochiweb_socket_server.erl
  41. +0 −34 lib/mochiweb-0.01/src/mochiweb_sup.erl
  42. +0 −579 lib/mochiweb-0.01/src/mochiweb_util.erl
  43. +0 −124 lib/mochiweb-0.01/src/reloader.erl
  44. +0 −39 lib/mochiweb-0.01/support/include.mk
@@ -1,9 +0,0 @@
-This is the MIT license.
-
-Copyright (c) 2007 Mochi Media, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -1,11 +0,0 @@
-all:
- (cd src;$(MAKE) all)
-
-edoc:
- (cd src;$(MAKE) edoc)
-
-test:
- (cd src;$(MAKE) test)
-
-clean:
- (cd src;$(MAKE) clean)
View
@@ -1 +0,0 @@
-MochiWeb is an Erlang library for building lightweight HTTP servers.
@@ -1,32 +0,0 @@
-{application, mochiweb,
- [{description, "MochiMedia Web Server"},
- {vsn, "0.01"},
- {modules, [
- mochihex,
- mochijson,
- mochijson2,
- mochinum,
- mochiweb,
- mochiweb_app,
- mochiweb_charref,
- mochiweb_cookies,
- mochiweb_echo,
- mochiweb_headers,
- mochiweb_html,
- mochiweb_http,
- mochiweb_multipart,
- mochiweb_request,
- mochiweb_response,
- mochiweb_skel,
- mochiweb_socket_server,
- mochiweb_sup,
- mochiweb_util,
- reloader,
- mochifmt,
- mochifmt_std,
- mochifmt_records
- ]},
- {registered, []},
- {mod, {mochiweb_app, []}},
- {env, []},
- {applications, [kernel, stdlib]}]}.
@@ -1,5 +0,0 @@
-all:
- (cd src;$(MAKE))
-
-clean:
- (cd src;$(MAKE) clean)
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>It Worked</title>
-</head>
-<body>
-MochiWeb running.
-</body>
-</html>
@@ -1,9 +0,0 @@
-include ../support/include.mk
-
-all: $(EBIN_FILES)
-
-debug:
- $(MAKE) DEBUG=-DDEBUG
-
-clean:
- rm -rf $(EBIN_FILES)
@@ -1,14 +0,0 @@
-{application, skel,
- [{description, "skel"},
- {vsn, "0.01"},
- {modules, [
- skel,
- skel_app,
- skel_sup,
- skel_web,
- skel_deps
- ]},
- {registered, []},
- {mod, {skel_app, []}},
- {env, []},
- {applications, [kernel, stdlib, crypto]}]}.
@@ -1,30 +0,0 @@
-%% @author author <author@example.com>
-%% @copyright YYYY author.
-
-%% @doc TEMPLATE.
-
--module(skel).
--author('author <author@example.com>').
--export([start/0, stop/0]).
-
-ensure_started(App) ->
- case application:start(App) of
- ok ->
- ok;
- {error, {already_started, App}} ->
- ok
- end.
-
-%% @spec start() -> ok
-%% @doc Start the skel server.
-start() ->
- skel_deps:ensure(),
- ensure_started(crypto),
- application:start(skel).
-
-%% @spec stop() -> ok
-%% @doc Stop the skel server.
-stop() ->
- Res = application:stop(skel),
- application:stop(crypto),
- Res.
@@ -1 +0,0 @@
-
@@ -1,22 +0,0 @@
-%% @author author <author@example.com>
-%% @copyright YYYY author.
-
-%% @doc Callbacks for the skel application.
-
--module(skel_app).
--author('author <author@example.com>').
-
--behaviour(application).
--export([start/2,stop/1]).
-
-
-%% @spec start(_Type, _StartArgs) -> ServerRet
-%% @doc application start callback for skel.
-start(_Type, _StartArgs) ->
- skel_deps:ensure(),
- skel_sup:start_link().
-
-%% @spec stop(_State) -> ServerRet
-%% @doc application stop callback for skel.
-stop(_State) ->
- ok.
@@ -1,84 +0,0 @@
-%% @author author <author@example.com>
-%% @copyright YYYY author.
-
-%% @doc Ensure that the relatively-installed dependencies are on the code
-%% loading path, and locate resources relative
-%% to this application's path.
-
--module(skel_deps).
--author('author <author@example.com>').
-
--export([ensure/0, ensure/1]).
--export([get_base_dir/0, get_base_dir/1]).
--export([local_path/1, local_path/2]).
--export([deps_on_path/0, new_siblings/1]).
-
-%% @spec deps_on_path() -> [ProjNameAndVers]
-%% @doc List of project dependencies on the path.
-deps_on_path() ->
- F = fun (X, Acc) ->
- ProjDir = filename:dirname(X),
- case {filename:basename(X),
- filename:basename(filename:dirname(ProjDir))} of
- {"ebin", "deps"} ->
- [filename:basename(ProjDir) | Acc];
- _ ->
- Acc
- end
- end,
- ordsets:from_list(lists:foldl(F, [], code:get_path())).
-
-%% @spec new_siblings(Module) -> [Dir]
-%% @doc Find new siblings paths relative to Module that aren't already on the
-%% code path.
-new_siblings(Module) ->
- Existing = deps_on_path(),
- SiblingEbin = filelib:wildcard(local_path(["deps", "*", "ebin"], Module)),
- Siblings = [filename:dirname(X) || X <- SiblingEbin,
- ordsets:is_element(
- filename:basename(filename:dirname(X)),
- Existing) =:= false],
- lists:filter(fun filelib:is_dir/1,
- lists:append([[filename:join([X, "ebin"]),
- filename:join([X, "include"])] ||
- X <- Siblings])).
-
-
-%% @spec ensure(Module) -> ok
-%% @doc Ensure that all ebin and include paths for dependencies
-%% of the application for Module are on the code path.
-ensure(Module) ->
- code:add_paths(new_siblings(Module)),
- code:clash(),
- ok.
-
-%% @spec ensure() -> ok
-%% @doc Ensure that the ebin and include paths for dependencies of
-%% this application are on the code path. Equivalent to
-%% ensure(?Module).
-ensure() ->
- ensure(?MODULE).
-
-%% @spec get_base_dir(Module) -> string()
-%% @doc Return the application directory for Module. It assumes Module is in
-%% a standard OTP layout application in the ebin or src directory.
-get_base_dir(Module) ->
- {file, Here} = code:is_loaded(Module),
- filename:dirname(filename:dirname(Here)).
-
-%% @spec get_base_dir() -> string()
-%% @doc Return the application directory for this application. Equivalent to
-%% get_base_dir(?MODULE).
-get_base_dir() ->
- get_base_dir(?MODULE).
-
-%% @spec local_path([string()], Module) -> string()
-%% @doc Return an application-relative directory from Module's application.
-local_path(Components, Module) ->
- filename:join([get_base_dir(Module) | Components]).
-
-%% @spec local_path(Components) -> string()
-%% @doc Return an application-relative directory for this application.
-%% Equivalent to local_path(Components, ?MODULE).
-local_path(Components) ->
- local_path(Components, ?MODULE).
@@ -1,54 +0,0 @@
-%% @author author <author@example.com>
-%% @copyright YYYY author.
-
-%% @doc Supervisor for the skel application.
-
--module(skel_sup).
--author('author <author@example.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([]),
-
- Old = sets:from_list(
- [Name || {Name, _, _, _} <- supervisor:which_children(?MODULE)]),
- New = sets:from_list([Name || {Name, _, _, _, _, _} <- Specs]),
- Kill = sets:subtract(Old, New),
-
- sets:fold(fun (Id, ok) ->
- supervisor:terminate_child(?MODULE, Id),
- supervisor:delete_child(?MODULE, Id),
- ok
- end, ok, Kill),
-
- [supervisor:start_child(?MODULE, Spec) || Spec <- Specs],
- ok.
-
-%% @spec init([]) -> SupervisorTree
-%% @doc supervisor callback.
-init([]) ->
- Ip = case os:getenv("MOCHIWEB_IP") of false -> "0.0.0.0"; Any -> Any end,
- WebConfig = [
- {ip, Ip},
- {port, 8000},
- {docroot, skel_deps:local_path(["priv", "www"])}],
- Web = {skel_web,
- {skel_web, start, [WebConfig]},
- permanent, 5000, worker, dynamic},
-
- Processes = [Web],
- {ok, {{one_for_one, 10, 10}, Processes}}.
@@ -1,43 +0,0 @@
-%% @author author <author@example.com>
-%% @copyright YYYY author.
-
-%% @doc Web server for skel.
-
--module(skel_web).
--author('author <author@example.com>').
-
--export([start/1, stop/0, loop/2]).
-
-%% External API
-
-start(Options) ->
- {DocRoot, Options1} = get_option(docroot, Options),
- Loop = fun (Req) ->
- ?MODULE:loop(Req, DocRoot)
- end,
- mochiweb_http:start([{name, ?MODULE}, {loop, Loop} | Options1]).
-
-stop() ->
- mochiweb_http:stop(?MODULE).
-
-loop(Req, DocRoot) ->
- "/" ++ Path = Req:get(path),
- case Req:get(method) of
- Method when Method =:= 'GET'; Method =:= 'HEAD' ->
- case Path of
- _ ->
- Req:serve_file(Path, DocRoot)
- end;
- 'POST' ->
- case Path of
- _ ->
- Req:not_found()
- end;
- _ ->
- Req:respond({501, [], []})
- end.
-
-%% Internal API
-
-get_option(Option, Options) ->
- {proplists:get_value(Option, Options), proplists:delete(Option, Options)}.
@@ -1,3 +0,0 @@
-#!/bin/sh
-cd `dirname $0`
-exec erl -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -s reloader -s skel
@@ -1,3 +0,0 @@
-#!/bin/sh
-cd `dirname $0`
-exec erl -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -s skel
@@ -1,46 +0,0 @@
-## -*- makefile -*-
-
-######################################################################
-## Erlang
-
-ERL := erl
-ERLC := $(ERL)c
-
-INCLUDE_DIRS := ../include $(wildcard ../deps/*/include)
-EBIN_DIRS := $(wildcard ../deps/*/ebin)
-ERLC_FLAGS := -W $(INCLUDE_DIRS:../%=-I ../%) $(EBIN_DIRS:%=-pa %)
-
-ifndef no_debug_info
- ERLC_FLAGS += +debug_info
-endif
-
-ifdef debug
- ERLC_FLAGS += -Ddebug
-endif
-
-EBIN_DIR := ../ebin
-DOC_DIR := ../doc
-EMULATOR := beam
-
-ERL_SOURCES := $(wildcard *.erl)
-ERL_HEADERS := $(wildcard *.hrl) $(wildcard ../include/*.hrl)
-ERL_OBJECTS := $(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.$(EMULATOR))
-ERL_DOCUMENTS := $(ERL_SOURCES:%.erl=$(DOC_DIR)/%.html)
-ERL_OBJECTS_LOCAL := $(ERL_SOURCES:%.erl=./%.$(EMULATOR))
-APP_FILES := $(wildcard *.app)
-EBIN_FILES = $(ERL_OBJECTS) $(ERL_DOCUMENTS) $(APP_FILES:%.app=../ebin/%.app)
-EBIN_FILES_NO_DOCS = $(ERL_OBJECTS) $(APP_FILES:%.app=../ebin/%.app)
-MODULES = $(ERL_SOURCES:%.erl=%)
-
-../ebin/%.app: %.app
- cp $< $@
-
-$(EBIN_DIR)/%.$(EMULATOR): %.erl
- $(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $<
-
-./%.$(EMULATOR): %.erl
- $(ERLC) $(ERLC_FLAGS) -o . $<
-
-$(DOC_DIR)/%.html: %.erl
- $(ERL) -noshell -run edoc file $< -run init stop
- mv *.html $(DOC_DIR)
Oops, something went wrong.

0 comments on commit 5d0ac6e

Please sign in to comment.