-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Restructuring source code. - Remove :readme command. - Update README
- Loading branch information
Showing
8 changed files
with
169 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.1 | ||
- 7.2 | ||
- hhvm | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer install --prefer-source --no-interaction --dev | ||
- composer self-update | ||
- composer install --prefer-source --no-interaction --dev | ||
|
||
script: phpunit | ||
script: vendor/bin/phpunit --testdox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<?php namespace Jackiedo\ArtisanPhpCsFixer; | ||
<?php | ||
|
||
namespace Jackiedo\ArtisanPhpCsFixer; | ||
|
||
use Illuminate\Contracts\Support\DeferrableProvider; | ||
use Illuminate\Support\ServiceProvider; | ||
use Jackiedo\ArtisanPhpCsFixer\Console\Commands\ArtisanPhpCsFixerDescribe; | ||
use Jackiedo\ArtisanPhpCsFixer\Console\Commands\ArtisanPhpCsFixerFix; | ||
use Jackiedo\ArtisanPhpCsFixer\Console\Commands\ArtisanPhpCsFixerVersion; | ||
use Jackiedo\ArtisanPhpCsFixer\Console\Commands\ArtisanPhpCsFixerDescribe; | ||
use Jackiedo\ArtisanPhpCsFixer\Console\Commands\ArtisanPhpCsFixerReadme; | ||
|
||
/** | ||
* The ArtisanPhpCsFixerServiceProvider class. | ||
* | ||
* @package Jackiedo\ArtisanPhpCsFixer | ||
* | ||
* @author Jackie Do <[email protected]> | ||
*/ | ||
class ArtisanPhpCsFixerServiceProvider extends ServiceProvider implements DeferrableProvider | ||
|
@@ -23,7 +25,8 @@ class ArtisanPhpCsFixerServiceProvider extends ServiceProvider implements Deferr | |
public function boot() | ||
{ | ||
// Bootstrap handles | ||
$this->configHandle(); | ||
$this->bootConfig(); | ||
$this->bootCommands(); | ||
} | ||
|
||
/** | ||
|
@@ -44,15 +47,6 @@ public function register() | |
$this->app->singleton('command.phpcsfixer.describe', function ($app) { | ||
return new ArtisanPhpCsFixerDescribe; | ||
}); | ||
|
||
$this->app->singleton('command.phpcsfixer.readme', function ($app) { | ||
return new ArtisanPhpCsFixerReadme; | ||
}); | ||
|
||
$this->commands('command.phpcsfixer.fix'); | ||
$this->commands('command.phpcsfixer.version'); | ||
$this->commands('command.phpcsfixer.describe'); | ||
$this->commands('command.phpcsfixer.readme'); | ||
} | ||
|
||
/** | ||
|
@@ -66,7 +60,6 @@ public function provides() | |
'command.phpcsfixer.fix', | ||
'command.phpcsfixer.version', | ||
'command.phpcsfixer.describe', | ||
'command.phpcsfixer.readme', | ||
]; | ||
} | ||
|
||
|
@@ -75,13 +68,27 @@ public function provides() | |
* | ||
* @return void | ||
*/ | ||
protected function configHandle() | ||
protected function bootConfig() | ||
{ | ||
$sourceConfig = __DIR__.'/Config/.php_cs'; | ||
$sourceConfig = __DIR__ . '/Config/.php_cs'; | ||
$exportConfig = base_path('.php_cs'); | ||
|
||
$this->publishes([ | ||
$sourceConfig => $exportConfig, | ||
], 'config'); | ||
} | ||
|
||
/** | ||
* Handle package's commands. | ||
* | ||
* @return void | ||
*/ | ||
protected function bootCommands() | ||
{ | ||
$this->commands([ | ||
'command.phpcsfixer.version', | ||
'command.phpcsfixer.fix', | ||
'command.phpcsfixer.describe', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php namespace Jackiedo\ArtisanPhpCsFixer\Console\Commands; | ||
<?php | ||
|
||
namespace Jackiedo\ArtisanPhpCsFixer\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
/** | ||
* The ArtisanPhpCsFixerDescribe class. | ||
* | ||
* @package Jackiedo\ArtisanPhpCsFixer | ||
* | ||
* @author Jackie Do <[email protected]> | ||
*/ | ||
class ArtisanPhpCsFixerDescribe extends Command | ||
class ArtisanPhpCsFixerDescribe extends BaseCommand | ||
{ | ||
|
||
/** | ||
* The console command name. | ||
* | ||
|
@@ -25,17 +25,7 @@ class ArtisanPhpCsFixerDescribe extends Command | |
* | ||
* @var string | ||
*/ | ||
protected $description = 'Describe rule / ruleset of fixer.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
protected $description = 'Describe rule / rule set of fixer.'; | ||
|
||
/** | ||
* Execute the console command. | ||
|
@@ -44,19 +34,7 @@ public function __construct() | |
*/ | ||
public function fire() | ||
{ | ||
$phpCsFixerBinnaryPath = base_path('vendor/bin/php-cs-fixer'); | ||
|
||
passthru($phpCsFixerBinnaryPath.' describe '.$this->argument('name')); | ||
} | ||
|
||
/** | ||
* Alias of the fire() method | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->fire(); | ||
passthru($this->phpCsFixerBinary . ' describe ' . $this->argument('name')); | ||
} | ||
|
||
/** | ||
|
@@ -67,7 +45,7 @@ public function handle() | |
protected function getArguments() | ||
{ | ||
return [ | ||
array('name', InputArgument::REQUIRED, 'Name of rule / set.'), | ||
['name', InputArgument::REQUIRED, 'Name of rule / rule set.'], | ||
]; | ||
} | ||
|
||
|
Oops, something went wrong.