grunt-dynamic-deployments
updated for target variables
Getting Started
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-dynamic-deployments --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "dynamic_deployments" task
Setup
see https://github.com/getdave/grunt-deployments include external setup.json file for db settings in Gruntfile.js
{ "dev": { "username": "DB_USERNAME", "password": "DB_PASSWORD", "database": "DB_NAME", "url": "http://*********/", "user_server": "USERNAME ON SERVER", "host_server": "SERVERNAME", }}
Usage
dynamic_deployments: options: local: "title": "Local" "database": '<%= settings.local.database %>' "user": '<%= settings.local.username %>' "pass": '<%= settings.local.password %>' "host": 'localhost' "url": '<%= settings.local.url %>' remote: "title": "Remote" "database": '<%= settings.' + grunt + '.database %>' "user": '<%= settings.' + grunt + '.username %>' "pass": '<%= settings.' + grunt + '.password %>' "host": 'localhost' "url": '<%= settings.' + grunt + '.url %>' "ssh_host": '<%= settings.' + grunt + '.user_server %>@<%= settings.' + grunt + '.host_server %>' ``` ### Linux amendInside tasks/deployments.js you may need to update the following.
var tpls = {
backup_path: "<%= backups_dir %>/<%= env %>/<%= date %>/<%= time %>",
search_replace: "sed -i '' 's#<%= search %>#<%= replace %>#g' <%= path %>", //FROM
search_replace: "sed -i 's^<%= search %>^<%= replace %>^g' <%= path %>", //TO
mysqldump: "mysqldump -h <%= host %> -u<%= user %> -p<%= pass %> <%= database %>",
mysql: "mysql -h <%= host %> -u <%= user %> -p<%= pass %> <%= database %>",
ssh: "ssh <%= host %>",
};