Skip to content

Instantly share code, notes, and snippets.

View tsloughter's full-sized avatar

Tristan Sloughter tsloughter

View GitHub Profile
top_level:
cowboy 1.0.0
ranch 1.0.1
cowboy 1.0.0:
ranch 1.0.0
cowlib 1.0.0
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
-module(dummy).
-behaviour(rebar_provider).
-export([init/1,
do/1]).
λ ../rebar/rebar3 compile
===> Compiling minasan
Opts [{outdir,"/home/tristan/Devel/minasan/ebin"},
debug_info,
{i,"rebar/include"},
{i,"/home/tristan/Devel/minasan/include"},
return]
===> Compiling /home/tristan/Devel/minasan/src/dummy.erl failed:
/home/tristan/Devel/minasan/src/dummy.erl:11: can't find include file "rebar.hrl"
λ rebar3 new rel myrelease
===> Writing apps/myrelease/src/myrelease_app.erl
===> Writing apps/myrelease/src/myrelease_sup.erl
===> Writing apps/myrelease/src/myrelease.app.src
===> Writing rebar.config
===> Writing relx.config
===> Writing config/sys.config
===> Writing config/vm.args
===> Writing .gitignore
===> Writing LICENSE
@tsloughter
tsloughter / gist:c5e6283d70ee5078198d
Last active August 29, 2015 14:05
Rebar dep handling tests
  • Top level (source and binary) dep overrides transitive dep of other top level dep
  • Transitive deps at same level conflict, choose newest
  • Transitive deps at different levels conflict, choose closest to root
  • Circular dependencies
@tsloughter
tsloughter / gist:4c53aada321a9f9aa8b4
Last active August 29, 2015 14:05
Rebar Deps Rules

Locks

If lock file exists do not do any transitive deps handling.

Maybe compare to current rebar.config deps list to see if top level deps have changed and do update.

Dep Ordering

Precedence:

overlay_files(undefined, _) ->
[];
overlay_files(Overlay, OutputDir) ->
lists:filtermap(fun({copy, _, To}) ->
{true, {To, filename:join(OutputDir, To)}};
({mkdir, Dir}) ->
{true, {Dir, filename:join(OutputDir, Dir)}};
({template, _, To}) ->
{true, {To, filename:join(OutputDir, To)}};
(_) ->
@tsloughter
tsloughter / rebar3.md
Last active August 29, 2015 14:05
Rebar3

The Rebar3 Manifesto

Warning: Rebar3 works for me, probably won't work for you yet.

Rebar has been an important tool for many years and many Erlang developers, but for various reasons it has come to show it's age very quickly. The code has become overly complex, especially the transitive dependency management, and became clear to me and a few others that a partial rewrite was required.

The prevalence of rebar configs in projects meant backwards compatability was a must, however features have been both added and removed.

OTP standards

λ ls
config ebin Makefile Procfile rebar.config src
deps LICENSE priv README.md relx.config
λ cat rebar.config
{deps, [
cowboy,
mimetypes
]}.
Running `prepare` attached to terminal... up, run.3471
-----> Installing howistart-0.1
-----> Preparing cache... done
-----> Inferring GHC version... done, 7.6.3
-----> Restoring GHC 7.6.3
Downloading s3://howistart_packages/linux-ubuntu-10-04-x64/halcyon-ghc-7.6.3.tar.xz... done
Extracting halcyon-ghc-7.6.3.tar.xz... done
-----> Activating GHC 7.6.3... done