Giter Club home page Giter Club logo

Comments (4)

jedrichards avatar jedrichards commented on September 17, 2024

With rsync everything is included by default. You choose what to exclude from that, while overriding specific excludes with some includes. Afaiu this is the pattern that's enabled by having includes come before excludes when we build the rsync command.

There's been some discussion about this before #16

Not sure why you're setting the src directory to . when you only want to copy the contents of webroot? Could some variation on options like this do what you're after?

options: {
    recursive: true,
    src: "webroot/",
    exclude: ["scss"],
    dryRun: true,
    dest: "/path/to/files",
    host: "[email protected]",
}

I might be misunderstanding though! Let me know how you get on, will be happy to merge your PR if it genuinely scratches an itch.

from rsyncwrapper.

HaroldPutman avatar HaroldPutman commented on September 17, 2024

So my real problem is that I have:

base 
 |-- bower_components
 |-- config
 |-- node_modules
 |-- tmp
 |-- vendor
 +-- webroot
      |-- scss
      +-- img

I want to copy config, webroot, and vendor folders but nothing else.

I could write this as

rsync base dest --exclude=tmp/ --exclude=node_modules/ --exclude=bower_components/  --exclude=webroot/scss/

But then I have to always maintain a list of what I don't want. If I add a secrets folder and forget about this it will be transferred by deafult.

I can do this as three separate rsync operations:

rsync base/config dest/config
rsync base/vendor dest/config
rsync base/webroot dest/webroot --exclude=scss/

which may be a fine solution in my case but doesn't scale.

I don't really understand all the intricacies of rsync patterns, but it seems like include is only useful if you also have exclude=*. And once you include something there is no way exclude it. So if I --include=webroot --exclude=*, I cannot get rid of webroot/scss. Which is how I got to the need to say --exclude=webroot/scss --include=webroot --exclude=*.

I understand the desire to keep the wrapper simple (and have the options map directly to real rsync options), but IMO this is a real itch if you want to do non-trivial rsync operations.

from rsyncwrapper.

HaroldPutman avatar HaroldPutman commented on September 17, 2024

This would address #13 also.

from rsyncwrapper.

jedrichards avatar jedrichards commented on September 17, 2024

Aha, ok. I think I see what you're saying now. You want to be able to define a whitelist of things to include, while excluding everything else, with the added complication of excluding some sub paths.

Have you looked into the --filter arg? I'm not sure, but it might provide a more idiomatic way of handling the above.

That said, your PR looks good (thanks for the docs and tests!), so I'll merge it right away. Cheers!

from rsyncwrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.