Skip to content

Instantly share code, notes, and snippets.

@junrillg
Forked from learncodeacademy/flightplan-html.md
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junrillg/f8ab66f2c9850381293d to your computer and use it in GitHub Desktop.
Save junrillg/f8ab66f2c9850381293d to your computer and use it in GitHub Desktop.

###Prerequesites

Install flightplan globally

npm install -g flightplan

Install flightplan in your project folder

npm install flightplan

If your project is not currently a git repository, make it one:

git init
git add -A
git commit -m "first commit"

Create your flightplan.js file (changing the host and username)

var plan = require('flightplan');

// configuration
plan.target('production', [
  {
    host: 'willsawesomesite.com',
    username: 'willster',
    port: 2222,
    agent: process.env.SSH_AUTH_SOCK
  },
]);

// run commands on localhost
plan.local(function(local) {
  // uncomment these if you need to run a build on your machine first
  // local.log('Run build');
  // local.exec('gulp build');

  local.log('Copy files to remote hosts');
  var filesToCopy = local.exec('git ls-files', {silent: true});
  // rsync files to all the destination's hosts
  local.transfer(filesToCopy, '~/www/');
});

###Hate typing in your password all the time? See how to setup passwordless SSH:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment