Skip to content
This repository has been archived by the owner on Jul 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14 from achmadfatoni/create_artisan_command_to_co…
Browse files Browse the repository at this point in the history
…mposer_install

#10 create artisan command to composer install
  • Loading branch information
mr-feek authored Oct 19, 2017
2 parents 4d24991 + ba0379a commit 5751fe3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Commands/ComposerInstall.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Feek\LaravelGitHooks\Commands;

class ComposerInstall extends BaseCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'hooks:composer-install';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run composer install';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$composerCommand = exec('which composer');

if (! $composerCommand) {
$this->warn('composer not installed');
return;
}
exec($composerCommand . ' install');
}
}
2 changes: 2 additions & 0 deletions src/LaravelGitHooksServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Feek\LaravelGitHooks;

use Feek\LaravelGitHooks\Commands\ComposerInstall;
use Feek\LaravelGitHooks\Commands\ESLint;
use Feek\LaravelGitHooks\Commands\Phpcs;
use Feek\LaravelGitHooks\Commands\Phpcbf;
Expand All @@ -24,6 +25,7 @@ public function boot()
{
if ($this->app->runningInConsole()) {
$this->commands([
ComposerInstall::class,
ESLint::class,
Phpcs::class,
Phpcbf::class,
Expand Down

0 comments on commit 5751fe3

Please # to comment.