|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Translation\Console\Commands; |
|
4
|
|
|
|
|
5
|
|
|
use File; |
|
6
|
|
|
use Illuminate\Console\Command; |
|
|
|
|
|
|
7
|
|
|
use Illuminate\Filesystem\Filesystem; |
|
8
|
|
|
use Illuminate\View\Compilers\BladeCompiler; |
|
|
|
|
|
|
9
|
|
|
use Translation\Repositories\LangResourcesRepository; |
|
10
|
|
|
use Translation\Tasks\Builders\MagicTranslateProjectPipelineBuilder; |
|
11
|
|
|
|
|
12
|
|
|
class InstallCommand extends Command |
|
13
|
|
|
{ |
|
14
|
|
|
protected $language = 'pt-BR'; |
|
15
|
|
|
/** |
|
16
|
|
|
* The console command name. |
|
17
|
|
|
* |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $name = 'translation:install'; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* The console command description. |
|
24
|
|
|
* |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $description = 'Run to install'; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Call fire function |
|
31
|
|
|
* |
|
32
|
|
|
* @return void |
|
33
|
|
|
*/ |
|
34
|
|
|
public function handle() |
|
35
|
|
|
{ |
|
36
|
|
|
$this->fire(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Execute the console command. |
|
41
|
|
|
* |
|
42
|
|
|
* @return void |
|
43
|
|
|
*/ |
|
44
|
|
|
public function fire() |
|
45
|
|
|
{ |
|
46
|
|
|
// $repository = app(LangResourcesRepository::class); |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
$pipeline = MagicTranslateProjectPipelineBuilder::getPipelineWithOutput($this); |
|
50
|
|
|
|
|
51
|
|
|
// foreach ($paths as $path) { |
|
52
|
|
|
// Process Pipeline |
|
53
|
|
|
$pipeline( |
|
54
|
|
|
$this->language |
|
55
|
|
|
); |
|
56
|
|
|
// } |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
// $languagesOptions = $repository->mergeLangs('pt-BR', 'pt'); |
|
61
|
|
|
|
|
62
|
|
|
// dd($languagesOptions); |
|
63
|
|
|
// // Create $outputPath or empty it if already exists |
|
64
|
|
|
// if (File::isDirectory($outputPath)) { |
|
65
|
|
|
// File::cleanDirectory($outputPath); |
|
66
|
|
|
// } else { |
|
67
|
|
|
// File::makeDirectory($outputPath); |
|
68
|
|
|
// } |
|
69
|
|
|
|
|
70
|
|
|
// // Configure BladeCompiler to use our own custom storage subfolder |
|
71
|
|
|
// $compiler = new BladeCompiler(new Filesystem, $outputPath); |
|
72
|
|
|
// $compiled = 0; |
|
73
|
|
|
|
|
74
|
|
|
// // Get all view files |
|
75
|
|
|
// $allFiles = File::allFiles($inputPath); |
|
76
|
|
|
// foreach ($allFiles as $f) |
|
77
|
|
|
// { |
|
78
|
|
|
// // Skip not blade templates |
|
79
|
|
|
// $file = $f->getPathName(); |
|
80
|
|
|
// if ('.blade.php' !== substr($file, -10)) { |
|
81
|
|
|
// continue; |
|
82
|
|
|
// } |
|
83
|
|
|
|
|
84
|
|
|
// // Compile the view |
|
85
|
|
|
// $compiler->compile($file); |
|
86
|
|
|
// $compiled++; |
|
87
|
|
|
|
|
88
|
|
|
// // Rename to human friendly |
|
89
|
|
|
// $human = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($f->getRelativePathname(), DIRECTORY_SEPARATOR)); |
|
90
|
|
|
// File::move($outputPath . DIRECTORY_SEPARATOR . md5($file), $outputPath . DIRECTORY_SEPARATOR . $human . '.php'); |
|
91
|
|
|
// } |
|
92
|
|
|
|
|
93
|
|
|
// if ($compiled) { |
|
94
|
|
|
// $this->info("$compiled files compiled."); |
|
95
|
|
|
// } else { |
|
96
|
|
|
// $this->error('No .blade.php files found in '.$inputPath); |
|
97
|
|
|
// } |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths