GitHub PullRequestReviewCommentEvent at 2014-06-20 18:44:51
Repository: appium-adb
Actor: jlipps
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-adb/pulls/comments/14035076","id":14035076,"diff_hunk":"@@ -0,0 +1,190 @@\n+\"use strict\";\n+\n+var spawn = require('win-spawn')\n+  , exec = require('child_process').exec\n+  , path = require('path')\n+  , fs = require('fs')\n+  , _ = require('underscore')\n+  , helpers = require('../../helpers.js')\n+  , isWindows = helpers.isWindows()\n+  , isMac = helpers.isMac()\n+  , isLinux = helpers.isLinux()\n+  , logger = require('../../server/logger.js').get('appium');\n+\n+// EACH emulator needs to define these interfaces\n+//  isThisMe\n+//  getAvdName\n+//  launchAVD\n+//  getDefinedAvds\n+\n+var GENYMOTION = function (opts) {\n+  if (!opts) {\n+    opts = {};\n+  }\n+  this.adb = opts.adb;\n+};\n+\n+GENYMOTION.prototype.isThisMe = function (udid) {\n+  var gmrx = new RegExp(^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}:(\\d+));\n+  return gmrx.test(udid);\n+};\n+\n+GENYMOTION.prototype.getAvdNameAndUid = function (line) {\n+  var uid = null;\n+  var name = null;\n+  // find the uid\n+  var i1 = line.indexOf(\"{\");\n+  if (i1 !== -1) {\n+    var i2 = line.indexOf(\"}\", i1);\n+    if (i2 !== -1) {\n+      uid = line.substring(i1 + 1, i2);\n+    }\n+    // find the name\n+    i1 = line.indexOf('\"');\n+    i2 = line.lastIndexOf('\"');\n+    if (i2 !== -1 &&  i1 !== -1) {\n+      name = line.substring(i1 + 1, i2);\n+    }\n+  }\n+  return {\n+    name: name,\n+    uid: uid\n+  };\n+};\n+\n+// get running genymotion vms and try to match ip (from adb devices with queried ip address)\n+GENYMOTION.prototype.getAvdName = function (emulator, cb) {\n+  var ip = this.getIpAddress(emulator);\n+  if (ip === null) return cb(\"\");\n+  this.checkVBoxManagePresent(function (err, vbox) {\n+    if (err) return cb(err);\n+    var cmd = vbox + \" list runningvms\";\n+    exec(cmd, function (err, stdout) {\n+      if (stdout) {\n+        var lines = stdout.trim().split(\"\\n\");\n+        _.each(lines, function (line) {\n+          var avd = this.getAvdNameAndUid(line);\n+          if (avd.name !== null && avd.uid !== null) {\n+            // get ip number\n+            cmd = vbox + \" guestproperty get \\\"\" + avd.name + \"\\\" androvm_ip_management\";\n+            exec(cmd, function (err, stdout2) {\n+              if (err === null && stdout2.length > 0 && stdout2.indexOf(\"Value: \") !== -1) {\n+                var testIp = stdout2.substring(7).trim();\n+                if (testIp === ip) {\n+                  logger.info(\"Genymotion name for \" + emulator.udid + \" is \" + avd.name);\n+                  return cb(null, avd.name);\t\t// return gm name from ip","path":"lib/genymotion.js","position":75,"original_position":75,"commit_id":"6b2bfdd432f71b32c776bf11f47442b68be79589","original_commit_id":"6b2bfdd432f71b32c776bf11f47442b68be79589","user":{"login":"jlipps","id":605053,"avatar_url":"https://avatars.githubusercontent.com/u/605053?","gravatar_id":"174ae1c2a863b7daf240a86da84671bd","url":"https://api.github.com/users/jlipps","html_url":"https://github.com/jlipps","followers_url":"https://api.github.com/users/jlipps/followers","following_url":"https://api.github.com/users/jlipps/following{/other_user}","gists_url":"https://api.github.com/users/jlipps/gists{/gist_id}","starred_url":"https://api.github.com/users/jlipps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlipps/subscriptions","organizations_url":"https://api.github.com/users/jlipps/orgs","repos_url":"https://api.github.com/users/jlipps/repos","events_url":"https://api.github.com/users/jlipps/events{/privacy}","received_events_url":"https://api.github.com/users/jlipps/received_events","type":"User","site_admin":false},"body":"same looping issue here. we might end up hitting this cb multiple times.\r\n\r\nin general if you're doing something async within a loop, you need an entirely different approach than _.each.","created_at":"2014-06-20T18:44:51Z","updated_at":"2014-06-20T18:44:51Z","html_url":"https://github.com/appium/appium-adb/pull/16#discussion_r14035076","pull_request_url":"https://api.github.com/repos/appium/appium-adb/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/comments/14035076"},"html":{"href":"https://github.com/appium/appium-adb/pull/16#discussion_r14035076"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-adb/pulls/16","id":17381582,"html_url":"https://github.com/appium/appium-adb/pull/16","diff_url":"https://github.com/appium/appium-adb/pull/16.diff","patch_url":"https://github.com/appium/appium-adb/pull/16.patch","issue_url":"https://api.github.com/repos/appium/appium-adb/issues/16","number":16,"state":"open","title":"Separate emulator specific calls into an interface.","user":{"login":"jamescaldwell","id":6158505,"avatar_url":"https://avatars.githubusercontent.com/u/6158505?","gravatar_id":"85fd599890d6164c1731854bafcbd046","url":"https://api.github.com/users/jamescaldwell","html_url":"https://github.com/jamescaldwell","followers_url":"https://api.github.com/users/jamescaldwell/followers","following_url":"https://api.github.com/users/jamescaldwell/following{/other_user}","gists_url":"https://api.github.com/users/jamescaldwell/gists{/gist_id}","starred_url":"https://api.github.com/users/jamescaldwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamescaldwell/subscriptions","organizations_url":"https://api.github.com/users/jamescaldwell/orgs","repos_url":"https://api.github.com/users/jamescaldwell/repos","events_url":"https://api.github.com/users/jamescaldwell/events{/privacy}","received_events_url":"https://api.github.com/users/jamescaldwell/received_events","type":"User","site_admin":false},"body":" Added genymotion and ADK emulator implementation files.","created_at":"2014-06-19T23:05:25Z","updated_at":"2014-06-20T18:44:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62a3ab3884f8c618ecf2245accc0c6f9beca221b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-adb/pulls/16/commits","review_comments_url":"https://api.github.com/repos/appium/appium-adb/pulls/16/comments","review_comment_url":"https://api.github.com/repos/appium/appium-adb/pulls/comments/{number}","comments_url":"https://api.github.com/repos/appium/appium-adb/issues/16/comments","statuses_url":"https://api.github.com/repos/appium/appium-adb/statuses/6b2bfdd432f71b32c776bf11f47442b68be79589","head":{"label":"jamescaldwell:master","ref":"master","sha":"6b2bfdd432f71b32c776bf11f47442b68be79589","user":{"login":"jamescaldwell","id":6158505,"avatar_url":"https://avatars.githubusercontent.com/u/6158505?","gravatar_id":"85fd599890d6164c1731854bafcbd046","url":"https://api.github.com/users/jamescaldwell","html_url":"https://github.com/jamescaldwell","followers_url":"https://api.github.com/users/jamescaldwell/followers","following_url":"https://api.github.com/users/jamescaldwell/following{/other_user}","gists_url":"https://api.github.com/users/jamescaldwell/gists{/gist_id}","starred_url":"https://api.github.com/users/jamescaldwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamescaldwell/subscriptions","organizations_url":"https://api.github.com/users/jamescaldwell/orgs","repos_url":"https://api.github.com/users/jamescaldwell/repos","events_url":"https://api.github.com/users/jamescaldwell/events{/privacy}","received_events_url":"https://api.github.com/users/jamescaldwell/received_events","type":"User","site_admin":false},"repo":{"id":21015528,"name":"appium-adb","full_name":"jamescaldwell/appium-adb","owner":{"login":"jamescaldwell","id":6158505,"avatar_url":"https://avatars.githubusercontent.com/u/6158505?","gravatar_id":"85fd599890d6164c1731854bafcbd046","url":"https://api.github.com/users/jamescaldwell","html_url":"https://github.com/jamescaldwell","followers_url":"https://api.github.com/users/jamescaldwell/followers","following_url":"https://api.github.com/users/jamescaldwell/following{/other_user}","gists_url":"https://api.github.com/users/jamescaldwell/gists{/gist_id}","starred_url":"https://api.github.com/users/jamescaldwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamescaldwell/subscriptions","organizations_url":"https://api.github.com/users/jamescaldwell/orgs","repos_url":"https://api.github.com/users/jamescaldwell/repos","events_url":"https://api.github.com/users/jamescaldwell/events{/privacy}","received_events_url":"https://api.github.com/users/jamescaldwell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamescaldwell/appium-adb","description":"Wrapper around adb used by appium + helper libs","fork":true,"url":"https://api.github.com/repos/jamescaldwell/appium-adb","forks_url":"https://api.github.com/repos/jamescaldwell/appium-adb/forks","keys_url":"https://api.github.com/repos/jamescaldwell/appium-adb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamescaldwell/appium-adb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamescaldwell/appium-adb/teams","hooks_url":"https://api.github.com/repos/jamescaldwell/appium-adb/hooks","issue_events_url":"https://api.github.com/repos/jamescaldwell/appium-adb/issues/events{/number}","events_url":"https://api.github.com/repos/jamescaldwell/appium-adb/events","assignees_url":"https://api.github.com/repos/jamescaldwell/appium-adb/assignees{/user}","branches_url":"https://api.github.com/repos/jamescaldwell/appium-adb/branches{/branch}","tags_url":"https://api.github.com/repos/jamescaldwell/appium-adb/tags","blobs_url":"https://api.github.com/repos/jamescaldwell/appium-adb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamescaldwell/appium-adb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamescaldwell/appium-adb/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamescaldwell/appium-adb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamescaldwell/appium-adb/statuses/{sha}","languages_url":"https://api.github.com/repos/jamescaldwell/appium-adb/languages","stargazers_url":"https://api.github.com/repos/jamescaldwell/appium-adb/stargazers","contributors_url":"https://api.github.com/repos/jamescaldwell/appium-adb/contributors","subscribers_url":"https://api.github.com/repos/jamescaldwell/appium-adb/subscribers","subscription_url":"https://api.github.com/repos/jamescaldwell/appium-adb/subscription","commits_url":"https://api.github.com/repos/jamescaldwell/appium-adb/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamescaldwell/appium-adb/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamescaldwell/appium-adb/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamescaldwell/appium-adb/issues/comments/{number}","contents_url":"https://api.github.com/repos/jamescaldwell/appium-adb/contents/{+path}","compare_url":"https://api.github.com/repos/jamescaldwell/appium-adb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamescaldwell/appium-adb/merges","archive_url":"https://api.github.com/repos/jamescaldwell/appium-adb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamescaldwell/appium-adb/downloads","issues_url":"https://api.github.com/repos/jamescaldwell/appium-adb/issues{/number}","pulls_url":"https://api.github.com/repos/jamescaldwell/appium-adb/pulls{/number}","milestones_url":"https://api.github.com/repos/jamescaldwell/appium-adb/milestones{/number}","notifications_url":"https://api.github.com/repos/jamescaldwell/appium-adb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamescaldwell/appium-adb/labels{/name}","releases_url":"https://api.github.com/repos/jamescaldwell/appium-adb/releases{/id}","created_at":"2014-06-19T21:04:08Z","updated_at":"2014-06-19T23:05:25Z","pushed_at":"2014-06-19T22:59:51Z","git_url":"git://github.com/jamescaldwell/appium-adb.git","ssh_url":"git@github.com:jamescaldwell/appium-adb.git","clone_url":"https://github.com/jamescaldwell/appium-adb.git","svn_url":"https://github.com/jamescaldwell/appium-adb","homepage":null,"size":6756,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"6f8ddd294150ae947f98b2a0aef85930b0788fed","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?","gravatar_id":"7ab26affefa889f08bab500702ec16d8","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":17339088,"name":"appium-adb","full_name":"appium/appium-adb","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?","gravatar_id":"7ab26affefa889f08bab500702ec16d8","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-adb","description":"Wrapper around adb used by appium + helper libs","fork":false,"url":"https://api.github.com/repos/appium/appium-adb","forks_url":"https://api.github.com/repos/appium/appium-adb/forks","keys_url":"https://api.github.com/repos/appium/appium-adb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-adb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-adb/teams","hooks_url":"https://api.github.com/repos/appium/appium-adb/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-adb/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-adb/events","assignees_url":"https://api.github.com/repos/appium/appium-adb/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-adb/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-adb/tags","blobs_url":"https://api.github.com/repos/appium/appium-adb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-adb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-adb/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-adb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-adb/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-adb/languages","stargazers_url":"https://api.github.com/repos/appium/appium-adb/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-adb/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-adb/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-adb/subscription","commits_url":"https://api.github.com/repos/appium/appium-adb/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-adb/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-adb/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-adb/issues/comments/{number}","contents_url":"https://api.github.com/repos/appium/appium-adb/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-adb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-adb/merges","archive_url":"https://api.github.com/repos/appium/appium-adb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-adb/downloads","issues_url":"https://api.github.com/repos/appium/appium-adb/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-adb/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-adb/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-adb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-adb/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-adb/releases{/id}","created_at":"2014-03-02T14:20:10Z","updated_at":"2014-06-18T20:41:57Z","pushed_at":"2014-06-18T20:41:57Z","git_url":"git://github.com/appium/appium-adb.git","ssh_url":"git@github.com:appium/appium-adb.git","clone_url":"https://github.com/appium/appium-adb.git","svn_url":"https://github.com/appium/appium-adb","homepage":null,"size":6756,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/16"},"html":{"href":"https://github.com/appium/appium-adb/pull/16"},"issue":{"href":"https://api.github.com/repos/appium/appium-adb/issues/16"},"comments":{"href":"https://api.github.com/repos/appium/appium-adb/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-adb/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-adb/statuses/6b2bfdd432f71b32c776bf11f47442b68be79589"}}}}