zend-patterns / ZendServerSDK

Pure ZF2 CLI for zpk creation and webapi client.
BSD 3-Clause "New" or "Revised" License
22 stars 17 forks source link

Appdir.excludes is being ignored #69

Closed ericovasconcelos closed 9 years ago

ericovasconcelos commented 9 years ago

Hi,

I've tried to use the appdir.excludes from deployment.properties to exclude .svn files in my project. I realized that files in the directories were not being excluded.

From my perspective, I believe that the code at ZpkInvokable.php:451 that validates the exclude is working:

the code:
if (in_array($localPath, $excludes)) { return; }

Returns returns false for the following example: $localPath = "module/Application/view/application/usuariomodule/Application/view/application/usuario"; $excludes[0] = "svn"; $excludes[1] = "**/.svn";

This means that it will neve enter the return line.

I've managed to solve it by adding the following loop:

foreach($excludes as $excludeItem) { if (strpos($localPath, $excludeItem)) { return; } }

If you authorize I could send pull request for it.

slaff commented 9 years ago

Hi @ericovasconcelos you can fork the repo, add your changed to the forked repo and create a pull request. Make sure to add tests for the thing(s) that you are fixing and use psr-2 coding standards.

slaff commented 9 years ago

If we have an entry that has the following syntax "**/" then the code should look for items that end with and ignore them. I will try to add this change in the coming days.

marcelotmelo commented 9 years ago

Hello, I know it is a closed issue but I don't think that what was implemented is correct at all. At the Syntax section of the docs (https://github.com/zendtech/zendserver-sdk-java/wiki/Deployment-Properties-File#syntax) it states that: "As a result, the whole file with its content (if it is a directory) is considered.

file name with **/ prefix, e.g.:

**/.svn

As a result, all files with specified name will be considered. It should be used only for exclusion." This means files that have that prefix would be ignored. What was implemented is that files that have the suffix matching the pattern will be ignored (lines 466 to 470 of the ZpkInvokable class).

marcelotmelo commented 9 years ago

I've written a fix, but have not yet properly tested it. I'll fork the repo and make a pull request as soon as possible.

slaff commented 9 years ago

@marcelotmelo Check the latest version.

marcelotmelo commented 9 years ago

@slaff I have just checked and tested. Still does not work as intended - any files that are underneath a .svn directory are still being included. Create a .svn directory inside the directory that is included in scriptsdir.include. Inside this .svn directory create a couple of files and run the packZpk. The files that are inside the .svn directory still are included.

slaff commented 9 years ago

@marcelotmelo Please, provide sample directory structure, deployment.xml and deployment.properties so that we can test.

marcelotmelo commented 9 years ago

I made a pull request. The project.zip inside the test/samples contains a comprehensive directory structure and deployment files.