{"action":"created","comment":{"url":"https://api.github.com/repos/hws-wao/core/pulls/comments/24713445","id":24713445,"diff_hunk":"@@ -35,16 +40,21 @@ var File = (function() {\n   // @param {string} path 読み込みたいファイルのパス\n   // @return {string} ファイルの内容\n   p.read = function(args) {\n-    var filePath = args['path'];\n-    this.checkRequiredArg(filePath, 'filePath');\n-\n-    var filePathAbs = path.resolve(path.join(this.baseDir, filePath));\n-    if (!this.checkPermission(filePathAbs)) { throw new Error('Permission Error. [' + filePath + ']') }\n-    if (!fs.existsSync(filePathAbs))        { throw new Error('specified file (' + filePath + ') is not found.') }\n-    if (!fs.statSync(filePathAbs).isFile()) { throw new Error('filePath [' + filePath + '] is not file.') }\n-\n-    return fs.readFileSync(filePathAbs, { encoding: this.defaultEncoding });\n-  };\n+    var d        = $.Deferred();\n+    var _args    = args || {};\n+    var filePath = _args['path'];\n+\n+    checkRequiredArg(filePath, 'filePath')\n+      .then(makeAbsolutePath(this.baseDir, filePath))\n+      .then(checkPermission)\n+      .then(checkExistsFile)\n+      .then(checkPathIsFile)\n+      .then(readFile)\n+      .done(function(result) { d.resolve(result) })\n+      .fail(function(e) { d.reject(e) });\n+\n+    return d.promise();\n+  }","path":"lib/file.js","position":53,"original_position":53,"commit_id":"3dc7b5049884fd42347d3230e614f818eb337b13","original_commit_id":"3dc7b5049884fd42347d3230e614f818eb337b13","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Missing semicolon.","created_at":"2015-02-14T09:06:32Z","updated_at":"2015-02-14T09:06:32Z","html_url":"https://github.com/hws-wao/core/pull/12#discussion_r24713445","pull_request_url":"https://api.github.com/repos/hws-wao/core/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/hws-wao/core/pulls/comments/24713445"},"html":{"href":"https://github.com/hws-wao/core/pull/12#discussion_r24713445"},"pull_request":{"href":"https://api.github.com/repos/hws-wao/core/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/hws-wao/core/pulls/12","id":28971449,"html_url":"https://github.com/hws-wao/core/pull/12","diff_url":"https://github.com/hws-wao/core/pull/12.diff","patch_url":"https://github.com/hws-wao/core/pull/12.patch","issue_url":"https://api.github.com/repos/hws-wao/core/issues/12","number":12,"state":"open","locked":false,"title":"file.jsをdeferredを使って書き直す refs #2","user":{"login":"yujiroarai","id":2792310,"avatar_url":"https://avatars.githubusercontent.com/u/2792310?v=3","gravatar_id":"","url":"https://api.github.com/users/yujiroarai","html_url":"https://github.com/yujiroarai","followers_url":"https://api.github.com/users/yujiroarai/followers","following_url":"https://api.github.com/users/yujiroarai/following{/other_user}","gists_url":"https://api.github.com/users/yujiroarai/gists{/gist_id}","starred_url":"https://api.github.com/users/yujiroarai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yujiroarai/subscriptions","organizations_url":"https://api.github.com/users/yujiroarai/orgs","repos_url":"https://api.github.com/users/yujiroarai/repos","events_url":"https://api.github.com/users/yujiroarai/events{/privacy}","received_events_url":"https://api.github.com/users/yujiroarai/received_events","type":"User","site_admin":false},"body":"refs #2 ","created_at":"2015-02-10T00:46:31Z","updated_at":"2015-02-14T09:06:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa20c18cea716600065943045a3982d535d4166a","assignee":{"login":"yujiroarai","id":2792310,"avatar_url":"https://avatars.githubusercontent.com/u/2792310?v=3","gravatar_id":"","url":"https://api.github.com/users/yujiroarai","html_url":"https://github.com/yujiroarai","followers_url":"https://api.github.com/users/yujiroarai/followers","following_url":"https://api.github.com/users/yujiroarai/following{/other_user}","gists_url":"https://api.github.com/users/yujiroarai/gists{/gist_id}","starred_url":"https://api.github.com/users/yujiroarai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yujiroarai/subscriptions","organizations_url":"https://api.github.com/users/yujiroarai/orgs","repos_url":"https://api.github.com/users/yujiroarai/repos","events_url":"https://api.github.com/users/yujiroarai/events{/privacy}","received_events_url":"https://api.github.com/users/yujiroarai/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/hws-wao/core/pulls/12/commits","review_comments_url":"https://api.github.com/repos/hws-wao/core/pulls/12/comments","review_comment_url":"https://api.github.com/repos/hws-wao/core/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hws-wao/core/issues/12/comments","statuses_url":"https://api.github.com/repos/hws-wao/core/statuses/3dc7b5049884fd42347d3230e614f818eb337b13","head":{"label":"hws-wao:2-filejs-deferred","ref":"2-filejs-deferred","sha":"3dc7b5049884fd42347d3230e614f818eb337b13","user":{"login":"hws-wao","id":10883003,"avatar_url":"https://avatars.githubusercontent.com/u/10883003?v=3","gravatar_id":"","url":"https://api.github.com/users/hws-wao","html_url":"https://github.com/hws-wao","followers_url":"https://api.github.com/users/hws-wao/followers","following_url":"https://api.github.com/users/hws-wao/following{/other_user}","gists_url":"https://api.github.com/users/hws-wao/gists{/gist_id}","starred_url":"https://api.github.com/users/hws-wao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hws-wao/subscriptions","organizations_url":"https://api.github.com/users/hws-wao/orgs","repos_url":"https://api.github.com/users/hws-wao/repos","events_url":"https://api.github.com/users/hws-wao/events{/privacy}","received_events_url":"https://api.github.com/users/hws-wao/received_events","type":"Organization","site_admin":false},"repo":{"id":30413696,"name":"core","full_name":"hws-wao/core","owner":{"login":"hws-wao","id":10883003,"avatar_url":"https://avatars.githubusercontent.com/u/10883003?v=3","gravatar_id":"","url":"https://api.github.com/users/hws-wao","html_url":"https://github.com/hws-wao","followers_url":"https://api.github.com/users/hws-wao/followers","following_url":"https://api.github.com/users/hws-wao/following{/other_user}","gists_url":"https://api.github.com/users/hws-wao/gists{/gist_id}","starred_url":"https://api.github.com/users/hws-wao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hws-wao/subscriptions","organizations_url":"https://api.github.com/users/hws-wao/orgs","repos_url":"https://api.github.com/users/hws-wao/repos","events_url":"https://api.github.com/users/hws-wao/events{/privacy}","received_events_url":"https://api.github.com/users/hws-wao/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hws-wao/core","description":"","fork":false,"url":"https://api.github.com/repos/hws-wao/core","forks_url":"https://api.github.com/repos/hws-wao/core/forks","keys_url":"https://api.github.com/repos/hws-wao/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hws-wao/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hws-wao/core/teams","hooks_url":"https://api.github.com/repos/hws-wao/core/hooks","issue_events_url":"https://api.github.com/repos/hws-wao/core/issues/events{/number}","events_url":"https://api.github.com/repos/hws-wao/core/events","assignees_url":"https://api.github.com/repos/hws-wao/core/assignees{/user}","branches_url":"https://api.github.com/repos/hws-wao/core/branches{/branch}","tags_url":"https://api.github.com/repos/hws-wao/core/tags","blobs_url":"https://api.github.com/repos/hws-wao/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hws-wao/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hws-wao/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/hws-wao/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hws-wao/core/statuses/{sha}","languages_url":"https://api.github.com/repos/hws-wao/core/languages","stargazers_url":"https://api.github.com/repos/hws-wao/core/stargazers","contributors_url":"https://api.github.com/repos/hws-wao/core/contributors","subscribers_url":"https://api.github.com/repos/hws-wao/core/subscribers","subscription_url":"https://api.github.com/repos/hws-wao/core/subscription","commits_url":"https://api.github.com/repos/hws-wao/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/hws-wao/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/hws-wao/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/hws-wao/core/issues/comments/{number}","contents_url":"https://api.github.com/repos/hws-wao/core/contents/{+path}","compare_url":"https://api.github.com/repos/hws-wao/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hws-wao/core/merges","archive_url":"https://api.github.com/repos/hws-wao/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hws-wao/core/downloads","issues_url":"https://api.github.com/repos/hws-wao/core/issues{/number}","pulls_url":"https://api.github.com/repos/hws-wao/core/pulls{/number}","milestones_url":"https://api.github.com/repos/hws-wao/core/milestones{/number}","notifications_url":"https://api.github.com/repos/hws-wao/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hws-wao/core/labels{/name}","releases_url":"https://api.github.com/repos/hws-wao/core/releases{/id}","created_at":"2015-02-06T13:36:30Z","updated_at":"2015-02-14T09:00:04Z","pushed_at":"2015-02-14T09:06:25Z","git_url":"git://github.com/hws-wao/core.git","ssh_url":"git@github.com:hws-wao/core.git","clone_url":"https://github.com/hws-wao/core.git","svn_url":"https://github.com/hws-wao/core","homepage":null,"size":436,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":24,"forks":1,"open_issues":24,"watchers":0,"default_branch":"master"}},"base":{"label":"hws-wao:master","ref":"master","sha":"b964a6688228146ed67166139ea419500ca5ccaa","user":{"login":"hws-wao","id":10883003,"avatar_url":"https://avatars.githubusercontent.com/u/10883003?v=3","gravatar_id":"","url":"https://api.github.com/users/hws-wao","html_url":"https://github.com/hws-wao","followers_url":"https://api.github.com/users/hws-wao/followers","following_url":"https://api.github.com/users/hws-wao/following{/other_user}","gists_url":"https://api.github.com/users/hws-wao/gists{/gist_id}","starred_url":"https://api.github.com/users/hws-wao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hws-wao/subscriptions","organizations_url":"https://api.github.com/users/hws-wao/orgs","repos_url":"https://api.github.com/users/hws-wao/repos","events_url":"https://api.github.com/users/hws-wao/events{/privacy}","received_events_url":"https://api.github.com/users/hws-wao/received_events","type":"Organization","site_admin":false},"repo":{"id":30413696,"name":"core","full_name":"hws-wao/core","owner":{"login":"hws-wao","id":10883003,"avatar_url":"https://avatars.githubusercontent.com/u/10883003?v=3","gravatar_id":"","url":"https://api.github.com/users/hws-wao","html_url":"https://github.com/hws-wao","followers_url":"https://api.github.com/users/hws-wao/followers","following_url":"https://api.github.com/users/hws-wao/following{/other_user}","gists_url":"https://api.github.com/users/hws-wao/gists{/gist_id}","starred_url":"https://api.github.com/users/hws-wao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hws-wao/subscriptions","organizations_url":"https://api.github.com/users/hws-wao/orgs","repos_url":"https://api.github.com/users/hws-wao/repos","events_url":"https://api.github.com/users/hws-wao/events{/privacy}","received_events_url":"https://api.github.com/users/hws-wao/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hws-wao/core","description":"","fork":false,"url":"https://api.github.com/repos/hws-wao/core","forks_url":"https://api.github.com/repos/hws-wao/core/forks","keys_url":"https://api.github.com/repos/hws-wao/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hws-wao/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hws-wao/core/teams","hooks_url":"https://api.github.com/repos/hws-wao/core/hooks","issue_events_url":"https://api.github.com/repos/hws-wao/core/issues/events{/number}","events_url":"https://api.github.com/repos/hws-wao/core/events","assignees_url":"https://api.github.com/repos/hws-wao/core/assignees{/user}","branches_url":"https://api.github.com/repos/hws-wao/core/branches{/branch}","tags_url":"https://api.github.com/repos/hws-wao/core/tags","blobs_url":"https://api.github.com/repos/hws-wao/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hws-wao/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hws-wao/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/hws-wao/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hws-wao/core/statuses/{sha}","languages_url":"https://api.github.com/repos/hws-wao/core/languages","stargazers_url":"https://api.github.com/repos/hws-wao/core/stargazers","contributors_url":"https://api.github.com/repos/hws-wao/core/contributors","subscribers_url":"https://api.github.com/repos/hws-wao/core/subscribers","subscription_url":"https://api.github.com/repos/hws-wao/core/subscription","commits_url":"https://api.github.com/repos/hws-wao/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/hws-wao/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/hws-wao/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/hws-wao/core/issues/comments/{number}","contents_url":"https://api.github.com/repos/hws-wao/core/contents/{+path}","compare_url":"https://api.github.com/repos/hws-wao/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hws-wao/core/merges","archive_url":"https://api.github.com/repos/hws-wao/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hws-wao/core/downloads","issues_url":"https://api.github.com/repos/hws-wao/core/issues{/number}","pulls_url":"https://api.github.com/repos/hws-wao/core/pulls{/number}","milestones_url":"https://api.github.com/repos/hws-wao/core/milestones{/number}","notifications_url":"https://api.github.com/repos/hws-wao/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hws-wao/core/labels{/name}","releases_url":"https://api.github.com/repos/hws-wao/core/releases{/id}","created_at":"2015-02-06T13:36:30Z","updated_at":"2015-02-14T09:00:04Z","pushed_at":"2015-02-14T09:06:25Z","git_url":"git://github.com/hws-wao/core.git","ssh_url":"git@github.com:hws-wao/core.git","clone_url":"https://github.com/hws-wao/core.git","svn_url":"https://github.com/hws-wao/core","homepage":null,"size":436,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":24,"forks":1,"open_issues":24,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hws-wao/core/pulls/12"},"html":{"href":"https://github.com/hws-wao/core/pull/12"},"issue":{"href":"https://api.github.com/repos/hws-wao/core/issues/12"},"comments":{"href":"https://api.github.com/repos/hws-wao/core/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/hws-wao/core/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/hws-wao/core/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hws-wao/core/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/hws-wao/core/statuses/3dc7b5049884fd42347d3230e614f818eb337b13"}}}}