Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Closes #87] Use erlang-github #136

Merged
merged 2 commits into from
Sep 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PROJECT = elvis

DEPS = lager sync getopt jiffy ibrowse aleppo zipper
DEPS = lager sync getopt jiffy ibrowse aleppo zipper egithub
TEST_DEPS = meck

dep_lager = git https://github.com/basho/lager.git 2.0.3
Expand All @@ -11,6 +11,7 @@ dep_jiffy = git https://github.com/davisp/jiffy 0.11.3
dep_ibrowse = git https://github.com/cmullaparthi/ibrowse v4.1.1
dep_aleppo = git https://github.com/inaka/aleppo 0.9.0
dep_zipper = git https://github.com/inaka/zipper 0.1.0
dep_egithub = git https://github.com/inaka/erlang-github 0.1.0

include erlang.mk

Expand Down
1 change: 0 additions & 1 deletion src/elvis.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
elvis,
elvis_config,
elvis_git,
elvis_github,
elvis_result,
elvis_utils,
elvis_style,
Expand Down
10 changes: 8 additions & 2 deletions src/elvis.erl
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ git_hook(Config) ->
%% @doc Should receive the payload of a Github event and act accordingly.
-spec webhook(webhook:request()) -> ok | {error, term()}.
webhook(Request) ->
Credentials = elvis_github:basic_auth_credentials(),
Credentials = github_credentials(),
elvis_webhook:event(Credentials, Request).

%% @doc Receives github credentials (basic or OAuth) and the payload
%% from an event, acting accordingly.
-spec webhook(elvis_github:credentials(), webhook:request()) ->
-spec webhook(egithub:credentials(), webhook:request()) ->
ok | {error, term()}.
webhook(Credentials, Request) ->
elvis_webhook:event(Credentials, Request).
Expand Down Expand Up @@ -222,3 +222,9 @@ git-hook Pre-commit Git Hook: Gets all staged files and runs the rules
files.
">>,
io:put_chars(Commands).

-spec github_credentials() -> egithub:credentials().
github_credentials() ->
User = application:get_env(elvis, github_user, ""),
Password = application:get_env(elvis, github_password, ""),
egithub:basic_auth(User, Password).
Loading