Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-f or --file doesnt work #1479

Closed
staabm opened this issue Dec 27, 2017 · 8 comments
Closed

-f or --file doesnt work #1479

staabm opened this issue Dec 27, 2017 · 8 comments

Comments

@staabm
Copy link
Contributor

staabm commented Dec 27, 2017

Q A
Issue Type Bug
Deployer Version 6.0.3
Local Machine OS N/A
Remote Machine OS N/A

Description

-f and also --file dont find custom named deployer file

As I understood the option, I guess this should work:

mstaab@mst16:/tools/dev/deploytest$ ls -l
insgesamt 4
-rw-r--r-- 1 mstaab entwicklung 346 Dez 27 10:02 mydeploy.php

mstaab@mst16:/tools/dev/deploytest$ dep -f mydeploy.php
  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "mydeploy.php" is not defined.

mstaab@mst16:/tools/dev/deploytest$ dep --file mydeploy.php
  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "mydeploy.php" is not defined.

mstaab@mst16:/tools/dev/deploytest$ dep --file mydeploy
  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "mydeploy" is not defined.

I would expect that I get the "help" screen like I get when invoking only dep and I have a regular deploy.php

@antonmedv
Copy link
Member

Try add command name like dep -f mydeploy.php list

@staabm
Copy link
Contributor Author

staabm commented Dec 27, 2017

mstaab@mst16:/tools/dev/deploytest$ dep -f mydeploy.php list
  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "mydeploy.php" is not defined.

@antonmedv
Copy link
Member

Works for me.

@staabm
Copy link
Contributor Author

staabm commented Dec 27, 2017

mydeploy.php

<?php

namespace Deployer;

require 'recipe/common.php';

task('my:task', function () {
    $process = new \Symfony\Component\Process\Process("sleep 1");
    throw new \Symfony\Component\Process\Exception\ProcessTimedOutException($process, \Symfony\Component\Process\Exception\ProcessTimedOutException::TYPE_GENERAL);
});
task('my:task2', function () {
    $process = new \Symfony\Component\Process\Process("sleep 10");
    throw new \Symfony\Component\Process\Exception\ProcessTimedOutException($process, \Symfony\Component\Process\Exception\ProcessTimedOutException::TYPE_GENERAL);
});
fail('my:task', 'my:failed');
fail('my:task2', 'my:failed');

task('my:failed', function() {
    echo ('(boom) '. gethostname() .': failed');
})->setPrivate();

@antonmedv
Copy link
Member

antonmedv commented Dec 27, 2017

Found problem. Try to use =.
See https://github.com/deployphp/deployer/blob/master/bin/dep#L23

dep -f=mydeploy.php task

@staabm
Copy link
Contributor Author

staabm commented Dec 27, 2017

ohh my, you are right. as other arguments work without this = this should not be like that.

thx for the hint. I guess this problem exists also in other places
https://github.com/deployphp/deployer/search?utf8=%E2%9C%93&q=getopt&type=

@lorisleiva
Copy link
Contributor

lorisleiva commented Apr 11, 2018

I have the same problem except that no options at all are being recognised by getopt() in https://github.com/deployphp/deployer/blob/master/bin/dep#L23.

I have added die(var_dump($options)); after this line and it always dumps an empty array.

Tried: -f acme.php, -f=acme.php, --file acme.php, --file=acme.php, --file="acme.php".

Is there a chance, the function getopt() requires a php extension that I do not have?

EDIT: I've just read that, using getopt():

The parsing of options will end at the first non-option found, anything that follows is discarded.

So I made sure that the --file option is the very first one passed to the command and it worked. :)

@antonmedv
Copy link
Member

Took so long! But fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants