0.1.1 • Published 10 years ago

grunt-dynamic-deployments v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
10 years ago

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.loadNpmTasks('grunt-dynamic-deployments');

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.option('target') + '.database %>',
        "user": '<%= settings.' + grunt.option('target') + '.username %>',
        "pass": '<%= settings.' + grunt.option('target') + '.password %>',
        "host": 'localhost',
        "url": '<%= settings.' + grunt.option('target') + '.url %>',
        "ssh_host": '<%= settings.' + grunt.option('target') + '.user_server %>@<%= settings.' + grunt.option('target') + '.host_server %>'
    }
}```

### Linux amend
Inside 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 %>",

};