Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid making too many GitHub API calls: 1) don't resolve branches 2) …

…use 'raw' API instead of 'blob' API to fetch specs
  • Loading branch information...
commit baf7e9f28b59af2fab0b2f11b821a2d04cee0d5d 1 parent 06c3866
@yrashk yrashk authored
View
2  src/agner.app.src
@@ -1,7 +1,7 @@
{application, agner,
[
{description, ""},
- {vsn, "0.2"},
+ {vsn, "0.2.1"},
{registered, []},
{applications, [
kernel,
View
10 src/agner_github.erl
@@ -60,12 +60,10 @@ branches(Name) ->
end.
spec(Name, SHA1) ->
- case request("http://github.com/api/v2/json/blob/show/" ++ proper_repo_name(Name) ++ "/" ++ SHA1 ++ "/agner.config") of
- {error, _Reason} = Error ->
- Error;
- {struct, Object} ->
- {struct, Blob} = proplists:get_value(<<"blob">>, Object),
- S = binary_to_list(proplists:get_value(<<"data">>, Blob)),
+ case httpc_request("http://github.com/" ++ proper_repo_name(Name) ++ "/raw/" ++ SHA1 ++ "/agner.config") of
+ {ok, {{"HTTP/1.1",404,_},_Headers,_Body}} ->
+ {error, not_found};
+ {ok, {{"HTTP/1.1",200,_},_Headers,S}} ->
agner_spec:parse(S)
end.
View
3  src/agner_server.erl
@@ -219,8 +219,7 @@ handle_versions(Name, From, [Mod0|Rest]) ->
sha1(Mod, Name, Version) ->
case Version of
{branch, Branch} ->
- Branches = Mod:branches(Name),
- proplists:get_value(Branch, Branches);
+ Branch;
{tag, Tag} ->
Tags = Mod:tags(Name),
proplists:get_value(Tag, Tags);
Please sign in to comment.
Something went wrong with that request. Please try again.