GitHub PullRequestReviewCommentEvent at 2014-12-01 16:13:26
Repository: rebar3
Actor: ferd
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rebar/rebar3/pulls/comments/21098364","id":21098364,"diff_hunk":"@@ -19,52 +19,45 @@\n -spec lock_source(file:filename_all(), rebar_resource:resource()) ->\n                          rebar_resource:resource() | {error, string()}.\n lock_source(AppDir, Source) ->\n-    case get_resource_type(Source) of\n-        {error, _}=Error ->\n-            Error;\n-        Module ->\n-            Module:lock(AppDir, Source)\n-    end.\n+    Module = get_resource_type(Source),\n+    Module:lock(AppDir, Source).\n \n -spec download_source(file:filename_all(), rebar_resource:resource()) -> true | {error, any()}.\n download_source(AppDir, Source) ->\n-    case get_resource_type(Source) of\n-        {error, _}=Error ->\n-            Error;\n-        Module ->\n-            TmpDir = ec_file:insecure_mkdtemp(),\n-            AppDir1 = ec_cnv:to_list(AppDir),\n-            ec_file:mkdir_p(AppDir1),\n-            case Module:download(TmpDir, Source) of\n-                {ok, _} ->\n-                    code:del_path(filename:absname(filename:join(AppDir1, \"ebin\"))),\n-                    ec_file:remove(filename:absname(AppDir1), [recursive]),\n-                    ok = ec_file:copy(TmpDir, filename:absname(AppDir1), [recursive]),\n-                    true;\n-                {tarball, File} ->\n-                    ok = erl_tar:extract(File, [{cwd, TmpDir}\n-                                               ,compressed]),\n-                    BaseName = filename:basename(AppDir1),\n-                    [FromDir] = filelib:wildcard(filename:join(TmpDir, BaseName++\"-*\")),\n-                    code:del_path(filename:absname(filename:join(AppDir1, \"ebin\"))),\n-                    ec_file:remove(filename:absname(AppDir1), [recursive]),\n-                    ok = ec_file:copy(FromDir, filename:absname(AppDir1), [recursive]),\n-                    true\n-            end\n+    try\n+        Module = get_resource_type(Source),\n+        TmpDir = ec_file:insecure_mkdtemp(),\n+        AppDir1 = ec_cnv:to_list(AppDir),\n+        ec_file:mkdir_p(AppDir1),\n+        case Module:download(TmpDir, Source) of\n+            {ok, _} ->\n+                code:del_path(filename:absname(filename:join(AppDir1, \"ebin\"))),\n+                ec_file:remove(filename:absname(AppDir1), [recursive]),\n+                ok = ec_file:copy(TmpDir, filename:absname(AppDir1), [recursive]),\n+                true;\n+            {tarball, File} ->\n+                ok = erl_tar:extract(File, [{cwd, TmpDir}\n+                                           ,compressed]),\n+                BaseName = filename:basename(AppDir1),\n+                [FromDir] = filelib:wildcard(filename:join(TmpDir, BaseName++\"-*\")),\n+                code:del_path(filename:absname(filename:join(AppDir1, \"ebin\"))),\n+                ec_file:remove(filename:absname(AppDir1), [recursive]),\n+                ok = ec_file:copy(FromDir, filename:absname(AppDir1), [recursive]),\n+                true\n+        end\n+    catch\n+        _:E ->\n+            {error, E}","path":"src/rebar_fetch.erl","position":61,"original_position":61,"commit_id":"5673fe035da48d48d0824bf7260bfda28c55c9d5","original_commit_id":"5673fe035da48d48d0824bf7260bfda28c55c9d5","user":{"login":"ferd","id":111141,"avatar_url":"https://avatars.githubusercontent.com/u/111141?v=3","gravatar_id":"","url":"https://api.github.com/users/ferd","html_url":"https://github.com/ferd","followers_url":"https://api.github.com/users/ferd/followers","following_url":"https://api.github.com/users/ferd/following{/other_user}","gists_url":"https://api.github.com/users/ferd/gists{/gist_id}","starred_url":"https://api.github.com/users/ferd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferd/subscriptions","organizations_url":"https://api.github.com/users/ferd/orgs","repos_url":"https://api.github.com/users/ferd/repos","events_url":"https://api.github.com/users/ferd/events{/privacy}","received_events_url":"https://api.github.com/users/ferd/received_events","type":"User","site_admin":false},"body":"What are we catching here? I'm always wary of these catch alls, and may also prefer we at the very least catch `R:E -> ...` and return `{error, {R,E}}` to be able to later handle these cases better.","created_at":"2014-12-01T16:13:26Z","updated_at":"2014-12-01T16:13:26Z","html_url":"https://github.com/rebar/rebar3/pull/31#discussion_r21098364","pull_request_url":"https://api.github.com/repos/rebar/rebar3/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/comments/21098364"},"html":{"href":"https://github.com/rebar/rebar3/pull/31#discussion_r21098364"},"pull_request":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/rebar/rebar3/pulls/31","id":25228735,"html_url":"https://github.com/rebar/rebar3/pull/31","diff_url":"https://github.com/rebar/rebar3/pull/31.diff","patch_url":"https://github.com/rebar/rebar3/pull/31.patch","issue_url":"https://api.github.com/repos/rebar/rebar3/issues/31","number":31,"state":"open","locked":false,"title":"Profiles","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"body":"Related doc: https://gist.github.com/tsloughter/1e16d70268182db1415a","created_at":"2014-11-29T23:42:37Z","updated_at":"2014-12-01T16:13:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"048b44c906dc1913cb6d2ef7a362e72b21d92284","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rebar/rebar3/pulls/31/commits","review_comments_url":"https://api.github.com/repos/rebar/rebar3/pulls/31/comments","review_comment_url":"https://api.github.com/repos/rebar/rebar3/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rebar/rebar3/issues/31/comments","statuses_url":"https://api.github.com/repos/rebar/rebar3/statuses/5673fe035da48d48d0824bf7260bfda28c55c9d5","head":{"label":"tsloughter:profiles","ref":"profiles","sha":"5673fe035da48d48d0824bf7260bfda28c55c9d5","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"repo":{"id":26615042,"name":"rebar3","full_name":"tsloughter/rebar3","owner":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsloughter/rebar3","description":"Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases.","fork":true,"url":"https://api.github.com/repos/tsloughter/rebar3","forks_url":"https://api.github.com/repos/tsloughter/rebar3/forks","keys_url":"https://api.github.com/repos/tsloughter/rebar3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsloughter/rebar3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsloughter/rebar3/teams","hooks_url":"https://api.github.com/repos/tsloughter/rebar3/hooks","issue_events_url":"https://api.github.com/repos/tsloughter/rebar3/issues/events{/number}","events_url":"https://api.github.com/repos/tsloughter/rebar3/events","assignees_url":"https://api.github.com/repos/tsloughter/rebar3/assignees{/user}","branches_url":"https://api.github.com/repos/tsloughter/rebar3/branches{/branch}","tags_url":"https://api.github.com/repos/tsloughter/rebar3/tags","blobs_url":"https://api.github.com/repos/tsloughter/rebar3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsloughter/rebar3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsloughter/rebar3/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsloughter/rebar3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsloughter/rebar3/statuses/{sha}","languages_url":"https://api.github.com/repos/tsloughter/rebar3/languages","stargazers_url":"https://api.github.com/repos/tsloughter/rebar3/stargazers","contributors_url":"https://api.github.com/repos/tsloughter/rebar3/contributors","subscribers_url":"https://api.github.com/repos/tsloughter/rebar3/subscribers","subscription_url":"https://api.github.com/repos/tsloughter/rebar3/subscription","commits_url":"https://api.github.com/repos/tsloughter/rebar3/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsloughter/rebar3/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsloughter/rebar3/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsloughter/rebar3/issues/comments/{number}","contents_url":"https://api.github.com/repos/tsloughter/rebar3/contents/{+path}","compare_url":"https://api.github.com/repos/tsloughter/rebar3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsloughter/rebar3/merges","archive_url":"https://api.github.com/repos/tsloughter/rebar3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsloughter/rebar3/downloads","issues_url":"https://api.github.com/repos/tsloughter/rebar3/issues{/number}","pulls_url":"https://api.github.com/repos/tsloughter/rebar3/pulls{/number}","milestones_url":"https://api.github.com/repos/tsloughter/rebar3/milestones{/number}","notifications_url":"https://api.github.com/repos/tsloughter/rebar3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsloughter/rebar3/labels{/name}","releases_url":"https://api.github.com/repos/tsloughter/rebar3/releases{/id}","created_at":"2014-11-14T00:42:34Z","updated_at":"2014-11-25T00:53:27Z","pushed_at":"2014-12-01T03:12:15Z","git_url":"git://github.com/tsloughter/rebar3.git","ssh_url":"git@github.com:tsloughter/rebar3.git","clone_url":"https://github.com/tsloughter/rebar3.git","svn_url":"https://github.com/tsloughter/rebar3","homepage":"  http://www.rebar3.org","size":2448,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rebar:master","ref":"master","sha":"8d655d3c502295394ab30d9fc3fd11679629885d","user":{"login":"rebar","id":2651508,"avatar_url":"https://avatars.githubusercontent.com/u/2651508?v=3","gravatar_id":"","url":"https://api.github.com/users/rebar","html_url":"https://github.com/rebar","followers_url":"https://api.github.com/users/rebar/followers","following_url":"https://api.github.com/users/rebar/following{/other_user}","gists_url":"https://api.github.com/users/rebar/gists{/gist_id}","starred_url":"https://api.github.com/users/rebar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rebar/subscriptions","organizations_url":"https://api.github.com/users/rebar/orgs","repos_url":"https://api.github.com/users/rebar/repos","events_url":"https://api.github.com/users/rebar/events{/privacy}","received_events_url":"https://api.github.com/users/rebar/received_events","type":"Organization","site_admin":false},"repo":{"id":26610130,"name":"rebar3","full_name":"rebar/rebar3","owner":{"login":"rebar","id":2651508,"avatar_url":"https://avatars.githubusercontent.com/u/2651508?v=3","gravatar_id":"","url":"https://api.github.com/users/rebar","html_url":"https://github.com/rebar","followers_url":"https://api.github.com/users/rebar/followers","following_url":"https://api.github.com/users/rebar/following{/other_user}","gists_url":"https://api.github.com/users/rebar/gists{/gist_id}","starred_url":"https://api.github.com/users/rebar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rebar/subscriptions","organizations_url":"https://api.github.com/users/rebar/orgs","repos_url":"https://api.github.com/users/rebar/repos","events_url":"https://api.github.com/users/rebar/events{/privacy}","received_events_url":"https://api.github.com/users/rebar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rebar/rebar3","description":"Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases.","fork":false,"url":"https://api.github.com/repos/rebar/rebar3","forks_url":"https://api.github.com/repos/rebar/rebar3/forks","keys_url":"https://api.github.com/repos/rebar/rebar3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rebar/rebar3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rebar/rebar3/teams","hooks_url":"https://api.github.com/repos/rebar/rebar3/hooks","issue_events_url":"https://api.github.com/repos/rebar/rebar3/issues/events{/number}","events_url":"https://api.github.com/repos/rebar/rebar3/events","assignees_url":"https://api.github.com/repos/rebar/rebar3/assignees{/user}","branches_url":"https://api.github.com/repos/rebar/rebar3/branches{/branch}","tags_url":"https://api.github.com/repos/rebar/rebar3/tags","blobs_url":"https://api.github.com/repos/rebar/rebar3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rebar/rebar3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rebar/rebar3/git/refs{/sha}","trees_url":"https://api.github.com/repos/rebar/rebar3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rebar/rebar3/statuses/{sha}","languages_url":"https://api.github.com/repos/rebar/rebar3/languages","stargazers_url":"https://api.github.com/repos/rebar/rebar3/stargazers","contributors_url":"https://api.github.com/repos/rebar/rebar3/contributors","subscribers_url":"https://api.github.com/repos/rebar/rebar3/subscribers","subscription_url":"https://api.github.com/repos/rebar/rebar3/subscription","commits_url":"https://api.github.com/repos/rebar/rebar3/commits{/sha}","git_commits_url":"https://api.github.com/repos/rebar/rebar3/git/commits{/sha}","comments_url":"https://api.github.com/repos/rebar/rebar3/comments{/number}","issue_comment_url":"https://api.github.com/repos/rebar/rebar3/issues/comments/{number}","contents_url":"https://api.github.com/repos/rebar/rebar3/contents/{+path}","compare_url":"https://api.github.com/repos/rebar/rebar3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rebar/rebar3/merges","archive_url":"https://api.github.com/repos/rebar/rebar3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rebar/rebar3/downloads","issues_url":"https://api.github.com/repos/rebar/rebar3/issues{/number}","pulls_url":"https://api.github.com/repos/rebar/rebar3/pulls{/number}","milestones_url":"https://api.github.com/repos/rebar/rebar3/milestones{/number}","notifications_url":"https://api.github.com/repos/rebar/rebar3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rebar/rebar3/labels{/name}","releases_url":"https://api.github.com/repos/rebar/rebar3/releases{/id}","created_at":"2014-11-13T22:02:03Z","updated_at":"2014-12-01T02:38:06Z","pushed_at":"2014-11-27T15:31:07Z","git_url":"git://github.com/rebar/rebar3.git","ssh_url":"git@github.com:rebar/rebar3.git","clone_url":"https://github.com/rebar/rebar3.git","svn_url":"https://github.com/rebar/rebar3","homepage":"  http://www.rebar3.org","size":2758,"stargazers_count":50,"watchers_count":50,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":6,"forks":7,"open_issues":6,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/31"},"html":{"href":"https://github.com/rebar/rebar3/pull/31"},"issue":{"href":"https://api.github.com/repos/rebar/rebar3/issues/31"},"comments":{"href":"https://api.github.com/repos/rebar/rebar3/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rebar/rebar3/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/rebar/rebar3/statuses/5673fe035da48d48d0824bf7260bfda28c55c9d5"}}}}