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 3
3
"compactors" : [" Herrera\\ Box\\ Compactor\\ Php" ],
4
4
"compression" : " GZ" ,
5
5
"directories" : [" src" ],
6
- "files" : [" LICENSE" ],
6
+ "files" : [" LICENSE" , " vendor/herrera-io/phar-update/res/schema.json " ],
7
7
"finder" : [
8
8
{
9
9
"name" : " *.php" ,
Original file line number Diff line number Diff line change 27
27
],
28
28
"require" : {
29
29
"php" : " >=5.4.0" ,
30
- "symfony/console" : " 2.7.*@dev" ,
30
+
31
+ "herrera-io/phar-update" : " ~2.0" ,
31
32
"nikic/php-parser" : " dev-features/php-semver-checker" ,
33
+ "symfony/console" : " 2.7.*@dev" ,
32
34
"phpunit/php-file-iterator" : " ~1.3"
33
35
},
34
36
"require-dev" : {
35
- "phpunit/phpunit " : " ~4 " ,
36
- "mockery/mockery " : " ~0.9 "
37
+ "mockery/mockery " : " ~0.9 " ,
38
+ "phpunit/phpunit " : " ~4 "
37
39
},
38
40
"autoload" : {
39
41
"psr-4" : {
Original file line number Diff line number Diff line change 3
3
namespace PHPSemVerChecker \Console ;
4
4
5
5
use PHPSemVerChecker \Console \Command \CompareCommand ;
6
+ use PHPSemVerChecker \Console \Command \SelfUpdateCommand ;
6
7
use Symfony \Component \Console \Application as SymfonyApplication ;
7
8
8
9
class Application extends SymfonyApplication {
@@ -30,6 +31,7 @@ protected function getDefaultCommands()
30
31
{
31
32
$ commands = parent ::getDefaultCommands ();
32
33
$ commands [] = $ this ->add (new CompareCommand ());
34
+ $ commands [] = $ this ->add (new SelfUpdateCommand ());
33
35
return $ commands ;
34
36
}
35
37
}
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