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

Fix bug in case using real path in windows #19

Closed minkbear closed 10 years ago

minkbear commented 10 years ago

If pass parameter in windows like this: --folder="C:\tests" --destination="C:\tests"

It shows error

The application has thrown an exception!

Zend\ServiceManager\Exception\RuntimeException The specified directory does not have deployment.xml.

But it is existing deployment.xml at that path. After that I took a look on the code and met: PathInvokable.getAbsolute send the result is wrong for example

running cmd at c:\wamp\www\ZendServerSDK\tests
parameter --folder="C:\wamp\www\ZendServerSDK" 

result from PathInvokable.getAbsolute is

C:\\wamp\\www\\ZendServerSDK\\tests/C:\\wamp\\www\\ZendServerSDK\\tests

I just finished fix it but unable to pull request only my 1 commit. Please take a look at minkbear/ZendServerSDK@d27b5ac13fdfd7404f3ef0ab41d73e6774af40f1

slaff commented 10 years ago

Minkbear, can you please get the latest source code of the tool and check if this fix forks for you?

minkbear commented 10 years ago

@slaff I clone you git for my testing. The result of my testing is the same. Error show:

======================================================================
   The application has thrown an exception!
======================================================================
 Zend\ServiceManager\Exception\RuntimeException
 The specified directory does not have deployment.xml.

Because of strpos($path, '/')!==0 return true. strpos($path, '/') return FALSE then FALSE !== 0 is true

strpos Returns FALSE if the needle was not found.

ref: strpos

slaff commented 10 years ago

That should fix the issue. @minkbear can you try again on your system?

minkbear commented 10 years ago

@slaff It's work now. no error anymore. Thanks

But in ZPK looks strange.

my scriptsdir is zp_script. and my properties is: scriptsdir.includes = scripts/post_activate.php

Expected in ZPK should be zp_script\post_activate.php

But it's below like #5 zp_script\scripts\post_activate.php

slaff commented 10 years ago

Thank for testing it mate! I will close this issue now. Can you please open another issue for the zpk problem? On 15 Nov 2013 13:21, "minkbear" notifications@github.com wrote:

@slaff https://github.com/slaff It's work now. no error anymore. Thanks

But in ZPK looks strange.

my scriptsdir is zp_script. and my properties is: scriptsdir.includes = scripts/post_activate.php

Expected in ZPK should be zp_script\post_activate.php

But it's below like #5https://github.com/zend-patterns/ZendServerSDK/issues/5 zp_script\scripts\post_activate.php

— Reply to this email directly or view it on GitHubhttps://github.com/zend-patterns/ZendServerSDK/issues/19#issuecomment-28565292 .

mkherlakian commented 10 years ago

@minkbear it's a behavior we probably should document and guard against a bit better - but if your scriptsdir in deployment.xml is zp_script, then in deployment.properties the entry should look like: Scriptsdir.includes=zp_script/post_activate.php

Such that the prefix is the same. Could you test and let me know please?

minkbear commented 10 years ago

@slaff Thank you too. created as #20 @mkherlakian Please take a look at #20