{"action":"created","comment":{"url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/comments/55633595","id":55633595,"diff_hunk":"@@ -0,0 +1,72 @@\n+/**\n+ * Gulp tasks for managing an S3-based preview of the Pattern Library documentation.\n+ *\n+ * The tasks are as follows:\n+ *  - build-preview: builds a preview site and uploads it to S3\n+ *  - jekyll-build-preview: build the preview site\n+ *  - upload-preview: upload the preview site to S3\n+ *  - remove-preview: removes the preview site from S3\n+ *\n+ * Note: please set the environment variable S3_PREVIEW_DOMAIN to the domain\n+ * used to host your S3 preview.\n+ */\n+(function() {\n+    'use strict';\n+\n+    var gulp = require('gulp'),\n+        runSequence = require('run-sequence'),\n+        childProcess = require('child_process'),\n+        gitUtils = require('../util/gitUtils'),\n+        previewConfigFile = '_tmp_preview_config.yml',\n+        previewSiteDir = '_preview_site',\n+        previewDomain = process.env.S3_PREVIEW_DOMAIN;\n+\n+    gulp.task('build-preview', function(callback) {\n+        runSequence(\n+            'jekyll-build-preview',\n+            'upload-preview',\n+            callback);\n+    });\n+\n+    gulp.task('jekyll-build-preview', function() {\n+        var branch = gitUtils.currentBranch(),\n+            previewBaseUrl = '/' + branch + '/';\n+        // Create a temporary Jekyll configuration file which specifies the base URL for the preview site\n+        childProcess.execSync(","path":"gulp/tasks/preview.js","position":35,"original_position":35,"commit_id":"6b0805e1b5fd2eb4f39a5f567154a2149f923167","original_commit_id":"6b0805e1b5fd2eb4f39a5f567154a2149f923167","user":{"login":"andy-armstrong","id":5985072,"avatar_url":"https://avatars.githubusercontent.com/u/5985072?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-armstrong","html_url":"https://github.com/andy-armstrong","followers_url":"https://api.github.com/users/andy-armstrong/followers","following_url":"https://api.github.com/users/andy-armstrong/following{/other_user}","gists_url":"https://api.github.com/users/andy-armstrong/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-armstrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-armstrong/subscriptions","organizations_url":"https://api.github.com/users/andy-armstrong/orgs","repos_url":"https://api.github.com/users/andy-armstrong/repos","events_url":"https://api.github.com/users/andy-armstrong/events{/privacy}","received_events_url":"https://api.github.com/users/andy-armstrong/received_events","type":"User","site_admin":false},"body":"Sorry that that wasn't clear. Each gulp task already catches errors and displays them, so having our own try/catch seems IMO verbose and unnecessary. I've looked at a lot of gulp task implementations using Google and I don't see any that do explicit error handling. As I said, gulp is more like a makefile, and in makefiles you don't write error handling.\r\n\r\nI tried forcing some errors and while the exceptions could be clearer in some cases, the actual error is always reported. For example, here's what happens when I switch the command from 'aws' to 'awsx':\r\n\r\n```\r\n$ gulp upload-preview\r\n[23:44:43] Using gulpfile ~/edx/src/ux-pattern-library/gulpfile.js\r\n[23:44:43] Starting 'upload-preview'...\r\n/bin/sh: awsx: command not found\r\n[23:44:43] 'upload-preview' errored after 14 ms\r\n[23:44:43] Error: Command failed: awsx s3 sync _preview_site s3://ux-test.edx.org/andya/s3-preview\r\n/bin/sh: awsx: command not found\r\n\r\n    at checkExecSyncError (child_process.js:1346:13)\r\n    at Object.execSync (child_process.js:1386:13)\r\n    at Gulp.<anonymous> (/Users/andya/edx/src/ux-pattern-library/gulp/tasks/preview.js:54:26)\r\n    at module.exports (/Users/andya/edx/src/ux-pattern-library/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)\r\n    at Gulp.Orchestrator._runTask (/Users/andya/edx/src/ux-pattern-library/node_modules/gulp/node_modules/orchestrator/index.js:273:3)\r\n    at Gulp.Orchestrator._runStep (/Users/andya/edx/src/ux-pattern-library/node_modules/gulp/node_modules/orchestrator/index.js:214:10)\r\n    at Gulp.Orchestrator.start (/Users/andya/edx/src/ux-pattern-library/node_modules/gulp/node_modules/orchestrator/index.js:134:8)\r\n    at /usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:46:20\r\n    at process._tickCallback (node.js:355:11)\r\n    at Function.Module.runMain (module.js:503:11)\r\n```","created_at":"2016-03-10T04:46:08Z","updated_at":"2016-03-10T04:46:08Z","html_url":"https://github.com/edx/ux-pattern-library/pull/304#discussion_r55633595","pull_request_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304","_links":{"self":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/comments/55633595"},"html":{"href":"https://github.com/edx/ux-pattern-library/pull/304#discussion_r55633595"},"pull_request":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304"}}},"pull_request":{"url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304","id":62017131,"html_url":"https://github.com/edx/ux-pattern-library/pull/304","diff_url":"https://github.com/edx/ux-pattern-library/pull/304.diff","patch_url":"https://github.com/edx/ux-pattern-library/pull/304.patch","issue_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/304","number":304,"state":"open","locked":false,"title":"Automate publishing of documentation preview to S3","user":{"login":"andy-armstrong","id":5985072,"avatar_url":"https://avatars.githubusercontent.com/u/5985072?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-armstrong","html_url":"https://github.com/andy-armstrong","followers_url":"https://api.github.com/users/andy-armstrong/followers","following_url":"https://api.github.com/users/andy-armstrong/following{/other_user}","gists_url":"https://api.github.com/users/andy-armstrong/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-armstrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-armstrong/subscriptions","organizations_url":"https://api.github.com/users/andy-armstrong/orgs","repos_url":"https://api.github.com/users/andy-armstrong/repos","events_url":"https://api.github.com/users/andy-armstrong/events{/privacy}","received_events_url":"https://api.github.com/users/andy-armstrong/received_events","type":"User","site_admin":false},"body":"https://openedx.atlassian.net/browse/FEDX-74","created_at":"2016-03-08T02:50:01Z","updated_at":"2016-03-10T04:46:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"953e1518fb4f13537bec042f2fed1f1d4e1146f4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304/commits","review_comments_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304/comments","review_comment_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/304/comments","statuses_url":"https://api.github.com/repos/edx/ux-pattern-library/statuses/6b0805e1b5fd2eb4f39a5f567154a2149f923167","head":{"label":"edx:andya/s3-preview","ref":"andya/s3-preview","sha":"6b0805e1b5fd2eb4f39a5f567154a2149f923167","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29666334,"name":"ux-pattern-library","full_name":"edx/ux-pattern-library","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/ux-pattern-library","description":"The (working) Visual, UI, and Front End Styleguide for edX.","fork":false,"url":"https://api.github.com/repos/edx/ux-pattern-library","forks_url":"https://api.github.com/repos/edx/ux-pattern-library/forks","keys_url":"https://api.github.com/repos/edx/ux-pattern-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/ux-pattern-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/ux-pattern-library/teams","hooks_url":"https://api.github.com/repos/edx/ux-pattern-library/hooks","issue_events_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/events{/number}","events_url":"https://api.github.com/repos/edx/ux-pattern-library/events","assignees_url":"https://api.github.com/repos/edx/ux-pattern-library/assignees{/user}","branches_url":"https://api.github.com/repos/edx/ux-pattern-library/branches{/branch}","tags_url":"https://api.github.com/repos/edx/ux-pattern-library/tags","blobs_url":"https://api.github.com/repos/edx/ux-pattern-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/ux-pattern-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/ux-pattern-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/ux-pattern-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/ux-pattern-library/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/ux-pattern-library/languages","stargazers_url":"https://api.github.com/repos/edx/ux-pattern-library/stargazers","contributors_url":"https://api.github.com/repos/edx/ux-pattern-library/contributors","subscribers_url":"https://api.github.com/repos/edx/ux-pattern-library/subscribers","subscription_url":"https://api.github.com/repos/edx/ux-pattern-library/subscription","commits_url":"https://api.github.com/repos/edx/ux-pattern-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/ux-pattern-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/ux-pattern-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/ux-pattern-library/contents/{+path}","compare_url":"https://api.github.com/repos/edx/ux-pattern-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/ux-pattern-library/merges","archive_url":"https://api.github.com/repos/edx/ux-pattern-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/ux-pattern-library/downloads","issues_url":"https://api.github.com/repos/edx/ux-pattern-library/issues{/number}","pulls_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/ux-pattern-library/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/ux-pattern-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/ux-pattern-library/labels{/name}","releases_url":"https://api.github.com/repos/edx/ux-pattern-library/releases{/id}","deployments_url":"https://api.github.com/repos/edx/ux-pattern-library/deployments","created_at":"2015-01-22T07:19:42Z","updated_at":"2016-03-09T16:32:45Z","pushed_at":"2016-03-09T22:52:57Z","git_url":"git://github.com/edx/ux-pattern-library.git","ssh_url":"git@github.com:edx/ux-pattern-library.git","clone_url":"https://github.com/edx/ux-pattern-library.git","svn_url":"https://github.com/edx/ux-pattern-library","homepage":"http://ux.edx.org","size":8061,"stargazers_count":230,"watchers_count":230,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":30,"mirror_url":null,"open_issues_count":8,"forks":30,"open_issues":8,"watchers":230,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"758ef7380ccb1b857ff3a03e5f7b569722f74f8a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29666334,"name":"ux-pattern-library","full_name":"edx/ux-pattern-library","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/ux-pattern-library","description":"The (working) Visual, UI, and Front End Styleguide for edX.","fork":false,"url":"https://api.github.com/repos/edx/ux-pattern-library","forks_url":"https://api.github.com/repos/edx/ux-pattern-library/forks","keys_url":"https://api.github.com/repos/edx/ux-pattern-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/ux-pattern-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/ux-pattern-library/teams","hooks_url":"https://api.github.com/repos/edx/ux-pattern-library/hooks","issue_events_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/events{/number}","events_url":"https://api.github.com/repos/edx/ux-pattern-library/events","assignees_url":"https://api.github.com/repos/edx/ux-pattern-library/assignees{/user}","branches_url":"https://api.github.com/repos/edx/ux-pattern-library/branches{/branch}","tags_url":"https://api.github.com/repos/edx/ux-pattern-library/tags","blobs_url":"https://api.github.com/repos/edx/ux-pattern-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/ux-pattern-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/ux-pattern-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/ux-pattern-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/ux-pattern-library/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/ux-pattern-library/languages","stargazers_url":"https://api.github.com/repos/edx/ux-pattern-library/stargazers","contributors_url":"https://api.github.com/repos/edx/ux-pattern-library/contributors","subscribers_url":"https://api.github.com/repos/edx/ux-pattern-library/subscribers","subscription_url":"https://api.github.com/repos/edx/ux-pattern-library/subscription","commits_url":"https://api.github.com/repos/edx/ux-pattern-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/ux-pattern-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/ux-pattern-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/ux-pattern-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/ux-pattern-library/contents/{+path}","compare_url":"https://api.github.com/repos/edx/ux-pattern-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/ux-pattern-library/merges","archive_url":"https://api.github.com/repos/edx/ux-pattern-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/ux-pattern-library/downloads","issues_url":"https://api.github.com/repos/edx/ux-pattern-library/issues{/number}","pulls_url":"https://api.github.com/repos/edx/ux-pattern-library/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/ux-pattern-library/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/ux-pattern-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/ux-pattern-library/labels{/name}","releases_url":"https://api.github.com/repos/edx/ux-pattern-library/releases{/id}","deployments_url":"https://api.github.com/repos/edx/ux-pattern-library/deployments","created_at":"2015-01-22T07:19:42Z","updated_at":"2016-03-09T16:32:45Z","pushed_at":"2016-03-09T22:52:57Z","git_url":"git://github.com/edx/ux-pattern-library.git","ssh_url":"git@github.com:edx/ux-pattern-library.git","clone_url":"https://github.com/edx/ux-pattern-library.git","svn_url":"https://github.com/edx/ux-pattern-library","homepage":"http://ux.edx.org","size":8061,"stargazers_count":230,"watchers_count":230,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":30,"mirror_url":null,"open_issues_count":8,"forks":30,"open_issues":8,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304"},"html":{"href":"https://github.com/edx/ux-pattern-library/pull/304"},"issue":{"href":"https://api.github.com/repos/edx/ux-pattern-library/issues/304"},"comments":{"href":"https://api.github.com/repos/edx/ux-pattern-library/issues/304/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/ux-pattern-library/pulls/304/commits"},"statuses":{"href":"https://api.github.com/repos/edx/ux-pattern-library/statuses/6b0805e1b5fd2eb4f39a5f567154a2149f923167"}}}}