Skip to content

Commit

Permalink
Pass correct paths into Camel from upgrader and get the correct confi…
Browse files Browse the repository at this point in the history
…g file in ApiDetails.
  • Loading branch information
ArclightHub committed Nov 27, 2023
1 parent ba820fe commit b6318d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Commands/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Knuckles\Camel\Camel;
use Knuckles\Scribe\Configuration\PathConfig;
use Knuckles\Scribe\GroupedEndpoints\GroupedEndpointsFactory;
use Knuckles\Scribe\Scribe;
use Shalvah\Upgrader\Upgrader;
Expand Down Expand Up @@ -102,7 +103,8 @@ protected function migrateToConfigFileSort()
$this->info("We'll automatically import your current sorting into the config item `groups.order`.");

$defaultGroup = config($this->configName.".default_group");
$extractedEndpoints = GroupedEndpointsFactory::fromCamelDir($this->configName)->get();
$pathConfig = new PathConfig($this->configName, $this->configName, true);
$extractedEndpoints = GroupedEndpointsFactory::fromCamelDir($pathConfig)->get();

$order = array_map(function (array $group) {
return array_map(function (array $endpoint) {
Expand All @@ -112,7 +114,7 @@ protected function migrateToConfigFileSort()
$groupsOrder = array_keys($order);
$keyIndices = array_flip($groupsOrder);

$userDefinedEndpoints = Camel::loadUserDefinedEndpoints(Camel::camelDir($this->configName));
$userDefinedEndpoints = Camel::loadUserDefinedEndpoints(Camel::camelDir($pathConfig));

if ($userDefinedEndpoints) {
foreach ($userDefinedEndpoints as $endpoint) {
Expand Down
2 changes: 1 addition & 1 deletion src/Extracting/ApiDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
) {
$this->markdownOutputPath = $pathConfig->getTemporaryDirectoryPath(); //.scribe by default
// If no config is injected, pull from global. Makes testing easier.
$this->config = $config ?: new DocumentationConfig(config($pathConfig));
$this->config = $config ?: new DocumentationConfig(config($pathConfig->getScribeConfigurationPath()));
$this->baseUrl = $this->config->get('base_url') ?? config('app.url');
$this->preserveUserChanges = $preserveUserChanges;

Expand Down

0 comments on commit b6318d5

Please sign in to comment.