jedrichards/grunt-rsync

Add option to enable "pull" from remote location using rsync

lloydkevin opened this issue · 2 comments

In some cases I find it beneficial to have rsync pull changes from the live/staging environment into my local/development environment.

See example below:

rsync: {
    options: {
        args: ["--verbose"],
        exclude: [".git*","*.scss","node_modules"],
        recursive: true
    },
    dist: {
        // will work fine locally since we're only using directories
        options: {  
            src: "./",
            dest: "../dist"
        }
    },
    stage: {
        // How would I specific the src to have user@staging-host???
        options: {
            src: "../dist/",
            dest: "/var/www/site",
            host: "user@staging-host",
            syncDestIgnoreExcl: true
        }
    },
}

Hey!

I think the rsyncwrapper ssh option will help.

So a config something like the below. Let me know if it works for you ...

stage: {
    options: {
        ssh: true,
        src: "user@staging-host:/var/www/site",
        dest: "some/local/folder"
    }
}

Ha! You are correct. After inspecting the code on rsyncwrapper, it simply prepends the "host" option to the "dest" option if it exists.

Works like a charm.
Thanks.