Start on rebar3 support
diff --git a/.gitignore b/.gitignore
index b9606c1..292935b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@
*.beam
*.dump
rebar.lock
+/_build
+/rebar3.crashdump
diff --git a/CHANGES.md b/CHANGES.md
index 3216a7e..88c4864 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,7 @@
Version 3.0.0 released 2022-XX-XX
+* rebar3 is now the preferred build tool (finally)
+ https://github.com/mochi/mochiweb/pull/241
* Minimum OTP version is now 18, which
allows us to remove a number of backwards
compatibility hacks while still supporting
@@ -14,6 +16,7 @@
that expression might have to be updated to
handle the `{shutdown, Error}` error reason.
https://github.com/mochi/mochiweb/pull/238
+ https://github.com/mochi/mochiweb/pull/242
Version 2.22.0 released 2021-08-23
diff --git a/src/mochiweb_multipart.erl b/src/mochiweb_multipart.erl
index 21b23bb..906b723 100644
--- a/src/mochiweb_multipart.erl
+++ b/src/mochiweb_multipart.erl
@@ -348,9 +348,13 @@
-include_lib("eunit/include/eunit.hrl").
ssl_cert_opts() ->
- EbinDir = filename:dirname(code:which(?MODULE)),
- CertDir = filename:join([EbinDir, "..", "support",
- "test-materials"]),
+ {ok, Cwd} = file:get_cwd(),
+ CertDir = filename:join(
+ case filename:basename(Cwd) of
+ %% rebar2 compatibility
+ ".eunit" -> [".."];
+ _ -> []
+ end ++ ["support", "test-materials"]),
CertFile = filename:join(CertDir, "test_ssl_cert.pem"),
KeyFile = filename:join(CertDir, "test_ssl_key.pem"),
[{certfile, CertFile}, {keyfile, KeyFile}].
diff --git a/test/mochiweb_test_util.erl b/test/mochiweb_test_util.erl
index c56faf7..c343384 100644
--- a/test/mochiweb_test_util.erl
+++ b/test/mochiweb_test_util.erl
@@ -5,8 +5,13 @@
-include_lib("eunit/include/eunit.hrl").
ssl_cert_opts() ->
- EbinDir = filename:dirname(code:which(?MODULE)),
- CertDir = filename:join([EbinDir, "..", "support", "test-materials"]),
+ {ok, Cwd} = file:get_cwd(),
+ CertDir = filename:join(
+ case filename:basename(Cwd) of
+ %% rebar2 compatibility
+ ".eunit" -> [".."];
+ _ -> []
+ end ++ ["support", "test-materials"]),
CertFile = filename:join(CertDir, "test_ssl_cert.pem"),
KeyFile = filename:join(CertDir, "test_ssl_key.pem"),
[{certfile, CertFile}, {keyfile, KeyFile}].