Skip to content

Instantly share code, notes, and snippets.

@seanwash
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save seanwash/4ea36760e47a09e93a08 to your computer and use it in GitHub Desktop.

Select an option

Save seanwash/4ea36760e47a09e93a08 to your computer and use it in GitHub Desktop.
Wordpress Deploy via Grunt
  1. Setup local wordpress install & local wordpress database
  2. Create production database from mysql wizard (make new user password and db)
  3. Setup grunt files from the wordpress root in the console (rememeber you can drag and drop a folder onto the console and hit enter):
  • $ npm init & Fill in relevant details (you can just hit enter a few times)
  • $ npm install grunt --save-dev - install grunt into node_modules folder
  • $ npm install grunt-wordpress-deploy --save-dev - install grunt wordpress deploy into node_modules folder
  • Create gruntfile.js in root & copy and paste below gruntfile.js into yours.
  • Fill in the local and production information
    • Remember that the two path: lines need to have a trailing slash / (lines 37 & 46)
  1. grunt push_files --target=production
  2. grunt push_db --target=production
  3. Update production database wordpress url & site url
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
wordpressdeploy: {
options: {
backup_dir: "backups/",
rsync_args: [
'--verbose',
'--progress',
'-rlpt',
'--compress',
'--omit-dir-times',
'--delete'
],
exclusions: [
'Gruntfile.js',
'.git/',
'tmp/*',
'backups/',
'wp-config.php',
'composer.json',
'composer.lock',
'README.md',
'.gitignore',
'package.json',
'node_modules'
]
},
local: {
"title": "local",
"database": "yourdatabase",
"user": "root",
"pass": "yourpassword",
"host": "localhost",
"url": "http://localhost/yourwordpress/",
"path": "~/sites/yourwordpress/"
},
production: {
"title": "production",
"database": "yourdatabase",
"user": "root",
"pass": "yourpassword",
"host": "localhost",
"url": "http://yoursite.com/yourwordpress",
"path": "/var/www/yoursite.com/public_html/yourwordpress/",
"ssh_host": "[email protected]"
}
},
});
// Load tasks
grunt.loadNpmTasks('grunt-wordpress-deploy');
// Register tasks
grunt.registerTask('default', [
'wordpressdeploy'
]);
};
@ShaRay
Copy link

ShaRay commented Feb 21, 2015

go to terminal and get pdw for path

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