welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 167 forks source link

Exclude with exceptions #551

Closed debonx closed 4 years ago

debonx commented 4 years ago

Can I exclude all folders in a path with exceptions? If yes how? I tried the following without success:

exclude:
    - "wp-content/plugins/*"
    - "!wp-content/plugins/coblocks/*.php"
    - "!wp-content/plugins/coblocks/dist/*"

I need to exclude all plugins except those I'm maintaining for a specific environment.

alessandro-fazzi commented 4 years ago

Hello @huraji ; rsync's exclude patterns are a complicated matter. I think it should be possible since you can do almost all that is possible to do with rsync (so even reset/bypass wordmove's exclusion list, default include/exclude expressions it uses, rely on an external include/exclude file and so on).

If you could create a stand-alone rsync command that fit your needs, but "ported" to Wordmove it would break, then I'll try to understand why; but find the correct rsync configuration for you is a too hard task for me.

Wordmove prints to STDOUT the rsync command it generates and uses; you can start copying it and elaborating from there. Once you're done we can discuss how to manage that command through Wordmove :)

debonx commented 4 years ago

Thanks @pioneerskies, I appreciate it. I will work it out and I'll keep you posted.

debonx commented 4 years ago

@pioneerskies I handled using rsync_options like:

- rsync_options: '--verbose --include="wp-content/plugins/coblocks"

and other patterns. Of course would be great to have and include list like the exclude one. I don't know much about ruby though, otherwise I would have been very happy to contribute.

<italian>Ciao e grazie, wordmove è in assoluto uno dei miei tool preferiti!</italian>

alessandro-fazzi commented 4 years ago

Hey @huraji ,

thank you so much for the given feedback. It's absolutely useful for the whole community.

Just let me know: in the exclude section have you tried to use the following?

- "! wp-content/plugins/coblocks"
- "wp-content/plugins/*"

also trying for some swap-lines-magic between the two?

That said, more than an include option, I'd stuck on this proposal https://github.com/welaika/wordmove/issues/432 which you've already endorsed.

<italian>Mi fa piacere che Wordmove ti piaccia e che ti sia utile :)</italian>

debonx commented 4 years ago

Oh yes! I actually forgot about that LOL. Let's do it if you can!

alessandro-fazzi commented 4 years ago

I'll keep that one open; BTW tell me if the above suggestion does somehow work. That would be helpful to know

debonx commented 4 years ago

Of course! I will it try tomorrow morning.

debonx commented 4 years ago
- "! wp-content/plugins/coblocks"
- "wp-content/plugins/*"

Tried but not working. Also tried interpolation in ruby (the best I could looking around) like:

Not working, but possibly because I have poor knowledge about.

alessandro-fazzi commented 4 years ago

@huraji removing the --include from rsync_options, this should do what you need:

exclude:
  - "+ wp-content/plugins/coblocks/"
  - "wp-content/plugins/*"

I have just tested w/ a couple of plugins.

debonx commented 4 years ago

@pioneerskies Excellent. Works like a charme. Thanks!

alessandro-fazzi commented 4 years ago

Doc added https://github.com/welaika/wordmove/wiki/Work-only-on-specific-plugins-or-themes and linked in https://github.com/welaika/wordmove/wiki/movefile.yml-configurations-explained