andres-montanez / Magallanes

The PHP Deployment Tool
https://magephp.com
MIT License
691 stars 169 forks source link

Allow fs remove recursive #341

Closed thePanz closed 7 years ago

thePanz commented 7 years ago

See #340

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 75101fb79508679d53192e40c7a82da41892a513 on thePanz:340-allow-fs-remove-recursive into c6ec69b7f2043f7205efec1e5c973874e8d56abd on andres-montanez:nostromo.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e007e5d547c1937449c1e841db0d50f054ba626e on thePanz:340-allow-fs-remove-recursive into c6ec69b7f2043f7205efec1e5c973874e8d56abd on andres-montanez:nostromo.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 117c3f028f84d5d3cba7c0adb3a60a30c82ad1f6 on thePanz:340-allow-fs-remove-recursive into c6ec69b7f2043f7205efec1e5c973874e8d56abd on andres-montanez:nostromo.

andres-montanez commented 7 years ago

Hi! I deliberately didn't implement a recursive delete, it's too risky. The idea of the FS tasks is to move/copy/remove configuration files needed for a deployment.

I understand that it may be needed, for example remove a cache directory (when not using releases), so perhaps the best option here is to create a new task "remove-dir" which will test that the target is a directory.

thePanz commented 7 years ago

Why would it be dangerous? just the rsync command is even replacing files, why removing a folder is considered harmful?

mbaeuerle commented 7 years ago

I think there is a need for parameterization in general! For example: I need cp -a src/. dest/ to move whole directories. So an optional flags parameter would be nice (defaulting to the current parameters) like: - fs/copy: { from: 'from/.', to: 'to/', flags: '-a' } A deployment script should be flexible and providing the tools for it is not harmful in my opinion.

andres-montanez commented 7 years ago

+1 to adding flags!

@thePanz regarding the harmfulness of the command, think about a user that misconfigures the command and ends with something like rm -rf /, that's my main concern.

On the other hand I think @mbaeuerle nailed it with the flags, we are already using that in many other commands, and the user will have to thoughtfully add it.

I've created issue #344 so I can address this in the next release ;)