GitHub PullRequestReviewCommentEvent at 2014-11-29 09:54:26
Repository: replicant
Actor: mttkay
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mttkay/replicant/pulls/comments/21049723","id":21049723,"diff_hunk":"@@ -154,18 +154,34 @@ def setup_rlwrap\n     # a maximum depth of 2 directory levels\n     def detect_android_manifest_path\n       manifest_file = 'AndroidManifest.xml'\n-      known_locations = %W(./#{manifest_file} ./src/main/#{manifest_file})\n-      known_locations.find {|loc| File.exist?(loc)} || begin\n+      known_manifest_locations = %W(./#{manifest_file} ./src/main/#{manifest_file})\n+      known_manifest_locations.find {|loc| File.exist?(loc)} || begin\n         Find.find('.') do |path|\n           Find.prune if path.start_with?('./.') || path.split('/').size > 3\n-          return path if path.include?(manifest_file)\n+          if File.directory?(path)\n+            manifest_file_path = known_manifest_locations.map {|known_location| \"#{path}/#{known_location}\"}.find {|loc| File.exist?(loc)}\n+            return manifest_file_path if manifest_file_path and is_application_path?(path)\n+          end\n         end\n       end\n     end\n \n+    def is_application_path?(path)\n+      if File.exists?(\"#{path}/project.properties\") # old library project\n+        return IO.readlines(\"#{path}/project.properties\").find { |l| l =~ /android.library=true/ }.nil?\n+      else\n+        # TODO: support gradle files named something other than build.gradle.\n+        if File.exists?(\"#{path}/build.gradle\")\n+          return not(IO.readlines(\"#{path}/build.gradle\").find { |l| l =~ /com.android.application/ }.nil?)","path":"lib/replicant/repl.rb","position":25,"original_position":25,"commit_id":"5c8f09350e33ba7a53e4e162b0108b18e8096a5d","original_commit_id":"5c8f09350e33ba7a53e4e162b0108b18e8096a5d","user":{"login":"mttkay","id":102802,"avatar_url":"https://avatars.githubusercontent.com/u/102802?v=3","gravatar_id":"","url":"https://api.github.com/users/mttkay","html_url":"https://github.com/mttkay","followers_url":"https://api.github.com/users/mttkay/followers","following_url":"https://api.github.com/users/mttkay/following{/other_user}","gists_url":"https://api.github.com/users/mttkay/gists{/gist_id}","starred_url":"https://api.github.com/users/mttkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mttkay/subscriptions","organizations_url":"https://api.github.com/users/mttkay/orgs","repos_url":"https://api.github.com/users/mttkay/repos","events_url":"https://api.github.com/users/mttkay/events{/privacy}","received_events_url":"https://api.github.com/users/mttkay/received_events","type":"User","site_admin":false},"body":"also the else-if can be collapsed into an `elsif`","created_at":"2014-11-29T09:54:26Z","updated_at":"2014-11-29T09:54:26Z","html_url":"https://github.com/mttkay/replicant/pull/36#discussion_r21049723","pull_request_url":"https://api.github.com/repos/mttkay/replicant/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/comments/21049723"},"html":{"href":"https://github.com/mttkay/replicant/pull/36#discussion_r21049723"},"pull_request":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/mttkay/replicant/pulls/36","id":25220693,"html_url":"https://github.com/mttkay/replicant/pull/36","diff_url":"https://github.com/mttkay/replicant/pull/36.diff","patch_url":"https://github.com/mttkay/replicant/pull/36.patch","issue_url":"https://api.github.com/repos/mttkay/replicant/issues/36","number":36,"state":"open","locked":false,"title":"Amend manifest search to work well with multi-projects builds","user":{"login":"stefanodacchille","id":323267,"avatar_url":"https://avatars.githubusercontent.com/u/323267?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanodacchille","html_url":"https://github.com/stefanodacchille","followers_url":"https://api.github.com/users/stefanodacchille/followers","following_url":"https://api.github.com/users/stefanodacchille/following{/other_user}","gists_url":"https://api.github.com/users/stefanodacchille/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanodacchille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanodacchille/subscriptions","organizations_url":"https://api.github.com/users/stefanodacchille/orgs","repos_url":"https://api.github.com/users/stefanodacchille/repos","events_url":"https://api.github.com/users/stefanodacchille/events{/privacy}","received_events_url":"https://api.github.com/users/stefanodacchille/received_events","type":"User","site_admin":false},"body":"In my multi-project build, replicant would incorrectly set the package name of one of the sub-projects (which is a library project). I amended the implementation so that it looks for the manifest in the current directory and all sub-directories and checks if the sub-project is an app project. \r\n\r\nI couldn't really figure out how to do a couple of things properly, so suggestions are welcome:\r\n\r\n1. if the current project is a library project, the package will be set to the one of the sample app, which is probably not what you want. But how can replicant know that's the case? A possibility would be to look for know app directory names like \"sample\", skip those and fall back to the library project.\r\n\r\n2. how to write tests for this, on the other hand there weren't any for the previous implementation.\r\n","created_at":"2014-11-29T08:31:15Z","updated_at":"2014-11-29T09:54:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96392acd615e8ec709428617430233a84e30942d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mttkay/replicant/pulls/36/commits","review_comments_url":"https://api.github.com/repos/mttkay/replicant/pulls/36/comments","review_comment_url":"https://api.github.com/repos/mttkay/replicant/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mttkay/replicant/issues/36/comments","statuses_url":"https://api.github.com/repos/mttkay/replicant/statuses/5c8f09350e33ba7a53e4e162b0108b18e8096a5d","head":{"label":"stefanodacchille:fix-set-package","ref":"fix-set-package","sha":"5c8f09350e33ba7a53e4e162b0108b18e8096a5d","user":{"login":"stefanodacchille","id":323267,"avatar_url":"https://avatars.githubusercontent.com/u/323267?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanodacchille","html_url":"https://github.com/stefanodacchille","followers_url":"https://api.github.com/users/stefanodacchille/followers","following_url":"https://api.github.com/users/stefanodacchille/following{/other_user}","gists_url":"https://api.github.com/users/stefanodacchille/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanodacchille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanodacchille/subscriptions","organizations_url":"https://api.github.com/users/stefanodacchille/orgs","repos_url":"https://api.github.com/users/stefanodacchille/repos","events_url":"https://api.github.com/users/stefanodacchille/events{/privacy}","received_events_url":"https://api.github.com/users/stefanodacchille/received_events","type":"User","site_admin":false},"repo":{"id":27295345,"name":"replicant","full_name":"stefanodacchille/replicant","owner":{"login":"stefanodacchille","id":323267,"avatar_url":"https://avatars.githubusercontent.com/u/323267?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanodacchille","html_url":"https://github.com/stefanodacchille","followers_url":"https://api.github.com/users/stefanodacchille/followers","following_url":"https://api.github.com/users/stefanodacchille/following{/other_user}","gists_url":"https://api.github.com/users/stefanodacchille/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanodacchille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanodacchille/subscriptions","organizations_url":"https://api.github.com/users/stefanodacchille/orgs","repos_url":"https://api.github.com/users/stefanodacchille/repos","events_url":"https://api.github.com/users/stefanodacchille/events{/privacy}","received_events_url":"https://api.github.com/users/stefanodacchille/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stefanodacchille/replicant","description":"A REPL for the Android Debug Bridge (ADB)","fork":true,"url":"https://api.github.com/repos/stefanodacchille/replicant","forks_url":"https://api.github.com/repos/stefanodacchille/replicant/forks","keys_url":"https://api.github.com/repos/stefanodacchille/replicant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stefanodacchille/replicant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stefanodacchille/replicant/teams","hooks_url":"https://api.github.com/repos/stefanodacchille/replicant/hooks","issue_events_url":"https://api.github.com/repos/stefanodacchille/replicant/issues/events{/number}","events_url":"https://api.github.com/repos/stefanodacchille/replicant/events","assignees_url":"https://api.github.com/repos/stefanodacchille/replicant/assignees{/user}","branches_url":"https://api.github.com/repos/stefanodacchille/replicant/branches{/branch}","tags_url":"https://api.github.com/repos/stefanodacchille/replicant/tags","blobs_url":"https://api.github.com/repos/stefanodacchille/replicant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stefanodacchille/replicant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stefanodacchille/replicant/git/refs{/sha}","trees_url":"https://api.github.com/repos/stefanodacchille/replicant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stefanodacchille/replicant/statuses/{sha}","languages_url":"https://api.github.com/repos/stefanodacchille/replicant/languages","stargazers_url":"https://api.github.com/repos/stefanodacchille/replicant/stargazers","contributors_url":"https://api.github.com/repos/stefanodacchille/replicant/contributors","subscribers_url":"https://api.github.com/repos/stefanodacchille/replicant/subscribers","subscription_url":"https://api.github.com/repos/stefanodacchille/replicant/subscription","commits_url":"https://api.github.com/repos/stefanodacchille/replicant/commits{/sha}","git_commits_url":"https://api.github.com/repos/stefanodacchille/replicant/git/commits{/sha}","comments_url":"https://api.github.com/repos/stefanodacchille/replicant/comments{/number}","issue_comment_url":"https://api.github.com/repos/stefanodacchille/replicant/issues/comments/{number}","contents_url":"https://api.github.com/repos/stefanodacchille/replicant/contents/{+path}","compare_url":"https://api.github.com/repos/stefanodacchille/replicant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stefanodacchille/replicant/merges","archive_url":"https://api.github.com/repos/stefanodacchille/replicant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stefanodacchille/replicant/downloads","issues_url":"https://api.github.com/repos/stefanodacchille/replicant/issues{/number}","pulls_url":"https://api.github.com/repos/stefanodacchille/replicant/pulls{/number}","milestones_url":"https://api.github.com/repos/stefanodacchille/replicant/milestones{/number}","notifications_url":"https://api.github.com/repos/stefanodacchille/replicant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stefanodacchille/replicant/labels{/name}","releases_url":"https://api.github.com/repos/stefanodacchille/replicant/releases{/id}","created_at":"2014-11-29T07:50:48Z","updated_at":"2014-11-29T07:50:49Z","pushed_at":"2014-11-29T08:24:39Z","git_url":"git://github.com/stefanodacchille/replicant.git","ssh_url":"git@github.com:stefanodacchille/replicant.git","clone_url":"https://github.com/stefanodacchille/replicant.git","svn_url":"https://github.com/stefanodacchille/replicant","homepage":null,"size":622,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"mttkay:master","ref":"master","sha":"859ab591c2d9f24763ad8e6ce75bdf044a116f6b","user":{"login":"mttkay","id":102802,"avatar_url":"https://avatars.githubusercontent.com/u/102802?v=3","gravatar_id":"","url":"https://api.github.com/users/mttkay","html_url":"https://github.com/mttkay","followers_url":"https://api.github.com/users/mttkay/followers","following_url":"https://api.github.com/users/mttkay/following{/other_user}","gists_url":"https://api.github.com/users/mttkay/gists{/gist_id}","starred_url":"https://api.github.com/users/mttkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mttkay/subscriptions","organizations_url":"https://api.github.com/users/mttkay/orgs","repos_url":"https://api.github.com/users/mttkay/repos","events_url":"https://api.github.com/users/mttkay/events{/privacy}","received_events_url":"https://api.github.com/users/mttkay/received_events","type":"User","site_admin":false},"repo":{"id":14263264,"name":"replicant","full_name":"mttkay/replicant","owner":{"login":"mttkay","id":102802,"avatar_url":"https://avatars.githubusercontent.com/u/102802?v=3","gravatar_id":"","url":"https://api.github.com/users/mttkay","html_url":"https://github.com/mttkay","followers_url":"https://api.github.com/users/mttkay/followers","following_url":"https://api.github.com/users/mttkay/following{/other_user}","gists_url":"https://api.github.com/users/mttkay/gists{/gist_id}","starred_url":"https://api.github.com/users/mttkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mttkay/subscriptions","organizations_url":"https://api.github.com/users/mttkay/orgs","repos_url":"https://api.github.com/users/mttkay/repos","events_url":"https://api.github.com/users/mttkay/events{/privacy}","received_events_url":"https://api.github.com/users/mttkay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mttkay/replicant","description":"A REPL for the Android Debug Bridge (ADB)","fork":false,"url":"https://api.github.com/repos/mttkay/replicant","forks_url":"https://api.github.com/repos/mttkay/replicant/forks","keys_url":"https://api.github.com/repos/mttkay/replicant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mttkay/replicant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mttkay/replicant/teams","hooks_url":"https://api.github.com/repos/mttkay/replicant/hooks","issue_events_url":"https://api.github.com/repos/mttkay/replicant/issues/events{/number}","events_url":"https://api.github.com/repos/mttkay/replicant/events","assignees_url":"https://api.github.com/repos/mttkay/replicant/assignees{/user}","branches_url":"https://api.github.com/repos/mttkay/replicant/branches{/branch}","tags_url":"https://api.github.com/repos/mttkay/replicant/tags","blobs_url":"https://api.github.com/repos/mttkay/replicant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mttkay/replicant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mttkay/replicant/git/refs{/sha}","trees_url":"https://api.github.com/repos/mttkay/replicant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mttkay/replicant/statuses/{sha}","languages_url":"https://api.github.com/repos/mttkay/replicant/languages","stargazers_url":"https://api.github.com/repos/mttkay/replicant/stargazers","contributors_url":"https://api.github.com/repos/mttkay/replicant/contributors","subscribers_url":"https://api.github.com/repos/mttkay/replicant/subscribers","subscription_url":"https://api.github.com/repos/mttkay/replicant/subscription","commits_url":"https://api.github.com/repos/mttkay/replicant/commits{/sha}","git_commits_url":"https://api.github.com/repos/mttkay/replicant/git/commits{/sha}","comments_url":"https://api.github.com/repos/mttkay/replicant/comments{/number}","issue_comment_url":"https://api.github.com/repos/mttkay/replicant/issues/comments/{number}","contents_url":"https://api.github.com/repos/mttkay/replicant/contents/{+path}","compare_url":"https://api.github.com/repos/mttkay/replicant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mttkay/replicant/merges","archive_url":"https://api.github.com/repos/mttkay/replicant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mttkay/replicant/downloads","issues_url":"https://api.github.com/repos/mttkay/replicant/issues{/number}","pulls_url":"https://api.github.com/repos/mttkay/replicant/pulls{/number}","milestones_url":"https://api.github.com/repos/mttkay/replicant/milestones{/number}","notifications_url":"https://api.github.com/repos/mttkay/replicant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mttkay/replicant/labels{/name}","releases_url":"https://api.github.com/repos/mttkay/replicant/releases{/id}","created_at":"2013-11-09T19:13:42Z","updated_at":"2014-11-19T14:33:23Z","pushed_at":"2014-10-19T15:12:02Z","git_url":"git://github.com/mttkay/replicant.git","ssh_url":"git@github.com:mttkay/replicant.git","clone_url":"https://github.com/mttkay/replicant.git","svn_url":"https://github.com/mttkay/replicant","homepage":null,"size":880,"stargazers_count":102,"watchers_count":102,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":20,"forks":6,"open_issues":20,"watchers":102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/36"},"html":{"href":"https://github.com/mttkay/replicant/pull/36"},"issue":{"href":"https://api.github.com/repos/mttkay/replicant/issues/36"},"comments":{"href":"https://api.github.com/repos/mttkay/replicant/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mttkay/replicant/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/mttkay/replicant/statuses/5c8f09350e33ba7a53e4e162b0108b18e8096a5d"}}}}