Skip to content

Commit

Permalink
Merge pull request #37 from inaka/igaray.27.prefer_git_protocol
Browse files Browse the repository at this point in the history
[Closes #27] Prefer git protocol for deps
  • Loading branch information
Brujo Benavides committed Dec 17, 2014
2 parents 53507cd + 3b8d11f commit 74d491e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Table of Contents:
* [Lock your dependencies](#lock-your-dependencies)
* [Loud errors](#loud-errors)
* [Properly use logging levels](#properly-use-logging-levels)
* [Prefer the git protocol when specifying dependency locations](#prefer-the-git-protocol-over-others-when-specifying-dependency-urls)
* [Suggestions & Great Ideas](#suggestions--great-ideas)
* [CamelCase over Under_Score](#camelcase-over-under_score)
* [Prefer shorter (but still meaningful) variable names](#prefer-shorter-but-still-meaningful-variable-names)
Expand Down Expand Up @@ -422,6 +423,18 @@ Following this rule you also get the benefits that `-opaque` types provide, for
* ``alert``: _There is no rule on when to use this level_
* ``emergency``: _There is no rule on when to use this level_

##### Prefer the git protocol over others when specifying dependency URLs
> When specifying dependencies in erlang.mk Makefils or rebar.config, prefer using the git protocol to download the dependency repository.
*Examples*: [makefile example](src/dependency_protocol/dep_protocol.makefile) [rebar example](src/dependency_protocol/dep_protocol.config)

*Reasoning*: SSH requires authentication.
https may require authentication (bitbucket does, github doesn't), but sometimes doesn't.
In addition, https is chatty compared to the git protocol, optimized for cloning repos.
The git protocol's main disadvantage is that it doesn't support authentication, which is a plus for CI systems.

* [Git on the Server - The Protocols](http:https://git-scm.com/book/ch4-1.html)

## Suggestions & Great Ideas

Things that should be considered when writing code, but do not cause a PR rejection, or are too vague to consistently enforce.
Expand Down
14 changes: 14 additions & 0 deletions src/dependency_protocol/dep_protocol.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```erlang
%% bad
{deps,
[{lager, "2.*", {git, "[email protected]:basho/lager.git", "2.0.0"}},
{jiffy, "0.*", {git, "https://github.com:davisp/jiffy.git", "0.13.3"}}
}.

%% good
{deps,
{lager, "2.*", {git, "git:https://github.com/basho/lager.git", "2.0.0"}},
{jiffy, "0.*", {git, "git:https://github.com:davisp/jiffy.git", "0.13.3"}}
}.
```

11 changes: 11 additions & 0 deletions src/dependency_protocol/dep_protocol.makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PROJECT = myproject

DEPS = cowboy lager jiffy
# bad
dep_lager = git https://github.com/basho/lager.git 2.0.1
dep_jiffy = git https://github.com/davisp/jiffy.git 0.13.3

# good
dep_lager = git git:https://github.com/basho/lager.git 2.0.1
dep_jiffy = git git:https://github.com/davisp/jiffy.git 0.13.3

0 comments on commit 74d491e

Please sign in to comment.