Deployer: -f or --file doesnt work

Created on 27 Dec 2017  路  8Comments  路  Source: deployphp/deployer

| 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

minor bug

All 8 comments

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

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

Works for me.

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();

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

dep -f=mydeploy.php task

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=

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. :)

Took so long! But fixed!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dima-stefantsov picture dima-stefantsov  路  5Comments

lsv picture lsv  路  4Comments

exts picture exts  路  3Comments

khoanguyen96 picture khoanguyen96  路  5Comments

krve picture krve  路  4Comments