Created
February 3, 2014 15:10
-
-
Save joelrbrandt/8785551 to your computer and use it in GitHub Desktop.
Launch new generator-core from old generator-core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
function startDumping(theGenerator) { | |
setInterval(function () { | |
console.log("[UPDATED-LAUNCHER] requesting doc info"); | |
theGenerator.getDocumentInfo().done( | |
function (info) { | |
console.log("[UPDATED-LAUNCHER] got doc info: %s", JSON.stringify(info, null, " ")); | |
}, function (err) { | |
console.log("[UPDATED-LAUNCHER] err getting doc info: %s", err); | |
}); | |
}, 5000); | |
} | |
exports.init = function (oldGenerator, config) { | |
// Note: Update the require path for updatedGeneratorCore appropriately | |
var resolve = require("path").resolve, | |
updatedGeneratorCore = require(resolve(__dirname, "./node_modules/generator-core/lib/generator.js")), | |
updatedGenerator = updatedGeneratorCore.createGenerator(); | |
console.log("[UPDATED-LAUNCHER] starting updated generator-core"); | |
updatedGenerator.start({ | |
password: "password", | |
port: 49494, | |
hostname: "127.0.0.1" | |
}).done( | |
function () { | |
// you're connected! | |
// use the new updatedGenerator object to do your bidding | |
console.log("[UPDATED-LAUNCHER] connected, starting dumping loop"); | |
startDumping(updatedGenerator); | |
}, | |
function (err) { | |
// something's broken! | |
// yell at Joel more! | |
console.error("[UPDATED-LAUNCHER] broken:", err); | |
} | |
); | |
}; | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "updated-launcher", | |
"version": "0.0.1", | |
"description": "", | |
"main": "main.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"dependencies": { | |
"generator-core": "git+https://github.com/adobe-photoshop/generator-core.git#c8416dea1c7eb305a5461138ea58c93fb457e3fb" | |
}, | |
"author": "", | |
"license": "MIT" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment