Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:basho/webmachine

  • Loading branch information...
commit 8ec510b88b2394044f01b3163d90823d7e815940 2 parents 7634d0a + fb7e564
Justin Sheehy authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+deps/*
+*.beam
View
1  THANKS
@@ -17,3 +17,4 @@ Dave Smith
Arjan Scherpenisse
Benjamin Black
Anthony Molinaro
+Phil Pirozhkov
View
10 demo/Makefile
@@ -1,11 +1,19 @@
ERL ?= erl
APP := webmachine_demo
-all:
+.PHONY: deps
+
+all: deps
@../rebar compile
+deps:
+ @../rebar get-deps
+
clean:
@../rebar clean
+distclean: clean
+ @../rebar delete-deps
+
docs:
@erl -noshell -run edoc_run application '$(APP)' '"."' '[]'
View
2  demo/README
@@ -7,8 +7,6 @@ Makefile : simple make commands
rebar : the Rebar build tool for Erlang applications
rebar.config : configuration for Rebar
start.sh : simple startup script for running webmachine_demo
-start-debug.sh : run webmachine_demo in "debug" mode (automatic module
- reloading on compilation)
/ebin
/webmachine_demo.app : the Erlang app specification
/src
View
14 demo/ebin/webmachine_demo.app
@@ -1,14 +0,0 @@
-{application, webmachine_demo,
- [{description, "webmachine_demo"},
- {vsn, "0.1"},
- {modules, [
- webmachine_demo,
- webmachine_demo_app,
- webmachine_demo_sup,
- webmachine_demo_resource,
- demo_fs_resource
- ]},
- {registered, []},
- {mod, {webmachine_demo_app, []}},
- {env, []},
- {applications, [kernel, stdlib, crypto]}]}.
View
2  demo/priv/dispatch.conf
@@ -1,3 +1,3 @@
%%-*- mode: erlang -*-
{["demo", '*'], webmachine_demo_resource, []}.
-{["fs", '*'], demo_fs_resource, [{root, "/tmp/fs"}]}.
+{["fs", '*'], webmachine_demo_fs_resource, [{root, "/tmp/fs"}]}.
View
2  demo/rebar.config
@@ -1,3 +1,3 @@
%%-*- mode: erlang -*-
-{deps, [{webmachine, "1\.6", {hg, "http://bitbucket.org/basho/webmachine", "tip"}}]}.
+{deps, [{webmachine, "1.7.*", {git, "git://github.com/basho/webmachine", "HEAD"}}]}.
View
17 demo/src/webmachine_demo.app.src
@@ -0,0 +1,17 @@
+%%-*- mode: erlang -*-
+{application, webmachine_demo,
+ [
+ {description, "demo"},
+ {vsn, "1"},
+ {modules, []},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib,
+ crypto,
+ mochiweb,
+ webmachine
+ ]},
+ {mod, { webmachine_demo_app, []}},
+ {env, []}
+ ]}.
View
16 demo/src/webmachine_demo.erl
@@ -1,7 +1,7 @@
-module(webmachine_demo).
-author('Andy Gross <andy@basho.com>').
-author('Justin Sheehy <justin@@basho.com>').
--export([start/0, stop/0]).
+-export([start/0, start_link/0, stop/0]).
ensure_started(App) ->
case application:start(App) of
@@ -11,10 +11,23 @@ ensure_started(App) ->
ok
end.
+%% @spec start_link() -> {ok,Pid::pid()}
+%% @doc Starts the app for inclusion in a supervisor tree
+start_link() ->
+ ensure_started(crypto),
+ ensure_started(mochiweb),
+ application:set_env(webmachine, webmachine_logger_module,
+ webmachine_logger),
+ ensure_started(webmachine),
+ webmachine_demo_sup:start_link().
+
%% @spec start() -> ok
%% @doc Start the webmachine_demo server.
start() ->
ensure_started(crypto),
+ ensure_started(mochiweb),
+ application:set_env(webmachine, webmachine_logger_module,
+ webmachine_logger),
ensure_started(webmachine),
application:start(webmachine_demo).
@@ -23,5 +36,6 @@ start() ->
stop() ->
Res = application:stop(webmachine_demo),
application:stop(webmachine),
+ application:stop(mochiweb),
application:stop(crypto),
Res.
View
4 demo/src/demo_fs_resource.erl → demo/src/webmachine_demo_fs_resource.erl
@@ -3,7 +3,7 @@
%% @author Justin Sheehy <justin@basho.com>
%% @copyright 2008-2009 Basho Technologies, Inc.
--module(demo_fs_resource).
+-module(webmachine_demo_fs_resource).
-export([init/1]).
-export([allowed_methods/2,
resource_exists/2,
@@ -29,6 +29,8 @@ init(ConfigProps) ->
allowed_methods(ReqData, Context) ->
{['HEAD', 'GET', 'PUT', 'DELETE', 'POST'], ReqData, Context}.
+file_path(_Context, []) ->
+ false;
file_path(Context, Name) ->
RelName = case hd(Name) of
"/" -> tl(Name);
View
1  demo/src/webmachine_demo_resource.erl
@@ -46,4 +46,3 @@ is_authorized(ReqData, Context) ->
expires(ReqData, Context) -> {{{2021,1,1},{0,0,0}}, ReqData, Context}.
generate_etag(ReqData, Context) -> {wrq:raw_path(ReqData), ReqData, Context}.
-
View
2  demo/src/webmachine_demo_sup.erl
@@ -4,7 +4,6 @@
%% @doc Supervisor for the webmachine_demo application.
-module(webmachine_demo_sup).
--author('author <author@example.com>').
-behaviour(supervisor).
@@ -47,7 +46,6 @@ init([]) ->
"..", "priv", "dispatch.conf"])),
WebConfig = [
{ip, Ip},
- {backlog, 1000},
{port, 8000},
{log_dir, "priv/log"},
{dispatch, Dispatch}],
View
2  demo/start.sh
@@ -1,3 +1,3 @@
#!/bin/sh
cd `dirname $0`
-exec erl -pa $PWD/ebin $PWD/deps/webmachine/ebin $PWD/deps/webmachine/deps/mochiweb/ebin -boot start_sasl -s reloader -s webmachine_demo
+exec erl -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -s reloader -s webmachine_demo
View
2  priv/templates/rebar.config
@@ -1,3 +1,3 @@
%%-*- mode: erlang -*-
-{deps, [{webmachine, "1\\.7.*", {hg, "http://bitbucket.org/basho/webmachine", "tip"}}]}.
+{deps, [{webmachine, "1.7.*", {git, "git://github.com/basho/webmachine", "HEAD"}}]}.
View
7 priv/templates/ebin/wmskel.app → priv/templates/src/wmskel.app.src
@@ -3,12 +3,7 @@
[
{description, "{{appid}}"},
{vsn, "1"},
- {modules, [
- {{appid}},
- {{appid}}_app,
- {{appid}}_sup,
- {{appid}}_resource
- ]},
+ {modules, []},
{registered, []},
{applications, [
kernel,
View
2  priv/templates/wmskel.template
@@ -21,7 +21,7 @@
{template, "start.sh", "{{prefix}}/start.sh"}.
{chmod, 8#744, "{{prefix}}/start.sh"}.
-{template, "ebin/wmskel.app", "{{prefix}}/ebin/{{appid}}.app"}.
+{template, "src/wmskel.app.src", "{{prefix}}/src/{{appid}}.app.src"}.
{template, "src/wmskel.erl", "{{prefix}}/src/{{appid}}.erl"}.
{template, "src/wmskel_app.erl", "{{prefix}}/src/{{appid}}_app.erl"}.
View
4 rebar.config
@@ -3,6 +3,6 @@
{cover_enabled, true}.
{deps, [
- {mochiweb, "1.7.1", {hg, "http://bitbucket.org/basho/mochiweb",
- "mochiweb-1.7.1"}}
+ {mochiweb, "1.7.1", {git, "git://github.com/basho/mochiweb",
+ "HEAD"}}
]}.
Please sign in to comment.
Something went wrong with that request. Please try again.