[WIP] Add a self-update command to update local phpmnd.phar from Github releases#44
[WIP] Add a self-update command to update local phpmnd.phar from Github releases#44padraic wants to merge 14 commits intopovils:masterfrom
self-update command to update local phpmnd.phar from Github releases#44Conversation
Add comments to explain consts Exclude codesniffer from PHARs Stash
| ->addOption( | ||
| 'stable', | ||
| 's', | ||
| InputOption::VALUE_NONE, |
There was a problem hiding this comment.
This can probably be deleted. If support is needed for non-stable releases (alphas, betas, RCs) alternative stability flags can be passed into phar-updater.
|
I need to take a better look on this :) |
| const PACKAGE_NAME = 'povils/phpmnd'; | ||
|
|
||
| /** | ||
| * This is the remote file name, not local name. |
There was a problem hiding this comment.
remove comment and name constant REMOTE_FILENAME :)
| /** | ||
| * Packagist package name | ||
| */ | ||
| const PACKAGE_NAME = 'povils/phpmnd'; |
There was a problem hiding this comment.
this belongs to Application i think so
| { | ||
|
|
||
| /** | ||
| * Packagist package name |
There was a problem hiding this comment.
PACKAGIST_PACKAGE_NAME and you dont need comment
| } | ||
|
|
||
| /** | ||
| * Configure phar-updater with local phar details. |
There was a problem hiding this comment.
Comment doesnt match with method name. In other words get rid of comment :)
| $stability, | ||
| $updater->getNewVersion() | ||
| )); | ||
| } elseif (false == $updater->getNewVersion()) { |
There was a problem hiding this comment.
Unfortunately, it does. There's an implementation shortfall in the phar-updater library, where this avoids calling Packagist twice. Something to be fixed there in a future version.
| use Humbug\SelfUpdate\Updater; | ||
| use Humbug\SelfUpdate\Strategy\GithubStrategy; | ||
|
|
||
| class SelfUpdate extends BaseCommand |
There was a problem hiding this comment.
Please make protected methods,properties to private :)
| try { | ||
| $result = $updater->rollback(); | ||
| if ($result) { | ||
| $this->output->writeln('<fg=green>PHPMND has been rolled back to prior version.</fg=green>'); |
There was a problem hiding this comment.
is different from <fg=green> ? I would prefer use , , and so on
There was a problem hiding this comment.
Your preference didn't show up in comment (probably github markdown parser rendering as HTML tag).
There was a problem hiding this comment.
damn :D <info>, <danger>, <warning>
There was a problem hiding this comment.
:D Updated. Check if those are in line with what you would prefer.
There was a problem hiding this comment.
Hmm, seem to be getting ignored for some reason in actual output (at least here). May need to check that tomorrow.
| @@ -36,4 +36,28 @@ if (false === $loaded) { | |||
| ini_set('xdebug.max_nesting_level', 10000); | |||
There was a problem hiding this comment.
this one file is the one i need to take a better look :)
There was a problem hiding this comment.
Yeah, it doesn't sit right here, but can't think of a better way via Symfony/Console. We're basically checking if no command is sent, and prefixing run. We have a run command since adding multiple commands (even two for self-update) seems to require abandoning a default command. Also, the using setDefaultCommand method for Application doesn't accept arguments so that's not a solution.
Not sure if these are specific design decisions (or just limitations) by the Symfony team, or I'm just missing something obvious that would make that prepareArgv function go away.
|
Thanks for the review @povils - made some changes. Missed your comment on the text colouring if you have specific colour codes to fit in with your preferred theme. |
|
@povils Pretty much done, but I may add a few changes towards the weekend to take advantage of a new phar-updater release expected shortly, and someone may know if the fugly argv function has a more...elegant solution. |
self-updatecommand (not loaded unless running a phar). Alsoself-update --check(check if new version) andself-update --rollback(revert to previous version).phpmndcommand torun(bash script edited to inject sophpmndworks exactly as-is).--helpand--version/-Vas expected.padraic/phar-updateradded.Noted as WIP for feedback. Having a
runcommand - there's probably a better way to have a default command (where$_SERVER['argv']isn't manipulated outside of symfony/console). This also omits theself-updatecommand from--help.Works, but may need some tidying for those two points.