Skip to content

Commit

Permalink
update packages and code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nothing-Works committed Feb 5, 2020
1 parent a4b4dba commit 1fd46d7
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 108 deletions.
2 changes: 1 addition & 1 deletion andylaravel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use LaravelHelper\Commands\SetupIDE;
use LaravelHelper\Commands\UpdateIDE;
use Symfony\Component\Console\Application;

$app = new Application('Laravel Helper', '1.0.1');
$app = new Application('Laravel Helper', '1.0.2');

$app->addCommands([new SetupIDE(), new UpdateIDE()]);

Expand Down
20 changes: 10 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 8 additions & 20 deletions src/Processes/BaseProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,21 @@

class BaseProcess
{
/**
* @var array
*/
protected $command = [];
protected array $command = [];

/**
* @var int
*/
protected $timeOut = 60;
protected int $timeOut = 60;

/**
* @var string
*/
protected $reason = 'not sure why';
protected string $reason = 'not sure why';

/**
* @return void
*
* @throws Exception
*/
public function run()
public function run(): void
{
$this->validateCommand();

$process = $this->runProcess();

if ($this->processFailed($process))
if ($this->processFailed($process)) {
throw new Exception($this->reason, 1);
}
}

private function processFailed(Process $process): bool
Expand Down Expand Up @@ -63,7 +50,8 @@ private function printOutput(): callable
*/
private function validateCommand()
{
if (empty($this->command))
if (empty($this->command)) {
throw new Exception('You need to pass some command', 1);
}
}
}
10 changes: 2 additions & 8 deletions src/Processes/ClearCompiled.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class ClearCompiled extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Clear Compiled files';
public string $message = 'Clear Compiled files';

/**
* @var array
*/
protected $command = ['php', 'artisan', 'clear-compiled'];
protected array $command = ['php', 'artisan', 'clear-compiled'];
}
10 changes: 2 additions & 8 deletions src/Processes/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class Generate extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Generating files..';
public string $message = 'Generating files..';

/**
* @var array
*/
protected $command = ['php', 'artisan', 'ide-helper:generate'];
protected array $command = ['php', 'artisan', 'ide-helper:generate'];
}
20 changes: 4 additions & 16 deletions src/Processes/InstallLaravelIDEHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,11 @@

class InstallLaravelIDEHelper extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Installing Laravel Ide helper';
public string $message = 'Installing Laravel Ide helper';

/**
* @var array
*/
protected $command = ['composer', 'require', '--dev', 'barryvdh/laravel-ide-helper:dev-master'];
protected array $command = ['composer', 'require', '--dev', 'barryvdh/laravel-ide-helper:dev-master'];

/**
* @var int
*/
protected $timeOut = 3600;
protected int $timeOut = 3600;

/**
* @var string
*/
protected $reason = 'maybe network, maybe time is too short';
protected string $reason = 'maybe network, maybe time is too short';
}
15 changes: 3 additions & 12 deletions src/Processes/LaravelRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,9 @@

class LaravelRoot extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Checking if it is the root dir';
public string $message = 'Checking if it is the root dir';

/**
* @var array
*/
protected $command = ['php', 'artisan'];
protected array $command = ['php', 'artisan'];

/**
* @var string
*/
protected $reason = 'It is not the root of Laravel';
protected string $reason = 'It is not the root of Laravel';
}
10 changes: 2 additions & 8 deletions src/Processes/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class Meta extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Meta files..';
public string $message = 'Meta files..';

/**
* @var array
*/
protected $command = ['php', 'artisan', 'ide-helper:meta'];
protected array $command = ['php', 'artisan', 'ide-helper:meta'];
}
10 changes: 2 additions & 8 deletions src/Processes/Models.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class Models extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Model files..';
public string $message = 'Model files..';

/**
* @var array
*/
protected $command = ['php', 'artisan', 'ide-helper:models', '-N'];
protected array $command = ['php', 'artisan', 'ide-helper:models', '-N'];
}
10 changes: 2 additions & 8 deletions src/Processes/PublishVendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class PublishVendor extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Publishing Vendor dir';
public string $message = 'Publishing Vendor dir';

/**
* @var array
*/
protected $command = ['php', 'artisan', 'vendor:publish', '--provider=' . 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', '--tag=config'];
protected array $command = ['php', 'artisan', 'vendor:publish', '--provider='.'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', '--tag=config'];
}
10 changes: 2 additions & 8 deletions src/Processes/RemoveVendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

class RemoveVendor extends BaseProcess implements IRunnable
{
/**
* @var string
*/
public $message = 'Removing Vendor dir';
public string $message = 'Removing Vendor dir';

/**
* @var array
*/
protected $command = ['rm', '-rf', './config/ide-helper.php'];
protected array $command = ['rm', '-rf', './config/ide-helper.php'];
}
3 changes: 3 additions & 0 deletions src/Scripts/BaseScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace LaravelHelper\Scripts;

use Exception;
use Symfony\Component\Console\Exception\LogicException;

class BaseScript
{
protected $filePath = '';
Expand Down
3 changes: 2 additions & 1 deletion src/Scripts/ResetComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class ResetComposer extends BaseScript implements IRunnable

protected function prepare()
{
if (isset($this->data['scripts']['post-update-cmd']))
if (isset($this->data['scripts']['post-update-cmd'])) {
unset($this->data['scripts']['post-update-cmd']);
}
}
}

0 comments on commit 1fd46d7

Please sign in to comment.