puli / issues

The Puli issue tracker.
90 stars 5 forks source link

Download Puli if not available #165

Open webmozart opened 8 years ago

webmozart commented 8 years ago

The most recent puli.phar should be downloaded by the Composer plugin if none is available on the system. We can present a dialog in Composer plugin if we detect this is the case.

Rough sketch of the scenarios:

Question accepted:

...
The "puli"/"puli.phar" tool could not be found on your system. Do you want to download it 
now to the current directory? (Y/n) y
Downloading puli.phar...
...

Question denied:

...
The "puli"/"puli.phar" tool could not be found on your system. Do you want to download it 
now to the current directory? (Y/n) n
Do you want to download "puli.phar" to a different path? (y/N) n
...

Question denied, custom install path:

...
The "puli"/"puli.phar" tool could not be found on your system. Do you want to download it 
now to the current directory? (Y/n) n
Do you want to download "puli.phar" to a different path? (y/N) y
Choose your install path: [puli.phar] vendor/bin/puli.phar
Downloading puli.phar...
...
sagikazarmark commented 8 years ago

:+1:

tgalopin commented 8 years ago

I would store somewhere the fact that we already asked the question to not ask it at every update.

dbu commented 8 years ago

what on no, no? would the plugin silently not do anything, or would it abort the composer installation?

webmozart commented 8 years ago

@dbu It would not install Puli and continue like now. Right now, if you don't have Puli installed, you get a warning when the Composer plugin is run, but Composer continues as usual.

sagikazarmark commented 8 years ago

What about exit code? Is it possible at all to return with an exit code from a plugin? I think even if composer continues running, showing an error is not enough. I would expect a CI build failing in this case.

webmozart commented 8 years ago

I don't think Composer should fail completely if Puli cannot be downloaded. Puli could be optional and in that case I don't want to break the build. If Puli is required, the build will fail anyway. What do you think?

sagikazarmark commented 8 years ago

Not quite sure.

Also @dbu's point still concerns me. I expect this feature to allow fully unattended installation of composer packages with puli support.

dbu commented 8 years ago

i guess this means reporting a good exception message when things are not there as expected. i can see that the presence of the puli dependency alone leading to installation failures could be annoying as well. though maybe: have a composer.json config option to skip the error, but fail by default (and mention the config option in the failure)?

Nyholm commented 8 years ago

I think that is the way to go.

If you don't have the proper PHP-extensions then puli will fail. Same thing should be applied if Puli is not available.

gossi commented 8 years ago

I just had this case, where a missing puli cli failed my tests on travis, see #176 (which they shouldn't). Here are my thoughts on this:

  1. Ask if puli should be downloaded (if composer is in interactive mode) - but just once not every time (you want to run composer up and come back when it is finished, instead saying no over and over again) -> Go with "no" in non interactive mode. Maybe ask, if it should be installed globally?
  2. If a package A depends on package B which requires puli, package A behaves as it requires puli. In that case (mine above) puli is irrelevant and tests must not fail
  3. If puli is run but no puli installed, don't run the puli installer and place a warning instead.

Well, that's pretty much from my point-of-view as I don't rely on puli for test (for now). If you rely on tests, they maybe should fail?

sagikazarmark commented 8 years ago

puli is irrelevant and tests must not fail

What does this mean?

Tests should not fail, SO puli should be installed

OR

Tests should not fail IF puli is not installed

gossi commented 8 years ago

In my case:

Tests should not fail IF puli is not installed