-
-
Save Jaace/da9f0b9cc222477cd0c76e4b864ccf31 to your computer and use it in GitHub Desktop.
Simple Gulp workflow for updating Code Reference from source code
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
var | |
gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
ssh2 = require('ssh2'), | |
source_path = '/srv/www/jason/htdocs/wp-content/plugins/source-code', | |
code_ref_path = '/srv/www/code-reference/htdocs'; | |
gulp.task('default', function() { | |
var ssh = new ssh2(); | |
ssh.on('ready', function () { | |
gutil.log('Starting the WP Parser workflow from the Code Reference.'); | |
var commands = 'cd ' + source_path + ';' + | |
'wp parser export ' + code_ref_path + ' latest-export;' + | |
'wp parser import latest-export --user=admin;' | |
ssh.exec(commands, function(err, stream) { | |
if (err) throw err; | |
stream.on('close', function(code, signal) { | |
console.log('Stream :: close :: code: ' + code + ', signal: ' + signal); | |
ssh.end(); | |
}).on('data', function(data) { | |
console.log('STDOUT: ' + data); | |
}).stderr.on('data', function(data) { | |
console.log('STDERR: ' + data); | |
}); | |
}); | |
}); | |
ssh.connect({ | |
host: '127.0.0.1', | |
port: 2222, | |
username: 'vagrant', | |
password: 'vagrant', | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment