Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var plan = require('flightplan');
var username = 'logicfo3';
plan.target('production', [
{
host: '69.195.124.76',
username: username,
privateKey: '/Users/jc/.ssh/id_rsa',
agent: process.env.SSH_AUTH_SOCK
},
]);
plan.local(function(local) {
// prompt for passphrase (so we don't have to hardcode it in the object above)
var passphrase = local.prompt('Enter your passphrase:', { hidden: true });
plan.target().runtime.hosts.forEach(function(host) {
host.passphrase = passphrase;
});
// build jekyll for production
local.exec('JEKYLL_ENV=production jekyll build', {silent: true});
local.log('Copying files to remote host');
// copy only the _site directory to ~ of server
var filesToCopy = local.find('\_site -type f', {silent: true});
local.transfer(filesToCopy, '~');
});
plan.remote(function(remote) {
// move the contents of the copied folder to public_html/
remote.exec('cp -R ~/_site/* ~/public_html', {user: username});
// remove the temporary _site folder from the server
remote.exec('rm -rf ~/_site');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment