Browse Source

Make the library more (rebar) friendly

cherrypick and merge b1ad824ea39d43c690c68e685ddae816620c5b60
by Krzysztof Rutka <krzysztof.rutka@erlang-solutions.com>
Anton Lebedevich 12 years ago
parent
commit
9b659d9b85

+ 5 - 3
.gitignore

@@ -1,4 +1,6 @@
 *.beam
-*.boot
-*.script
-ebin/*.app
+*.app
+*.plt
+/ebin/
+/.eunit/
+rebar

+ 9 - 4
Makefile

@@ -9,7 +9,7 @@ ERLC 		:= erlc
 ERLC_FLAGS	:= -Wall -I include +debug_info
 
 SRC			:= $(wildcard src/*.erl)
-TESTS 		:= $(wildcard test_src/*.erl)
+TESTS 		:= $(wildcard test/*.erl)
 RELEASE		:= $(NAME)-$(VERSION).tar.gz
 
 APPDIR		:= $(NAME)-$(VERSION)
@@ -30,8 +30,7 @@ clean:
 	@rm -f ebin/$(NAME).app
 	@rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
 
-test: $(TESTS:test_src/%.erl=test_ebin/%.beam) compile
-	@dialyzer -n --src -c src
+test: $(TESTS:test/%.erl=test_ebin/%.beam) compile
 	$(ERL) -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
 
 # ------------------------------------------------------------------------
@@ -45,5 +44,11 @@ ebin/%.beam : src/%.erl
 ebin/%.app : src/%.app.src Makefile
 	sed -e 's|git|\"$(VERSION)\"|g' $< > $@
 
-test_ebin/%.beam : test_src/%.erl
+test_ebin/%.beam : test/%.erl
 	$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
+
+dialyzer: build.plt compile
+	dialyzer --plt $< ebin
+
+build.plt:
+	dialyzer -q --build_plt --apps kernel stdlib ssl --output_plt $@

+ 4 - 1
rebar.config

@@ -1 +1,4 @@
-{eunit_compile_opts, [{src_dirs, ["test_src"]}]}.
+{eunit_opts, [verbose]}.
+
+{cover_enabled, true}.
+{cover_print_enabled, true}.

+ 4 - 1
src/epgsql.app.src

@@ -4,5 +4,8 @@
   {modules, [pgsql, pgsql_binary, pgsql_connection, pgsql_fdatetime,
              pgsql_idatetime, pgsql_sock, pgsql_types]},
   {registered, []},
-  {applications, [kernel, stdlib, crypto, ssl]},
+  {applications, [kernel,
+                  stdlib,
+                  ssl]},
+  {env, []}]}.
   {included_applications, []}]}.

+ 0 - 0
test_data/epgsql.crt → test/data/epgsql.crt


+ 0 - 0
test_data/epgsql.key → test/data/epgsql.key


+ 0 - 0
test_data/root.crt → test/data/root.crt


+ 0 - 0
test_data/root.key → test/data/root.key


+ 0 - 0
test_data/test_schema.sql → test/data/test_schema.sql


+ 0 - 0
test_src/pgsql_cast.erl → test/pgsql_cast.erl


+ 0 - 0
test_src/pgsql_incremental.erl → test/pgsql_incremental.erl


+ 1 - 1
test_src/pgsql_tests.erl → test/pgsql_tests.erl

@@ -66,7 +66,7 @@ connect_with_ssl_test(Module) ->
 
 connect_with_client_cert_test(Module) ->
     lists:foreach(fun application:start/1, ?ssl_apps),
-    Dir = filename:join(filename:dirname(code:which(pgsql_tests)), "../test_data"),
+    Dir = filename:join(filename:dirname(code:which(pgsql_tests)), "data"),
     File = fun(Name) -> filename:join(Dir, Name) end,
     {ok, Pem} = file:read_file(File("epgsql.crt")),
     [{'Certificate', Der, not_encrypted}] = public_key:pem_decode(Pem),