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

Make sure that composer file exists before running #42

Merged
merged 3 commits into from
Jul 16, 2018

Conversation

Isinlor
Copy link
Contributor

@Isinlor Isinlor commented Jul 10, 2018

The source of issue in #39 appears to be custom RequireCommand in Symfony Flex.

More specifically:

$this->getComposer();

Making sure that composer file exists fixes the issue.

Should I add tests and document it or do you see some better solution?

I have tried disabling plugins in command that BinCommand is running, but I think plugins are already loaded at that time, so it has no effect.

@theofidry
Copy link
Collaborator

Thanks for looking into it! If that's enough to make it work I'm happy with it, but it looks like the tests are failing.

I would also add one test with Flex in the CI, for example creating a skeleton symfony app which will have flex, add bamarni/composer-bin-plugin and then require a package with it

@Isinlor
Copy link
Contributor Author

Isinlor commented Jul 10, 2018

Seems like I'm breaking assertions:

        // make sure the proxy command didn't instantiate Composer
        $this->assert->assertNull($this->getComposer(false));
        $this->assert->assertNull($this->getApplication()->getComposer(false));

What is exact meaning of these assertions? Can I remove them?

@theofidry
Copy link
Collaborator

theofidry commented Jul 10, 2018

Edit: I think they can be removed yes

@Isinlor
Copy link
Contributor Author

Isinlor commented Jul 11, 2018

I fixed the tests.

I would also add one test with Flex in the CI, for example creating a skeleton symfony app which will have flex, add bamarni/composer-bin-plugin and then require a package with it

It sounds like a good idea, but I don't really know how to do it. It would require installing composer-bin-plugin from my own branch, wouldn't it?

I added an assertion that makes sure that composer.json does exists.

@theofidry
Copy link
Collaborator

theofidry commented Jul 11, 2018

Many thanks for the work :)

It sounds like a good idea, but I don't really know how to do it. It would require installing composer-bin-plugin from my own branch, wouldn't it?

It would be something along the lines of:

composer create-project symfony/skeleton symfony-app
cd symfony-app
composer require --dev bamarni/composer-bin-plugin:dev-master
composer bin var-dump require symfony/var-dump

done directly in .travis.yml

@Isinlor
Copy link
Contributor Author

Isinlor commented Jul 13, 2018

I'm worried that this will be failing until we merge this pull request, because it will be requiring dev-master:

composer require --dev bamarni/composer-bin-plugin:dev-master
composer bin var-dump require symfony/var-dump

In other words now and in the future to test whether a fix related to Symfony Flex works you will need to merge it first. This also apply to finding regressions. For some unrelated, but breaking changes you will see CI failing only after a merge.

I can add it, just want to make sure that we both see the issue ;) .

@theofidry
Copy link
Collaborator

Indeed. I'm however not a big fan of having tests where you need to merge them to check if they works. Maybe we can find a way around it, what about something like:

composer require --dev bamarni/composer-bin-plugin:$TRAVIS_COMMIT

?

@Isinlor
Copy link
Contributor Author

Isinlor commented Jul 13, 2018

Yes, that should work - later today I will try to add it.

Do you think this should be also changed?
https://github.com/bamarni/composer-bin-plugin/blob/master/.travis.yml#L25

@theofidry
Copy link
Collaborator

yes please

@Isinlor
Copy link
Contributor Author

Isinlor commented Jul 15, 2018

It still won't work :/ . Packagist doesn't know about pull-request until it gets merged. The only solution I see is to depend on direct link to a repository from where the pull request originated. That requires manual composer.json modification and playing with git to pick the repository origin and the branch name because locking composer dependency on only commit hash does not work.

I guess it may be good "to do" for later.

@theofidry theofidry merged commit 8a386cf into bamarni:master Jul 16, 2018
@theofidry
Copy link
Collaborator

Let's try it then :) Thank you very much for looking into this

@theofidry
Copy link
Collaborator

Looks like the tests passed :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants