Browse files

Rebar support.

Relatively untested...
  • Loading branch information...
1 parent 1cd58a6 commit d34fc401cd19cb4f58241bfadb97f44d9133dfdb @oscarh committed Aug 22, 2010
Showing with 89 additions and 138 deletions.
  1. +5 −0 .gitignore
  2. +10 −61 Makefile
  3. BIN rebar
  4. +1 −0 rebar.config
  5. +1 −3 test/lhttpc_manager_tests.erl
  6. +70 −71 test/lhttpc_tests.erl
  7. +2 −2 test/webserver.erl
  8. +0 −1 vsn.mk
View
5 .gitignore
@@ -8,3 +8,8 @@ util/*.beam
cover_report/
test/*.beam
test/*.log
+
+.eunit
+
+*.swp
+*.swo
View
71 Makefile
@@ -1,69 +1,18 @@
-APPLICATION := lhttpc
-APP_FILE := ebin/$(APPLICATION).app
-SOURCES := $(wildcard src/*.erl)
-HEADERS := $(wildcard src/*.hrl)
-MODULES := $(patsubst src/%.erl,%,$(SOURCES))
-BEAMS := $(patsubst %,ebin/%.beam,$(MODULES))
+REBAR := ./rebar
-comma := ,
-e :=
-space := $(e) $(e)
-MODULELIST := $(subst $(space),$(comma),$(MODULES))
+.PHONY: all clean test dialyzer
-TEST_SOURCES := $(wildcard test/*.erl)
-TEST_BEAMS := $(patsubst %.erl,%.beam, $(TEST_SOURCES))
+all:
+ $(REBAR) compile
-include vsn.mk
-
-.PHONY: all clean dialyzer
-
-all: $(APPLICATION) doc
-
-$(APPLICATION): $(BEAMS) $(APP_FILE)
-
-test: $(APPLICATION) $(TEST_BEAMS) util/run_test.beam
- @echo Running tests
- @erl -pa util/ -pa ebin/ -pa test/ -noinput -s run_test run
-
-test_shell: $(APPLICATION) $(TEST_BEAMS)
- @echo Starting a shell with test paths included
- @erl -pa ebin/ -pa test/
-
-test/%.beam: test/%.erl
- @echo Compiling $<
- @erlc +debug_info -o test/ $<
-
-$(APP_FILE): src/$(APPLICATION).app.src
- @echo Generating $@
- @sed -e 's/{modules, \[\]}/{modules, \[$(MODULELIST)\]}/' $< > $@
-
-ebin/%.beam: src/%.erl $(HEADERS) $(filter-out $(wildcard ebin), ebin)
- @echo Compiling $<
- @erlc +debug_info +warn_missing_spec -o ebin/ $<
-
-ebin:
- @echo Creating ebin/
- @mkdir ebin/
-
-doc: doc/edoc-info
+test:
+ $(REBAR) eunit
dialyzer:
- @echo Running dialyzer on sources
- @dialyzer --src -r src/
-
-doc/edoc-info: doc/overview.edoc $(SOURCES)
- @erlc -o util/ util/make_doc.erl
- @echo Generating documentation from edoc
- @erl -pa util/ -noinput -s make_doc edoc
-
-util/%.beam: util/%.erl
- @erlc -o util/ util/run_test.erl
+ $(REBAR) analyze
clean:
- @echo Cleaning
- @rm -f ebin/*.{beam,app} test/*.beam doc/*.{html,css,png} doc/edoc-info
- @rm -rf cover_report
- @rm -f util/*.beam
+ $(REBAR) clean
-release: clean all test dialyzer
- @util/releaser $(APPLICATION) $(VSN)
+release: all dialyzer test
+ $(REBAR) release
View
BIN rebar
Binary file not shown.
View
1 rebar.config
@@ -0,0 +1 @@
+{cover_enabled, true}.
View
4 test/lhttpc_manager_tests.erl
@@ -36,15 +36,13 @@
%%% Eunit setup stuff
start_app() ->
- ok = application:start(crypto),
application:start(public_key),
ok = application:start(ssl),
ok = application:start(lhttpc).
stop_app(_) ->
ok = application:stop(lhttpc),
- ok = application:stop(ssl),
- ok = application:stop(crypto).
+ ok = application:stop(ssl).
manager_test_() ->
{inorder,
View
141 test/lhttpc_tests.erl
@@ -37,77 +37,76 @@
"This is a relatively long body, that we send to the client... "
"This is a relatively long body, that we send to the client... "
"This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- "This is a relatively long body, that we send to the client... "
- ).
-
-test_no(N, Tests) ->
- setelement(2, Tests,
- setelement(4, element(2, Tests),
- lists:nth(N, element(4, element(2, Tests))))).
-
-%%% Eunit setup stuff
-
-start_app() ->
- ok = application:start(crypto),
- application:start(public_key),
- ok = application:start(ssl),
- ok = lhttpc:start().
-
-stop_app(_) ->
- ok = lhttpc:stop(),
- ok = application:stop(ssl),
- ok = application:stop(crypto).
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ "This is a relatively long body, that we send to the client... "
+ ).
+
+ test_no(N, Tests) ->
+ setelement(2, Tests,
+ setelement(4, element(2, Tests),
+ lists:nth(N, element(4, element(2, Tests))))).
+
+ %%% Eunit setup stuff
+
+ start_app() ->
+ application:start(crypto),
+ application:start(public_key),
+ ok = application:start(ssl),
+ ok = lhttpc:start().
+
+ stop_app(_) ->
+ ok = lhttpc:stop(),
+ ok = application:stop(ssl).
tcp_test_() ->
{inorder,
View
4 test/webserver.erl
@@ -118,8 +118,8 @@ listen(ssl) ->
{active, false},
{ip, {127,0,0,1}},
{verify,0},
- {keyfile, "test/key.pem"},
- {certfile, "test/crt.pem"}
+ {keyfile, "../test/key.pem"},
+ {certfile, "../test/crt.pem"}
],
{ok, LS} = ssl:listen(0, Opts),
LS;
View
1 vsn.mk
@@ -1 +0,0 @@
-VSN=1.2.5

0 comments on commit d34fc40

Please sign in to comment.