Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop 3.0 merge29 #16

Open
wants to merge 8 commits into
base: develop-3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ ebin/*.app
doc/*
.local_dialyzer_plt
/.rebar
_build/*
rebar.lock
6 changes: 0 additions & 6 deletions Emakefile

This file was deleted.

51 changes: 18 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
ERL ?= erl
APP := webmachine
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3

REPO = ${shell echo `basename "$${PWD}"`}
ARTIFACTSFILE = ${shell echo ${REPO}-`date +%F_%H-%M-%S`.tgz}
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 = $(CURDIR)/rebar3
endif

.PHONY: deps
# Fallback to rebar on PATH
REBAR3 ?= $(shell which rebar3)

all: deps compile
# And finally, prep to download rebar if all else fails
ifeq ($(REBAR3),)
REBAR3 = $(CURDIR)/rebar3
endif

compile: deps
./rebar compile

deps: DEV_MODE
@(./rebar get-deps)
all: $(REBAR3)
@$(REBAR3) do update, clean, compile, eunit, dialyzer

clean:
@(./rebar clean)
$(REBAR3):
curl -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x rebar3

# nuke deps first to avoid wasting time having rebar recurse into deps
# for clean
distclean:
@rm -rf ./deps ./.rebar
@(./rebar clean)
@rm -rf ./_build

edoc:
@$(ERL) -noshell -run edoc_run application '$(APP)' '"."' '[{preprocess, true},{includes, ["."]}]'
DIALYZER_APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
COMBO_PLT = $(HOME)/.webmachine_dialyzer_plt

include tools.mk

verbosetest: all
@(./rebar -v skip_deps=true eunit)

travisupload:
tar cvfz ${ARTIFACTSFILE} --exclude '*.beam' --exclude '*.erl' test.log .eunit
travis-artifacts upload --path ${ARTIFACTSFILE}

DEV_MODE:
@[ -d ./.rebar ] || mkdir ./.rebar
@touch ./.rebar/DEV_MODE
@$(REBAR3) edoc
Binary file removed rebar
Binary file not shown.
17 changes: 13 additions & 4 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
{xref_checks, [undefined_function_calls]}.

{deps,
[{mochiweb, "2.9.0.*", {git, "git://github.com/basho/mochiweb.git", {tag, "v2.9.0p2"}}}
[{mochiweb, ".*", {git, "git://github.com/martinsumner/mochiweb.git", {branch, "develop-3.0-merge29"}}}
]}.

{dev_only_deps,
[{meck, "0.8.*", {git, "git://github.com/basho/meck.git", {tag, "0.8.2"}}},
{ibrowse, "4.0.2", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.0.2"}}}
{eunit_opts, [
no_tty,
{report, {eunit_progress, [colored, profile]}}
]}.

{profiles,
[{test,
[{deps, [meck,
{ibrowse, "4.4.0"}
]},
{erl_opts, [debug_info]}
]}
]}.
68 changes: 0 additions & 68 deletions rebar.config.script

This file was deleted.

Binary file added rebar3
Binary file not shown.
9 changes: 8 additions & 1 deletion src/webmachine_mochiweb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
-define (WM_OPTION_DEFAULTS, [{error_handler, webmachine_error_handler}]).

start(Options) ->
{DispatchList, PName, DGroup, WMOptions, OtherOptions} = get_wm_options(Options),
{DispatchList, PName, DGroup, WMOptions, OtherOptions0} = get_wm_options(Options),
OtherOptions =
case application:get_env(webmachine, recbuf) of
{ok, RecBuf} ->
[{recbuf, RecBuf}|OtherOptions0];
_ ->
OtherOptions0
end,
webmachine_router:init_routes(DGroup, DispatchList),
_ = [application_set_unless_env_or_undef(K, V) || {K, V} <- WMOptions],
MochiName = list_to_atom(to_list(PName) ++ "_mochiweb"),
Expand Down
6 changes: 3 additions & 3 deletions src/webmachine_perf_log_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ fmt_plog(Time, Ip, Method, Path, {VM,Vm}, Status, Length, Mod, TTPD, TTPS) ->

non_standard_method_test() ->
LogData = #wm_log_data{resource_module=foo,
start_time=now(),
start_time=os:timestamp(),
method="FOO",
peer={127,0,0,1},
path="/",
version={1,1},
response_code=501,
response_length=1234,
end_time=now(),
finish_time=now()},
end_time=os:timestamp(),
finish_time=os:timestamp()},
LogEntry = format_req(LogData),
?assert(is_list(LogEntry)),
ok.
Expand Down
2 changes: 1 addition & 1 deletion src/webmachine_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ parts_to_body(BodyList, Size, Req) when is_list(BodyList) ->
{CT, _} ->
CT
end,
Boundary = mochihex:to_hex(crypto:rand_bytes(8)),
Boundary = mochihex:to_hex(crypto:strong_rand_bytes(8)),
HeaderList = [{"Content-Type",
["multipart/byteranges; ",
"boundary=", Boundary]}],
Expand Down
2 changes: 1 addition & 1 deletion test/decision_core_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-include("wm_reqdata.hrl").
-include_lib("eunit/include/eunit.hrl").

-compile(export_all).
-compile([export_all, nowarn_export_all]).

-define(RESOURCE, atom_to_list(?MODULE)).
-define(RESOURCE_PATH, "/" ++ ?RESOURCE).
Expand Down
2 changes: 1 addition & 1 deletion test/wm_integration_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-include_lib("eunit/include/eunit.hrl").
-include("webmachine.hrl").

-compile([export_all]).
-compile([export_all, nowarn_export_all]).

integration_test_() ->
{foreach,
Expand Down
48 changes: 0 additions & 48 deletions tools.mk

This file was deleted.