GitHub PullRequestReviewCommentEvent at 2014-08-01 20:57:17
Repository: gcloud-node
Actor: rakyll
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/15718619","id":15718619,"diff_hunk":"@@ -0,0 +1,173 @@\n+/**\n+ * Copyright 2014 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+var assert = require('assert'),\n+    fs = require('fs');\n+\n+var env = require('./env.js'),\n+    gcloud = require('../lib'),\n+    bucket = new gcloud.storage.Bucket(env);\n+\n+var pathToLogoFile = 'regression/data/CloudPlatform_128px_Retina.png';\n+var pathToReadFile = 'regression/data/readfile.txt';\n+\n+describe('storage', function() {\n+\n+  describe('write, read and remove files', function() {\n+\n+    it('should write/remove from file', function(done) {\n+      var fileName = 'CloudLogo';\n+      bucket.write(fileName, { filename: pathToLogoFile }, function(err, fileObject, resp) {\n+        if (err) { return done(err); }\n+        assert(fileObject);\n+        bucket.remove(fileName, function(err) {\n+          if (err) { return done(err); }\n+          done();\n+        });\n+      });\n+    });\n+\n+    it('should write/remove from stream', function(done) {\n+      var fileName = 'CloudLogo';\n+      bucket.write(fileName, { data: fs.createReadStream(pathToLogoFile) },\n+          function(err, fileObject) {\n+        if (err) { return done(err); }\n+        assert(fileObject);\n+        bucket.remove(fileName, function(err) {\n+          if (err) { return done(err); }\n+          done();\n+        });\n+      });\n+    });\n+\n+    it('should write/read/remove from a buffer', function(done) {\n+      var fileName = 'MyBuffer',\n+          fileContent =  'Hello World';\n+      bucket.write(fileName, { data: fileContent }, function(err, fileObject) {\n+        if (err) { return done(err); }\n+        assert(fileObject);\n+        var content = '';\n+        bucket.createReadStream(fileName)\n+            .pipe(fs.createWriteStream(pathToReadFile))\n+            .on('error', done)\n+            .on('complete', function(content) {\n+              bucket.remove(fileName, function(err) {\n+                if (err) { return done(err); }\n+                fs.readFile(pathToReadFile, function(err, data) {\n+                  assert.equal(data, fileContent);\n+                  fs.unlink(pathToReadFile, function(err) {\n+                    if (err) { return done(err); }\n+                    done();\n+                  });\n+                });\n+              });\n+            });\n+      });\n+    });\n+\n+    it('should write and read metadata', function(done) {\n+      var fileName = 'CloudLogo',\n+          myMetadata = { contentType: 'image/png'};\n+      bucket.write(fileName, { filename: pathToLogoFile, metadata: myMetadata },\n+          function(err, fileObject) {\n+        if (err) { return done(err); }\n+        bucket.stat(fileName, function(err, metadata) {\n+          if (err) { return done(err); }\n+          assert.equal(metadata['contentType'], myMetadata['contentType']);\n+          bucket.remove(fileName, function(err) {\n+            if (err) { return done(err); }\n+            done();\n+          });\n+        });\n+      });\n+    });\n+\n+    it('should copy an existing file', function(done) {\n+      var fileName = 'CloudLogo',\n+          copyName = 'CloudLogoCopy';\n+\n+      bucket.write(fileName, { filename: pathToLogoFile }, function(err, fileObject) {\n+        if (err) { return done(err); }\n+        bucket.copy(fileName, {  name: copyName }, function() {\n+          if (err) { return done(err); }\n+          bucket.remove(copyName, function(err) {\n+            if (err) { return done(err); }\n+            bucket.remove(fileName, function(err) {\n+              if (err) { return done(err); }\n+              done();\n+            });\n+          });\n+        });\n+      });\n+    });\n+\n+  });\n+\n+  describe('list files', function() {\n+\n+    var filenames = ['CloudLogo1', 'CloudLogo2', 'CloudLogo3'];\n+\n+    before(function(done) {\n+      bucket.write(filenames[0], { filename: pathToLogoFile }, function(err, fileObject) {\n+        if (err) { return done(err); }\n+        bucket.copy(filenames[0], {  name: filenames[1] }, function() {\n+          if (err) { return done(err); }\n+          bucket.copy(filenames[0], {  name: filenames[2] }, function() {\n+            if (err) { return done(err); }\n+            done();\n+          });\n+        });\n+      });\n+    });\n+\n+    it('should list files', function(done) {\n+      bucket.list(function(err, files, nextQuery) {\n+        if (err) { return done(err); }\n+        assert.equal(files.length, 3);\n+        assert.equal(nextQuery, null);\n+        done();\n+      });\n+    });\n+\n+    it('should paginate the list', function(done) {\n+      bucket.list({ maxResults: 2 }, function(err, files, nextQuery) {\n+        if (err) { return done(err); }\n+        assert.equal(files.length, 2);\n+        assert(nextQuery);\n+        bucket.list(nextQuery, function(err, files, nextQuery) {\n+          if (err) { return done(err); }\n+          assert(files);\n+          done();\n+        });\n+      });\n+    });\n+\n+    after(function(done) {\n+      bucket.remove(filenames[0], function(err) {","path":"regression/storage.js","position":159,"original_position":159,"commit_id":"efb3d7db366e0b02a1628c576ed168b4e517df30","original_commit_id":"efb3d7db366e0b02a1628c576ed168b4e517df30","user":{"login":"rakyll","id":108380,"avatar_url":"https://avatars.githubusercontent.com/u/108380?v=1","gravatar_id":"e7526ec3e801f8ba99f6746498a154a6","url":"https://api.github.com/users/rakyll","html_url":"https://github.com/rakyll","followers_url":"https://api.github.com/users/rakyll/followers","following_url":"https://api.github.com/users/rakyll/following{/other_user}","gists_url":"https://api.github.com/users/rakyll/gists{/gist_id}","starred_url":"https://api.github.com/users/rakyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakyll/subscriptions","organizations_url":"https://api.github.com/users/rakyll/orgs","repos_url":"https://api.github.com/users/rakyll/repos","events_url":"https://api.github.com/users/rakyll/events{/privacy}","received_events_url":"https://api.github.com/users/rakyll/received_events","type":"User","site_admin":false},"body":"You can use async.parallel for batch tasks.","created_at":"2014-08-01T20:57:17Z","updated_at":"2014-08-01T20:57:17Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88#discussion_r15718619","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/15718619"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88#discussion_r15718619"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88","id":19229943,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/88","number":88,"state":"open","title":"test(storage): add regression tests.","user":{"login":"silvolu","id":596919,"avatar_url":"https://avatars.githubusercontent.com/u/596919?v=1","gravatar_id":"8286351790ea019f0e5907eb1f6473fb","url":"https://api.github.com/users/silvolu","html_url":"https://github.com/silvolu","followers_url":"https://api.github.com/users/silvolu/followers","following_url":"https://api.github.com/users/silvolu/following{/other_user}","gists_url":"https://api.github.com/users/silvolu/gists{/gist_id}","starred_url":"https://api.github.com/users/silvolu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silvolu/subscriptions","organizations_url":"https://api.github.com/users/silvolu/orgs","repos_url":"https://api.github.com/users/silvolu/repos","events_url":"https://api.github.com/users/silvolu/events{/privacy}","received_events_url":"https://api.github.com/users/silvolu/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-08-01T19:44:51Z","updated_at":"2014-08-01T20:57:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d162a28a4aa06279da3a7860197d2f73d00c6607","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/{number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/88/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/efb3d7db366e0b02a1628c576ed168b4e517df30","head":{"label":"silvolu:master","ref":"master","sha":"efb3d7db366e0b02a1628c576ed168b4e517df30","user":{"login":"silvolu","id":596919,"avatar_url":"https://avatars.githubusercontent.com/u/596919?v=1","gravatar_id":"8286351790ea019f0e5907eb1f6473fb","url":"https://api.github.com/users/silvolu","html_url":"https://github.com/silvolu","followers_url":"https://api.github.com/users/silvolu/followers","following_url":"https://api.github.com/users/silvolu/following{/other_user}","gists_url":"https://api.github.com/users/silvolu/gists{/gist_id}","starred_url":"https://api.github.com/users/silvolu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silvolu/subscriptions","organizations_url":"https://api.github.com/users/silvolu/orgs","repos_url":"https://api.github.com/users/silvolu/repos","events_url":"https://api.github.com/users/silvolu/events{/privacy}","received_events_url":"https://api.github.com/users/silvolu/received_events","type":"User","site_admin":false},"repo":{"id":22045979,"name":"gcloud-node","full_name":"silvolu/gcloud-node","owner":{"login":"silvolu","id":596919,"avatar_url":"https://avatars.githubusercontent.com/u/596919?v=1","gravatar_id":"8286351790ea019f0e5907eb1f6473fb","url":"https://api.github.com/users/silvolu","html_url":"https://github.com/silvolu","followers_url":"https://api.github.com/users/silvolu/followers","following_url":"https://api.github.com/users/silvolu/following{/other_user}","gists_url":"https://api.github.com/users/silvolu/gists{/gist_id}","starred_url":"https://api.github.com/users/silvolu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silvolu/subscriptions","organizations_url":"https://api.github.com/users/silvolu/orgs","repos_url":"https://api.github.com/users/silvolu/repos","events_url":"https://api.github.com/users/silvolu/events{/privacy}","received_events_url":"https://api.github.com/users/silvolu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/silvolu/gcloud-node","description":"Google Cloud Node Client Library","fork":true,"url":"https://api.github.com/repos/silvolu/gcloud-node","forks_url":"https://api.github.com/repos/silvolu/gcloud-node/forks","keys_url":"https://api.github.com/repos/silvolu/gcloud-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silvolu/gcloud-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silvolu/gcloud-node/teams","hooks_url":"https://api.github.com/repos/silvolu/gcloud-node/hooks","issue_events_url":"https://api.github.com/repos/silvolu/gcloud-node/issues/events{/number}","events_url":"https://api.github.com/repos/silvolu/gcloud-node/events","assignees_url":"https://api.github.com/repos/silvolu/gcloud-node/assignees{/user}","branches_url":"https://api.github.com/repos/silvolu/gcloud-node/branches{/branch}","tags_url":"https://api.github.com/repos/silvolu/gcloud-node/tags","blobs_url":"https://api.github.com/repos/silvolu/gcloud-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silvolu/gcloud-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silvolu/gcloud-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/silvolu/gcloud-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silvolu/gcloud-node/statuses/{sha}","languages_url":"https://api.github.com/repos/silvolu/gcloud-node/languages","stargazers_url":"https://api.github.com/repos/silvolu/gcloud-node/stargazers","contributors_url":"https://api.github.com/repos/silvolu/gcloud-node/contributors","subscribers_url":"https://api.github.com/repos/silvolu/gcloud-node/subscribers","subscription_url":"https://api.github.com/repos/silvolu/gcloud-node/subscription","commits_url":"https://api.github.com/repos/silvolu/gcloud-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/silvolu/gcloud-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/silvolu/gcloud-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/silvolu/gcloud-node/issues/comments/{number}","contents_url":"https://api.github.com/repos/silvolu/gcloud-node/contents/{+path}","compare_url":"https://api.github.com/repos/silvolu/gcloud-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silvolu/gcloud-node/merges","archive_url":"https://api.github.com/repos/silvolu/gcloud-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silvolu/gcloud-node/downloads","issues_url":"https://api.github.com/repos/silvolu/gcloud-node/issues{/number}","pulls_url":"https://api.github.com/repos/silvolu/gcloud-node/pulls{/number}","milestones_url":"https://api.github.com/repos/silvolu/gcloud-node/milestones{/number}","notifications_url":"https://api.github.com/repos/silvolu/gcloud-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silvolu/gcloud-node/labels{/name}","releases_url":"https://api.github.com/repos/silvolu/gcloud-node/releases{/id}","created_at":"2014-07-20T23:30:44Z","updated_at":"2014-07-20T23:34:21Z","pushed_at":"2014-08-01T20:03:54Z","git_url":"git://github.com/silvolu/gcloud-node.git","ssh_url":"git@github.com:silvolu/gcloud-node.git","clone_url":"https://github.com/silvolu/gcloud-node.git","svn_url":"https://github.com/silvolu/gcloud-node","homepage":"","size":788,"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":"GoogleCloudPlatform:master","ref":"master","sha":"771d3cc07dcfef367c1eaea40642dea84f5f560a","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=1","gravatar_id":"3db02c6238c8b1fb844871330744ec5d","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":19483273,"name":"gcloud-node","full_name":"GoogleCloudPlatform/gcloud-node","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=1","gravatar_id":"3db02c6238c8b1fb844871330744ec5d","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-node","description":"Google Cloud Node Client Library","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/{number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/releases{/id}","created_at":"2014-05-06T06:18:00Z","updated_at":"2014-07-31T23:43:25Z","pushed_at":"2014-08-01T20:54:19Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-node.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-node.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-node.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-node","homepage":"","size":2219,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":9,"mirror_url":null,"open_issues_count":21,"forks":9,"open_issues":21,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/88"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/88"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/88/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/88/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/efb3d7db366e0b02a1628c576ed168b4e517df30"}}}}