Skip to content

Instantly share code, notes, and snippets.

@niallo
Created August 19, 2013 16:49
Show Gist options
  • Save niallo/6271264 to your computer and use it in GitHub Desktop.
Save niallo/6271264 to your computer and use it in GitHub Desktop.
diff --git a/index.js b/index.js
index d750ce4..9c89fc4 100644
--- a/index.js
+++ b/index.js
@@ -1,8 +1,9 @@
var Runner = require('./lib/worker')
var create = function(emitter, opts, cb){
+ console.dir(opts)
var runner = new Runner(emitter, opts)
- worker.attach()
+ runner.attach()
cb(null)
}
diff --git a/lib/job.js b/lib/job.js
index 5ea4ff5..d07b5b4 100644
--- a/lib/job.js
+++ b/lib/job.js
@@ -203,6 +203,7 @@ Job.prototype = {
// or update
Step(
function () {
+ console.log("pty: %s", self.config.pty)
cmd.run({
io: self.io,
cwd: self.dir,
@@ -212,6 +213,7 @@ Job.prototype = {
},
function (code) {
if (code) {
+ console.log("code: %s", code)
self.io.emit('stderr', 'Failed to git reset', 'error')
return self.complete(code, null, null, done)
}
diff --git a/lib/utils.js b/lib/utils.js
index 8d635fd..5626cd6 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -106,6 +106,7 @@ function processPhases(done, buildHooks, context, results) {
})
context.env.PATH = paths.join(':')
+ console.log("# of buildhooks: %s", buildHooks.length)
phases.forEach(function (phase) {
if (context.jobData.job_type === TEST_ONLY && phase === 'deploy') {
context.io.emit('log', 'skipping deploy phase; test run')
diff --git a/lib/worker.js b/lib/worker.js
index cdb811d..8550e40 100644
--- a/lib/worker.js
+++ b/lib/worker.js
@@ -8,12 +8,12 @@ var _ = require('lodash')
module.exports = Runner
-function Runner(config) {
+function Runner(emitter, config) {
var dotStrider = path.join(process.env.HOME || '/', '.strider')
this.config = _.extend({
- pty: true,
+ pty: false,
logger: console,
- emitter: null,
+ emitter: emitter,
dataDir: process.env.STRIDER_CLONE_DEST || dotStrider
}, config)
this.log = this.config.logger.log
@@ -24,7 +24,7 @@ function Runner(config) {
Runner.prototype = {
attach: function (emitter) {
var self = this
- emitter.on('queue.new_job', function (task) {
+ this.config.emitter.on('queue.new_job', function (task) {
self.log('Got new job')
self.queue.push(task)
})
@@ -77,8 +77,9 @@ Runner.prototype = {
function() {
job.gitStep(done, this)
},
- function(err, result, results) {
- utils.processPhases(this, self.hooks, this.context, results)
+ function(err, context) {
+ console.log("context: %j", context)
+ utils.processPhases(this, self.hooks, context)
},
function (err, tasks) {
if (err) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment