-
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.
Creating single-shot onboarding process
- Loading branch information
Showing
12 changed files
with
113 additions
and
35 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
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 |
---|---|---|
|
@@ -17,6 +17,5 @@ yarn-error.log | |
/.fleet | ||
/.idea | ||
/.vscode | ||
/config/nexxaitvs.php | ||
/config/lgtvs.php | ||
/public/aiowebostv/__pycache__ |
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Services\ConfigMaintain; | ||
use App\Services\CpExec; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Process; | ||
|
||
class FirstTimeSetup extends Command | ||
{ | ||
protected $signature = 'lg:first-time'; | ||
|
||
protected $description = 'Prepare the environment for the first time'; | ||
|
||
public function handle() | ||
{ | ||
if (! file_exists(base_path().'/.env')) { | ||
$copyCommand = CpExec::handle(); | ||
Process::run("{$copyCommand} .env.example .env"); | ||
$this->components->info('.env file created'); | ||
} | ||
|
||
if (! file_exists(base_path().'/config/lgtvs.php')) { | ||
$config = new ConfigMaintain(); | ||
$config->create_lgtvs_file(); | ||
$this->components->info('Config file created'); | ||
} | ||
|
||
$this->call('lg:add'); | ||
|
||
$this->call('key:generate'); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
class CpExec | ||
{ | ||
public static function handle(): string | ||
{ | ||
$os = OS::detect(); | ||
|
||
if ($os == OS::WINDOWS) { | ||
return 'copy'; | ||
} else { | ||
return 'cp'; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
class OS | ||
{ | ||
const WINDOWS = 1; | ||
const NONWINDOWS = 2; | ||
|
||
public static function detect(): int | ||
{ | ||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { | ||
return self::WINDOWS; | ||
} else { | ||
return self::NONWINDOWS; | ||
} | ||
} | ||
} |
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