Skip to content

Commit

Permalink
修改配置文件生成后的逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
titrxw committed Mar 31, 2020
1 parent f6e6f15 commit 6f9e009
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions src/Processor/Event/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class Processor extends ProcessorAbstract {
public function process($vendorPath) {
$dir = dirname($vendorPath, 1) . '/app/Event';
$appEvents = $this->findEvents($dir, 'W7\\App');
$this->generateEventConfig($appEvents, $vendorPath);
$eventFilePath = $this->generateEventConfig($appEvents, $vendorPath);
$this->addAutoloadFiles($eventFilePath);
}

/**
Expand Down Expand Up @@ -59,11 +60,12 @@ private function generateEventConfig($events, $vendorPath) {
}
$content .=" ];\r\n}";

$eventFile = $vendorPath . '/composer/rangine/autoload/event.php';
if (!is_dir(dirname($eventFile))) {
mkdir(dirname($eventFile), 0777, true);
$eventFilePath = $vendorPath . '/composer/rangine/autoload/event.php';
if (!is_dir(dirname($eventFilePath))) {
mkdir(dirname($eventFilePath), 0777, true);
}
file_put_contents($eventFile, $content);
$this->addAutoloadFiles($eventFile);
file_put_contents($eventFilePath, $content);

return $eventFilePath;
}
}
14 changes: 8 additions & 6 deletions src/Processor/Provider/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class Processor extends ProcessorAbstract {
public function process($vendorPath) {
$vendorProviders = $this->findVendorProviders();
$appProviders = $this->findAppProviders($vendorPath);
$this->generateProviderConfig(array_merge($vendorProviders, $appProviders), $vendorPath);
$providerFilePath = $this->generateProviderConfig(array_merge($vendorProviders, $appProviders), $vendorPath);
$this->addAutoloadFiles($providerFilePath);
}

private function findVendorProviders() {
Expand Down Expand Up @@ -60,11 +61,12 @@ private function generateProviderConfig($providers, $vendorPath) {
}
$content .=" ];\r\n}";

$providerFile = $vendorPath . '/composer/rangine/autoload/provider.php';
if (!is_dir(dirname($providerFile))) {
mkdir(dirname($providerFile), 0777, true);
$providerFilePath = $vendorPath . '/composer/rangine/autoload/provider.php';
if (!is_dir(dirname($providerFilePath))) {
mkdir(dirname($providerFilePath), 0777, true);
}
file_put_contents($providerFile, $content);
$this->addAutoloadFiles($providerFile);
file_put_contents($providerFilePath, $content);

return $providerFilePath;
}
}

0 comments on commit 6f9e009

Please sign in to comment.