Merge pull request #11 from chef/jd/rebar3

rebar3 support for bcrypt
diff --git a/rebar.config b/rebar.config
index 8795905..d3d76a7 100644
--- a/rebar.config
+++ b/rebar.config
@@ -4,14 +4,27 @@
 %% {so_specs,
 %%  [{"priv/bcrypt_nif.so",
 %%    ["c_src/*.c"]}]}.
-{port_env,
- [{"DRV_LDFLAGS","-shared $ERL_LDFLAGS -lpthread"},
+{port_env, [
+  {"DRV_LDFLAGS","-shared $ERL_LDFLAGS -lpthread"},
   {"darwin", "DRV_LDFLAGS", "-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS -lpthread"},
   {"solaris", "ERL_CFLAGS", "-lnsl $ERL_CFLAGS"},
-  {"DRV_CFLAGS","-Ic_src -Wall -fPIC $ERL_CFLAGS"}]}.
+  {"DRV_CFLAGS","-Ic_src -Wall -fPIC $ERL_CFLAGS"}
+]}.
 
 {port_specs, [{"priv/bcrypt_nif.so", ["c_src/*.c"]}]}.
 
+%% These post_hooks are for rebar2. rebar.config.script removes them if
+%% rebar3 is detected
 {post_hooks,
  [{clean, "make -C c_src clean"},
   {compile, "make -C c_src"}]}.
+
+%% plugins and provider_hooks are for rebar3. rebar.config.script removes them
+%% if rebar2 is detected
+{plugins, [pc]}.
+{provider_hooks, [
+  {pre, [
+    {compile, {pc, compile}},
+    {clean, {pc, clean}}
+  ]}
+]}.
diff --git a/rebar.config.script b/rebar.config.script
new file mode 100644
index 0000000..0baa8b2
--- /dev/null
+++ b/rebar.config.script
@@ -0,0 +1,7 @@
+case code:is_loaded(rebar3) of
+  false ->
+    C1 = proplists:delete(plugins, CONFIG),
+    proplists:delete(provider_hooks, C1);
+  {file, _} ->
+    proplists:delete(post_hooks, CONFIG)
+end.
diff --git a/rebar.lock b/rebar.lock
new file mode 100644
index 0000000..57afcca
--- /dev/null
+++ b/rebar.lock
@@ -0,0 +1 @@
+[].