Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the backend structure of the static page builder command process #72

Merged
merged 28 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e980477
Rename getSourceSlugsOfModels method
caendesilva Apr 7, 2022
4adec4e
Add the media asset service method
caendesilva Apr 7, 2022
801597d
Move shared logic to helper method
caendesilva Apr 8, 2022
3fae508
Move post build actions to method
caendesilva Apr 8, 2022
1f5d842
Move createClickableFilepath method to BuildService
caendesilva Apr 8, 2022
7a8234c
Extract output logic to helper methods
caendesilva Apr 8, 2022
3891817
Update visibility scopes
caendesilva Apr 8, 2022
350dcf4
Move shared output comment to check helper method
caendesilva Apr 8, 2022
0a0d8df
Seperate rebuild service from build service
caendesilva Apr 8, 2022
b643cf7
Add get() method for compatability
caendesilva Apr 8, 2022
289df1f
Refactor code to be more dynamic and reduce boilerplate
caendesilva Apr 8, 2022
b9cc1a8
Add getParserInstance method
caendesilva Apr 8, 2022
b54bddf
Add return missing value
caendesilva Apr 8, 2022
89a0271
Move stub to vendor
caendesilva Apr 8, 2022
122372d
Extract the node command runners
caendesilva Apr 8, 2022
1633e55
Remove HydeMakeValidatorCommand
caendesilva Apr 8, 2022
e8feae7
Restructure command signatures
caendesilva Apr 8, 2022
77d464c
Refactor the build loop to reduce repeating code
caendesilva Apr 8, 2022
0d36a27
Remove verbose output
caendesilva Apr 8, 2022
3c8bc73
Don't actually run the command when testing
caendesilva Apr 8, 2022
0f8b0e8
Simplify trait and integrate it
caendesilva Apr 8, 2022
613f9cb
Refactor code to extract shared logic
caendesilva Apr 8, 2022
42f1cb0
Deprecate command
caendesilva Apr 8, 2022
0c7301d
Remove unnecessary try-catch block
caendesilva Apr 8, 2022
e211070
Seperate the output message from the test condition
caendesilva Apr 8, 2022
ac3126d
Rework how shell_exec commands are mocked
caendesilva Apr 8, 2022
9970af5
Apply fixes from StyleCI
Apr 8, 2022
2378a2a
Merge pull request #73 from hydephp/analysis-AD0W5N
caendesilva Apr 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename getSourceSlugsOfModels method
  • Loading branch information
caendesilva committed Apr 7, 2022
commit e980477684767bbdb5867800f0965d4e638bac10
2 changes: 1 addition & 1 deletion src/Actions/GeneratesDocumentationSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function get(string $current = ''): array

$array = [];

foreach (CollectionService::getSourceSlugsOfModels(DocumentationPage::class) as $slug) {
foreach (CollectionService::getSourceFileListForModel(DocumentationPage::class) as $slug) {
if ($slug == 'index') {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/HydeBuildStaticSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function ($filepath) {
}

if (Features::hasBlogPosts()) {
$collection = CollectionService::getSourceSlugsOfModels(MarkdownPost::class);
$collection = CollectionService::getSourceFileListForModel(MarkdownPost::class);
if (sizeof($collection) < 1) {
$this->line('No Markdown Posts found. Skipping...');
$this->newLine();
Expand All @@ -120,7 +120,7 @@ function ($slug) {
}

if (Features::hasMarkdownPages()) {
$collection = CollectionService::getSourceSlugsOfModels(MarkdownPage::class);
$collection = CollectionService::getSourceFileListForModel(MarkdownPage::class);
if (sizeof($collection) < 1) {
$this->line('No Markdown Pages found. Skipping...');
$this->newLine();
Expand All @@ -137,7 +137,7 @@ function ($slug) {
}

if (Features::hasDocumentationPages()) {
$collection = CollectionService::getSourceSlugsOfModels(DocumentationPage::class);
$collection = CollectionService::getSourceFileListForModel(DocumentationPage::class);

if (sizeof($collection) < 1) {
$this->line('No Documentation Pages found. Skipping...');
Expand All @@ -155,7 +155,7 @@ function ($slug) {
}

if (Features::hasBladePages()) {
$collection = CollectionService::getSourceSlugsOfModels(BladePage::class);
$collection = CollectionService::getSourceFileListForModel(BladePage::class);

if (sizeof($collection) < 1) {
$this->line('No Blade Pages found. Skipping...');
Expand Down
7 changes: 4 additions & 3 deletions src/Services/CollectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
class CollectionService
{
/**
* Return an array of all the source markdown slugs of the specified model.
* Array format is ['_relative/path.md' => 'path.md'].
* Supply a model::class constant and get a list of all the existing source file names,
* where each value follows the format of "basename.extension".
*
* @param string $model
* @return array|false array on success, false if the class was not found
* @example CollectionService::getSourceFileListForModel(BladePage::class)
*/
#[Pure]
public static function getSourceSlugsOfModels(string $model): array|false
public static function getSourceFileListForModel(string $model): array|false
{
if ($model == BladePage::class) {
return self::getBladePageList();
Expand Down