5 var gift = require("gift"),
7 argv = require("optimist")
9 "Update vtt.sys.mjs with the latest from a vtt.js directory.\nUsage:" +
15 describe: "Path to WebVTT directory.",
19 describe: "Revision to update to.",
24 describe: "Path to file to write to.",
25 default: "./vtt.sys.mjs",
28 var repo = gift(argv.d);
29 repo.status(function (err, status) {
31 console.log("The repository's working directory is not clean. Aborting.");
34 repo.checkout(argv.r, function () {
35 repo.commits(argv.r, 1, function (err, commits) {
36 var vttjs = fs.readFileSync(argv.d + "/lib/vtt.js", "utf8");
38 // Remove settings for VIM and Emacs.
39 vttjs = vttjs.replace(/\/\* -\*-.*-\*- \*\/\n/, "");
40 vttjs = vttjs.replace(/\/\* vim:.* \*\/\n/, "");
42 // Concatenate header and vttjs code.
44 "/* This Source Code Form is subject to the terms of the Mozilla Public\n" +
45 " * License, v. 2.0. If a copy of the MPL was not distributed with this\n" +
46 " * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\n" +
47 "export var WebVTT;" +
49 " * Code below is vtt.js the JS WebVTT implementation.\n" +
50 " * Current source code can be found at http://github.com/mozilla/vtt.js\n" +
52 " * Code taken from commit " +
58 fs.writeFileSync(argv.w, vttjs);