File tree Expand file tree Collapse file tree 4 files changed +36
-4
lines changed
src/PHPSemVerChecker/Console Expand file tree Collapse file tree 4 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 33 "compactors" : [" Herrera\\ Box\\ Compactor\\ Php" ],
44 "compression" : " GZ" ,
55 "directories" : [" src" ],
6- "files" : [" LICENSE" ],
6+ "files" : [" LICENSE" , " vendor/herrera-io/phar-update/res/schema.json " ],
77 "finder" : [
88 {
99 "name" : " *.php" ,
Original file line number Diff line number Diff line change 2727 ],
2828 "require" : {
2929 "php" : " >=5.4.0" ,
30- "symfony/console" : " 2.7.*@dev" ,
30+
31+ "herrera-io/phar-update" : " ~2.0" ,
3132 "nikic/php-parser" : " dev-features/php-semver-checker" ,
33+ "symfony/console" : " 2.7.*@dev" ,
3234 "phpunit/php-file-iterator" : " ~1.3"
3335 },
3436 "require-dev" : {
35- "phpunit/phpunit " : " ~4 " ,
36- "mockery/mockery " : " ~0.9 "
37+ "mockery/mockery " : " ~0.9 " ,
38+ "phpunit/phpunit " : " ~4 "
3739 },
3840 "autoload" : {
3941 "psr-4" : {
Original file line number Diff line number Diff line change 33namespace PHPSemVerChecker \Console ;
44
55use PHPSemVerChecker \Console \Command \CompareCommand ;
6+ use PHPSemVerChecker \Console \Command \SelfUpdateCommand ;
67use Symfony \Component \Console \Application as SymfonyApplication ;
78
89class Application extends SymfonyApplication {
@@ -30,6 +31,7 @@ protected function getDefaultCommands()
3031 {
3132 $ commands = parent ::getDefaultCommands ();
3233 $ commands [] = $ this ->add (new CompareCommand ());
34+ $ commands [] = $ this ->add (new SelfUpdateCommand ());
3335 return $ commands ;
3436 }
3537}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PHPSemVerChecker \Console \Command ;
4+
5+ use Herrera \Json \Exception \FileException ;
6+ use Herrera \Phar \Update \Manager ;
7+ use Herrera \Phar \Update \Manifest ;
8+ use Symfony \Component \Console \Command \Command ;
9+ use Symfony \Component \Console \Input \InputInterface ;
10+ use Symfony \Component \Console \Output \OutputInterface ;
11+
12+ class SelfUpdateCommand extends Command {
13+ const MANIFEST_FILE = 'https://tomzx.github.io/php-semver-checker/manifest.json ' ;
14+
15+ protected function configure ()
16+ {
17+ $ this
18+ ->setName ('self-update ' )
19+ ->setDescription ('Update php-semver-checker.phar to the latest version ' )
20+ ;
21+ }
22+
23+ protected function execute (InputInterface $ input , OutputInterface $ output )
24+ {
25+ $ manager = new Manager (Manifest::loadFile (self ::MANIFEST_FILE ));
26+ $ manager ->update ($ this ->getApplication ()->getVersion ());
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments