From 1dd8a156557953a7f04d76b7be695bedab56ba3d Mon Sep 17 00:00:00 2001
From: Steve Heffernan <steve@zencoder.com>
Date: Mon, 24 Feb 2014 11:32:35 -0800
Subject: [PATCH 1/2] Updated contrib patch process

---
 contrib.json | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/contrib.json b/contrib.json
index eb6172558..af89db1f9 100644
--- a/contrib.json
+++ b/contrib.json
@@ -2,6 +2,9 @@
   "project": {
     "owner": "videojs",
     "name": "video.js",
+    "urls": {
+      "git": "https://github.com/videojs/video.js.git"
+    },
     "requirements": [
       {
         "name": "git",
@@ -16,6 +19,59 @@
     ]
   },
 
+  "install": {
+    "steps": [
+      {
+        "desc": "Get all git branches",
+        "exec": "git fetch origin"
+      },
+      {
+        "desc": "Create the stable branch for patches",
+        "exec": "git checkout -b stable origin/stable"
+      },
+      {
+        "desc": "Add the upstream project as a remote so new changes can be pulled",
+        "exec": "git remote add upstream <%= project.urls.git %>"
+      },
+      {
+        "desc": "Get all upstream branches and changes",
+        "exec": "git fetch upstream"
+      },
+      {
+        "contrib": "update"
+      }
+    ]
+  },
+
+  "update": {
+    "steps": [
+      {
+        "desc": "Switch to the development branch",
+        "exec": "git checkout master"
+      },
+      {
+        "desc": "Get any changes to master in the main project",
+        "exec": "git pull upstream master"
+      },
+      {
+        "desc": "Switch to the release branch",
+        "exec": "git checkout stable"
+      },
+      {
+        "desc": "Get any changes to stable in the main project",
+        "exec": "git pull upstream stable"
+      },
+      {
+        "desc": "Install dependencies",
+        "exec": "npm install"
+      },
+      {
+        "desc": "Build the distribution",
+        "exec": "grunt"
+      }
+    ]
+  },
+
   "test": {
     "desc": "Run automated tests",
     "steps": ["grunt test"]
@@ -23,6 +79,59 @@
 
   "contributions": {
 
+    "patch": {
+      "desc": "Urgent fixes for the latest stable version",
+      "new": {
+        "desc": "Start a new patch",
+        "steps": [
+          {
+            "id": "name",
+            "desc": "Name the patch branch",
+            "prompt": {
+              "type": "text",
+              "message": "name"
+            }
+          },
+          {
+            "desc": "Check out the release branch and get any updates",
+            "exec": "git checkout stable && git pull upstream stable"
+          },
+          {
+            "desc": "Create the patch branch",
+            "exec": "git checkout -b patch/<%= name %>"
+          },
+          {
+            "desc": "Push the branch to the origin repo",
+            "exec": "git push -u origin patch/<%= name %>"
+          }
+        ]
+      },
+      "submit": {
+        "desc": "Submit a patch when it's finished",
+        "steps": [
+          {
+            "desc": "Run tests",
+            "contrib": "test"
+          }
+        ]
+      },
+      "delete": {
+        "desc": "Delete the patch branch",
+        "steps": [
+          {
+            "id": "name",
+            "guide": false,
+            "desc": "Get the current branch name",
+            "exec": "git rev-parse --abbrev-ref HEAD"
+          },
+          {
+            "desc": "Confirm you are deleting the correct branch",
+            "prompt": "Delete branch '<%= name %>'?"
+          }
+        ]
+      }
+    },
+
     "release": {
       "desc": "Create and publish a release",
       "steps": [

From d68f5a93a51b24823d7717fa8a9c72568cbc64f1 Mon Sep 17 00:00:00 2001
From: Steve Heffernan <steve@zencoder.com>
Date: Mon, 24 Feb 2014 21:10:29 -0800
Subject: [PATCH 2/2] Updated contrib.json with patch commands

---
 contrib.json | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/contrib.json b/contrib.json
index af89db1f9..df48016a8 100644
--- a/contrib.json
+++ b/contrib.json
@@ -107,16 +107,46 @@
         ]
       },
       "submit": {
-        "desc": "Submit a patch when it's finished",
+        "desc": "Submit a pull request for a patch when it's finished",
         "steps": [
           {
             "desc": "Run tests",
             "contrib": "test"
+          },
+          {
+            "desc": "Check for any unadded changes",
+            "exec": "git diff --exit-code",
+            "fail": "Add and commit all changes before submitting a pull request"
+          },
+          {
+            "desc": "Check for any uncomitted changes",
+            "exec": "git diff --cached --exit-code",
+            "fail": "Add and commit all changes before submitting a pull request"
+          },
+          {
+            "id": "branch",
+            "desc": "Which branch should be submitted? (e.g. 'patch/my-patch')",
+            "prompt": {
+              "type": "text",
+              "message": "branch"
+            }
+          },
+          {
+            "id": "user",
+            "desc": "Which github user or org are you submitting from?",
+            "prompt": {
+              "type": "text",
+              "message": "user"
+            }
+          },
+          {
+            "desc": "Open the github pull request page",
+            "open": "https://github.com/videojs/video.js/compare/videojs:stable...<%= user %>:<%= branch %>"
           }
         ]
       },
       "delete": {
-        "desc": "Delete the patch branch",
+        "desc": "Delete the current patch branch",
         "steps": [
           {
             "id": "name",
@@ -127,6 +157,14 @@
           {
             "desc": "Confirm you are deleting the correct branch",
             "prompt": "Delete branch '<%= name %>'?"
+          },
+          {
+            "desc": "Delete the local copy of the branch",
+            "exec": "git branch -D <%= name %>"
+          },
+          {
+            "desc": "Delete the remote copy of the branch",
+            "exec": "git push origin :<%= name %>"
           }
         ]
       }