jedrichards/rsyncwrapper

Globbing patterns dosen't work in 'excludes' option

skotchio opened this issue · 6 comments

I have rsync-grunt module with the following task:

rsync: {
  'prepare-release': {
    src: '../',
    dest: 'rev',
    exclude: ['node_modules/*', '!node_modules/mymodule'],
    recursive: true,
    syncDest: true
  }
}

I need don't include all subfolders from node_modules except 'mymodule'. But it seems doesn't work. Is it bug?

grunt-rsync and rsyncwrapper don't use any Grunt or Node globbing patterns. You should use rsync exclude patterns instead, check the rsync manpages for more info: http://linux.die.net/man/1/rsync. Remember you can pass any rsync options through with the args config value.

@jedrichards can you put me how should I exclude all subfolders from node_modules except node_modules/mymodule ?

I think you should use the --include and --exclude flags together. Does this help?

http://stackoverflow.com/questions/8270519/rsync-exclude-a-directory-but-include-a-subdirectory

rsynwrapper doesn't have an include config option at the moment so you'd have to do something like:

rsync: {
  'prepare-release': {
    src: '../',
    dest: 'rev',
    exclude: ['node_modules/*', '!node_modules/mymodule'],
    recursive: true,
    syncDest: true,
    args: ["--include some/path/"]
  }
}

Unfortunately this dosen't work too. I've tried the following and node_modules/mymodule don't included in rev directory:

rsync: {
   'prepare-release': {
   src: '../',
   dest: 'rev',
   exclude: ['node_modules/*'],
   recursive: true,
   syncDest: true,
   args: ["--include=node_modules/mymodule/"]
 }

}

You should play around with rsync settings on the command line until you figure out what works for your purposes then it should be easy enough to pass them through from grunt-rsync ... sorry, I couldn't say off the top my head what the correct settings should be for this case.