Create a gist now

Instantly share code, notes, and snippets.

@Jaace /gulpfile.js Secret
Last active Nov 21, 2016

What would you like to do?
Simple Gulp workflow for updating Code Reference from source code
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