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

regression in createPackage method #68

Closed fdewinne closed 9 years ago

fdewinne commented 9 years ago

After updating my zs-client to the last version, the package is no more created with the same structure.

Here is my deployment.xml:

<package xmlns="http://www.zend.com/server/deployment-descriptor/1.0" version="1.0">
    <type>application</type>
    <appdir/>
    <docroot>public</docroot>
    <scriptsdir>scripts</scriptsdir>
</package>

and my deployment.properties:

appdir.includes = config,\
        data,\
        module,\
        public,\
        vendor,\
        build.properties,\
        build.xml,\
        composer.json,\
        composer.lock,\
        init_autoloader.php,\
        README.md
scriptsdir.includes = scripts/deph.php,\
        scripts/ZendDevOps,\
        scripts/pre_activate.php,\
        scripts/post_activate.php

With the last version, the folder scripts/ZendDevOps is moved to scripts/scripts/ZendDevOps but the file scripts/deph.php don't move. Previously, the folder scripts/ZendDevOps kept the same path too

slaff commented 9 years ago

After issue: #60 we changed the handling of the properties file to match the one in Zend Studio. Most probably you should adjust.

The details are below:

"We have the following results from testing with the latest version of Zend Studio.

In the deployment.properties file the scriptsdir.includes propery is used to specify which folders or files will be included in the ZPK as scripts. The value of this property is comma separated list of paths. The paths can be files or directories.

PHP files that are matching the following pattern pre[stage|activate|deactivate|unstage|rollback].php or post[stage|activate|deactivate|unstage|rollback].php and in the root of the scripts directory will be executed from Zend Server.

Let's say we have scripts as a scriptsdir value defined in the deployment.xml and a project with the following structure:

configs/     
modules/
     Application/
          ...
          scripts/
               pre_stage.php
               post_stage.php
public/
     css/
         layout.css
     index.php
utils/
    deployment-scripts/
          pre_stage.php
          post_stage.php
deployment.xml
deployment.properties

Adding files to the list

The following definition in the deployment.properties scriptsdir.includes = utils/deployment-scripts/pre_stage.php will result in the following directories and files

scripts/
           pre_stage.php

Notice that if you specify a file then the directory structure is gone. Pre_stage.php will be executed in Zend Server.

The following definition in the deployment.properties scriptsdir.includes =utils/deployment-scripts/pre_stage.php, utils/deployment-scripts/post_stage.php will result in the following directories and files

scripts/
           pre_stage.php
           post_stage.php

Pre_stage.php and post_stage will be executed in Zend Server.

Adding directories to the list

The following definition in the deployment.properties scriptsdir.includes = utils/ will result in the following directories and files

scripts/
       pre_stage.php
       post_stage.php

As with the files the directory structure will be removed and only the files will be added. Pre_stage.php and post_stage will be executed in Zend Server.

_Warning_: this is valid if only one directory is specified. Adding a second directory or file will result in different directory structure in the ZPK.

The following definition in the deployment.properties scriptsdir.includes = utils/, utils/deployment-scripts/ will result in the following directories and files

scripts/
       utils/
              deployment-scripts/
                     pre_stage.php
                     post_stage.php           
       deployment-scripts/
              pre_stage.php
              post_stage.php           

_Warning_: None of the pre_stage or post_stage PHP files will be executed in Zend Server! The reason for this is that they are not in the root of the scripts directory.

Mixing files and directories is possible. The following definition in the deployment.properties scriptsdir.includes = utils/,utils/deployment-scripts/pre_stage.php will result in the following directories and files

scripts/
       utils/
              deployment-scripts/
                     pre_stage.php
                     post_stage.php           
      pre_stage.php

Only the pre_stage.php in the root scripts directory will be executed in Zend Server! " And we have added the following test cases: https://github.com/zend-patterns/ZendServerSDK/blob/master/module/Client/tests/ClientTest/Service/ZpkInvokableScriptdirTest.php to ensure that there are no unnoticed regressions.