{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/comments/48036838","id":48036838,"diff_hunk":"@@ -111,35 +113,55 @@ Phase.prototype.registerParser = function(parser) {\n  * @returns {Promise}\n  */\n Phase.prototype.getDevice = function() {\n-  var phase = this;\n-\n   if (this.device) {\n     return Promise.resolve(this.device);\n   }\n \n-  return mozDevice(this.options.serial, this.options)\n-    .then(function(device) {\n-      phase.device = device;\n+  service(this.options)\n+    .then(device => this.device = device)\n+    .then(() => this.setDeviceMetadata())\n+    .then(() => {\n+      let device = this.device;\n+      let options = this.options;\n+      let port = options.forwardPort || options.marionettePort;\n \n-      // Allow specific phases to handle their own Dispatcher set up\n-      if (phase.options.preventDispatching) {\n+      if (options.preventDispatching) {\n         return device;\n       }\n \n-      phase.dispatcher = new Dispatcher(device);\n-      device.log.start();\n-      phase.registerParser(performanceParser);\n-      phase.registerParser(memoryParser);\n-\n-      return device\n-        .adbForward(phase.options.forwardPort || phase.options.marionettePort)\n-        .then(function() {\n-          return device;\n-        });\n+      return this\n+        .logstream()\n+        .then(stream => this.dispatcher = new Dispatcher(stream))\n+        .then(() => this.registerParser(performanceParser))\n+        .then(() => this.registerParser(memoryParser))\n+        .then(() => device.adbForward(port))\n+        .then(port => this.marionette = new Marionette(R.merge(options, { port })))\n+        .then(() => device);\n     })\n-    .catch(function(err) {\n-      phase.emit('error', err);\n-    });\n+    .catch(err => this.emit('error', err));\n+};\n+\n+Phase.prototype.logstream = function() {\n+  let logcat = this.options.logcat;\n+\n+  return this.device\n+    .logstream()\n+    .then(R.apply((stream, request) => {\n+      this.streamRequest = request;\n+      logcat && this.device.filestream(logcat);\n+      return stream;\n+    }));\n+};\n+\n+Phase.prototype.setDeviceMetadata = function() {","path":"lib/phases/phase.js","position":163,"original_position":163,"commit_id":"8bfdba6d49c706377f45809370201a0c232c730c","original_commit_id":"8bfdba6d49c706377f45809370201a0c232c730c","user":{"login":"rwood-moz","id":2198968,"avatar_url":"https://avatars.githubusercontent.com/u/2198968?v=3","gravatar_id":"","url":"https://api.github.com/users/rwood-moz","html_url":"https://github.com/rwood-moz","followers_url":"https://api.github.com/users/rwood-moz/followers","following_url":"https://api.github.com/users/rwood-moz/following{/other_user}","gists_url":"https://api.github.com/users/rwood-moz/gists{/gist_id}","starred_url":"https://api.github.com/users/rwood-moz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwood-moz/subscriptions","organizations_url":"https://api.github.com/users/rwood-moz/orgs","repos_url":"https://api.github.com/users/rwood-moz/repos","events_url":"https://api.github.com/users/rwood-moz/events{/privacy}","received_events_url":"https://api.github.com/users/rwood-moz/received_events","type":"User","site_admin":false},"body":"Wouldn't it be better to name this 'getDeviceMetadata'?","created_at":"2015-12-18T15:39:17Z","updated_at":"2015-12-18T15:39:17Z","html_url":"https://github.com/mozilla-raptor/raptor-cli/pull/40#discussion_r48036838","pull_request_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/comments/48036838"},"html":{"href":"https://github.com/mozilla-raptor/raptor-cli/pull/40#discussion_r48036838"},"pull_request":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40","id":53146026,"html_url":"https://github.com/mozilla-raptor/raptor-cli/pull/40","diff_url":"https://github.com/mozilla-raptor/raptor-cli/pull/40.diff","patch_url":"https://github.com/mozilla-raptor/raptor-cli/pull/40.patch","issue_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/40","number":40,"state":"open","locked":false,"title":"Convert mega repo into modular test command to integrate into raptor/cli tool","user":{"login":"eliperelman","id":285899,"avatar_url":"https://avatars.githubusercontent.com/u/285899?v=3","gravatar_id":"","url":"https://api.github.com/users/eliperelman","html_url":"https://github.com/eliperelman","followers_url":"https://api.github.com/users/eliperelman/followers","following_url":"https://api.github.com/users/eliperelman/following{/other_user}","gists_url":"https://api.github.com/users/eliperelman/gists{/gist_id}","starred_url":"https://api.github.com/users/eliperelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliperelman/subscriptions","organizations_url":"https://api.github.com/users/eliperelman/orgs","repos_url":"https://api.github.com/users/eliperelman/repos","events_url":"https://api.github.com/users/eliperelman/events{/privacy}","received_events_url":"https://api.github.com/users/eliperelman/received_events","type":"User","site_admin":false},"body":"\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/mozilla-raptor/raptor-cli/40)\n<!-- Reviewable:end -->\n","created_at":"2015-12-09T16:52:02Z","updated_at":"2015-12-18T15:39:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f243e692d1425dbae6f8cd14b05787f9c67dd050","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40/commits","review_comments_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40/comments","review_comment_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/40/comments","statuses_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/statuses/8bfdba6d49c706377f45809370201a0c232c730c","head":{"label":"eliperelman:cli-module","ref":"cli-module","sha":"8bfdba6d49c706377f45809370201a0c232c730c","user":{"login":"eliperelman","id":285899,"avatar_url":"https://avatars.githubusercontent.com/u/285899?v=3","gravatar_id":"","url":"https://api.github.com/users/eliperelman","html_url":"https://github.com/eliperelman","followers_url":"https://api.github.com/users/eliperelman/followers","following_url":"https://api.github.com/users/eliperelman/following{/other_user}","gists_url":"https://api.github.com/users/eliperelman/gists{/gist_id}","starred_url":"https://api.github.com/users/eliperelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliperelman/subscriptions","organizations_url":"https://api.github.com/users/eliperelman/orgs","repos_url":"https://api.github.com/users/eliperelman/repos","events_url":"https://api.github.com/users/eliperelman/events{/privacy}","received_events_url":"https://api.github.com/users/eliperelman/received_events","type":"User","site_admin":false},"repo":{"id":39278435,"name":"raptor","full_name":"eliperelman/raptor","owner":{"login":"eliperelman","id":285899,"avatar_url":"https://avatars.githubusercontent.com/u/285899?v=3","gravatar_id":"","url":"https://api.github.com/users/eliperelman","html_url":"https://github.com/eliperelman","followers_url":"https://api.github.com/users/eliperelman/followers","following_url":"https://api.github.com/users/eliperelman/following{/other_user}","gists_url":"https://api.github.com/users/eliperelman/gists{/gist_id}","starred_url":"https://api.github.com/users/eliperelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliperelman/subscriptions","organizations_url":"https://api.github.com/users/eliperelman/orgs","repos_url":"https://api.github.com/users/eliperelman/repos","events_url":"https://api.github.com/users/eliperelman/events{/privacy}","received_events_url":"https://api.github.com/users/eliperelman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eliperelman/raptor","description":"@mozilla/raptor CLI tool for performance testing Firefox OS","fork":true,"url":"https://api.github.com/repos/eliperelman/raptor","forks_url":"https://api.github.com/repos/eliperelman/raptor/forks","keys_url":"https://api.github.com/repos/eliperelman/raptor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eliperelman/raptor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eliperelman/raptor/teams","hooks_url":"https://api.github.com/repos/eliperelman/raptor/hooks","issue_events_url":"https://api.github.com/repos/eliperelman/raptor/issues/events{/number}","events_url":"https://api.github.com/repos/eliperelman/raptor/events","assignees_url":"https://api.github.com/repos/eliperelman/raptor/assignees{/user}","branches_url":"https://api.github.com/repos/eliperelman/raptor/branches{/branch}","tags_url":"https://api.github.com/repos/eliperelman/raptor/tags","blobs_url":"https://api.github.com/repos/eliperelman/raptor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eliperelman/raptor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eliperelman/raptor/git/refs{/sha}","trees_url":"https://api.github.com/repos/eliperelman/raptor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eliperelman/raptor/statuses/{sha}","languages_url":"https://api.github.com/repos/eliperelman/raptor/languages","stargazers_url":"https://api.github.com/repos/eliperelman/raptor/stargazers","contributors_url":"https://api.github.com/repos/eliperelman/raptor/contributors","subscribers_url":"https://api.github.com/repos/eliperelman/raptor/subscribers","subscription_url":"https://api.github.com/repos/eliperelman/raptor/subscription","commits_url":"https://api.github.com/repos/eliperelman/raptor/commits{/sha}","git_commits_url":"https://api.github.com/repos/eliperelman/raptor/git/commits{/sha}","comments_url":"https://api.github.com/repos/eliperelman/raptor/comments{/number}","issue_comment_url":"https://api.github.com/repos/eliperelman/raptor/issues/comments{/number}","contents_url":"https://api.github.com/repos/eliperelman/raptor/contents/{+path}","compare_url":"https://api.github.com/repos/eliperelman/raptor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eliperelman/raptor/merges","archive_url":"https://api.github.com/repos/eliperelman/raptor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eliperelman/raptor/downloads","issues_url":"https://api.github.com/repos/eliperelman/raptor/issues{/number}","pulls_url":"https://api.github.com/repos/eliperelman/raptor/pulls{/number}","milestones_url":"https://api.github.com/repos/eliperelman/raptor/milestones{/number}","notifications_url":"https://api.github.com/repos/eliperelman/raptor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eliperelman/raptor/labels{/name}","releases_url":"https://api.github.com/repos/eliperelman/raptor/releases{/id}","created_at":"2015-07-17T22:43:59Z","updated_at":"2015-07-17T22:44:49Z","pushed_at":"2015-12-17T21:12:35Z","git_url":"git://github.com/eliperelman/raptor.git","ssh_url":"git@github.com:eliperelman/raptor.git","clone_url":"https://github.com/eliperelman/raptor.git","svn_url":"https://github.com/eliperelman/raptor","homepage":null,"size":189,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"mozilla-raptor:master","ref":"master","sha":"76e0685f7c8a557d1e488b9aa4f0a0d610f8324c","user":{"login":"mozilla-raptor","id":14983110,"avatar_url":"https://avatars.githubusercontent.com/u/14983110?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-raptor","html_url":"https://github.com/mozilla-raptor","followers_url":"https://api.github.com/users/mozilla-raptor/followers","following_url":"https://api.github.com/users/mozilla-raptor/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-raptor/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-raptor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-raptor/subscriptions","organizations_url":"https://api.github.com/users/mozilla-raptor/orgs","repos_url":"https://api.github.com/users/mozilla-raptor/repos","events_url":"https://api.github.com/users/mozilla-raptor/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-raptor/received_events","type":"Organization","site_admin":false},"repo":{"id":38768429,"name":"raptor-cli","full_name":"mozilla-raptor/raptor-cli","owner":{"login":"mozilla-raptor","id":14983110,"avatar_url":"https://avatars.githubusercontent.com/u/14983110?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-raptor","html_url":"https://github.com/mozilla-raptor","followers_url":"https://api.github.com/users/mozilla-raptor/followers","following_url":"https://api.github.com/users/mozilla-raptor/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-raptor/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-raptor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-raptor/subscriptions","organizations_url":"https://api.github.com/users/mozilla-raptor/orgs","repos_url":"https://api.github.com/users/mozilla-raptor/repos","events_url":"https://api.github.com/users/mozilla-raptor/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-raptor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-raptor/raptor-cli","description":"@mozilla/raptor CLI tool for performance testing Firefox OS","fork":false,"url":"https://api.github.com/repos/mozilla-raptor/raptor-cli","forks_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/forks","keys_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/teams","hooks_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/hooks","issue_events_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/events","assignees_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/tags","blobs_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/languages","stargazers_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/stargazers","contributors_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/contributors","subscribers_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/subscribers","subscription_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/subscription","commits_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/merges","archive_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/downloads","issues_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-raptor/raptor-cli/releases{/id}","created_at":"2015-07-08T17:14:27Z","updated_at":"2015-10-05T17:56:49Z","pushed_at":"2015-12-17T21:12:38Z","git_url":"git://github.com/mozilla-raptor/raptor-cli.git","ssh_url":"git@github.com:mozilla-raptor/raptor-cli.git","clone_url":"https://github.com/mozilla-raptor/raptor-cli.git","svn_url":"https://github.com/mozilla-raptor/raptor-cli","homepage":null,"size":209,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40"},"html":{"href":"https://github.com/mozilla-raptor/raptor-cli/pull/40"},"issue":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/40"},"comments":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-raptor/raptor-cli/statuses/8bfdba6d49c706377f45809370201a0c232c730c"}}}}