Skip to content

Missing symfony/process dependancy #24

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

Closed
kasparsd opened this issue Jun 5, 2018 · 7 comments
Closed

Missing symfony/process dependancy #24

kasparsd opened this issue Jun 5, 2018 · 7 comments

Comments

@kasparsd
Copy link
Contributor

kasparsd commented Jun 5, 2018

Introduced in #23.

use Symfony\Component\Process\Process;

However, symfony/process is missing from composer.json:

"require": {
"php": "^5.6 || >=7.0 <7.3",
"symfony/console": "^3.2 || ^4.0"
},

@kasparsd kasparsd changed the title Add as a dependancy Missing symfony/process dependancy Jun 5, 2018
@BrainMaestro
Copy link
Owner

Yeah you're right. It wasn't picked up during development because symfony/console uses symfony/process as a dev dependency. I wonder if it's worth it to include a dependency for such a minor case. We can probably just use shell_exec

@joaorobertopb
Copy link
Contributor

joaorobertopb commented Jun 5, 2018

Hi guys!

My suggestion:

if (! function_exists('git_version')) {
    /**
     * Get latest git tag version.
     *
     * @return string
     */
    function git_version()
    {
        $gitCommand = 'git describe --tags $(git rev-list --tags --max-count=1)';
        if (class_exists('Symfony\Component\Process\Process')) {
            $process = (new Symfony\Component\Process\Process($gitCommand))->run();
            return trim($process->getOutput());
        }
        return trim(exec($gitCommand)); // Or shell_exec
    }
}

In this way we do not need to add 'symfony/process' as a dependency of the project, and we can use it without worry as long as it is a dependency of 'symfony/console'

@BrainMaestro
Copy link
Owner

That's better, but now that I think about it, I'd prefer not to use git to determine this because the version should work on computers without git installed.

@joaorobertopb
Copy link
Contributor

@BrainMaestro OK no problems!

This function is not essential for the operation of the package, it can be removed if you prefer. 😄

@BrainMaestro
Copy link
Owner

It was a good idea because I always forget to update the string, but oh well. Do you want to make a PR?

@joaorobertopb
Copy link
Contributor

I can send a PR at night (my time zone is UTC -3, now it's 9:20 am here).

@kasparsd
Copy link
Contributor Author

kasparsd commented Jun 5, 2018

@BrainMaestro Here is a version with symfony/process removed #26.

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

No branches or pull requests

3 participants