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 publications to integrate better with Hyde #675

Merged
merged 133 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
1462755
Create PublicationPage.php
caendesilva Nov 18, 2022
9e3e7c5
Apply fixes from StyleCI
StyleCIBot Nov 18, 2022
58c5229
Add class PHPDoc
caendesilva Nov 18, 2022
71a0b0a
Add PublicationPage feature
caendesilva Nov 18, 2022
6fe5c86
Update ConfigurableFeaturesTest.php
caendesilva Nov 18, 2022
f1fa0c5
Test HtmlPages
caendesilva Nov 18, 2022
01e513b
Update PageCollectionTest.php
caendesilva Nov 18, 2022
90e3fbe
Add hook for publication page discovery
caendesilva Nov 18, 2022
407fdfa
Rename HydeHelper to PublicationHelper
caendesilva Nov 18, 2022
ef7027c
Create PublicationType.php
caendesilva Nov 18, 2022
606802c
Create base PublicationType object
caendesilva Nov 18, 2022
ed515e8
Add magic __get method
caendesilva Nov 18, 2022
b30e7ff
Update magic method to first search for actual class properties
caendesilva Nov 18, 2022
c2c4996
Force relative path
caendesilva Nov 18, 2022
87449c7
Refactor to use the PublicationType class
caendesilva Nov 18, 2022
ac48f8c
Update return tag
caendesilva Nov 18, 2022
3b4f12a
Use Hyde::path() instead of base_path()
caendesilva Nov 18, 2022
d421668
Add publication type property to publication pages
caendesilva Nov 18, 2022
6c77bb6
Make property public to match parent class properties
caendesilva Nov 18, 2022
0316554
Add publication type to constructor
caendesilva Nov 18, 2022
a1119f2
Add todo
caendesilva Nov 18, 2022
d859965
Add getters
caendesilva Nov 18, 2022
5018763
Use added getter
caendesilva Nov 18, 2022
6198b19
Type hint the PublicationType class instead of Collection
caendesilva Nov 18, 2022
8b859ad
Change PublicationPage to extend BaseMarkdownPage
caendesilva Nov 18, 2022
4447a6c
Add static get method to PublicationType class
caendesilva Nov 18, 2022
e63f1f9
Refactor to return PublicationPage instead of Collection
caendesilva Nov 18, 2022
740c250
Add path mapping placeholders
caendesilva Nov 18, 2022
1ef357b
Implement publication discovery
caendesilva Nov 18, 2022
8d7b536
Apply fixes from StyleCI
StyleCIBot Nov 18, 2022
f7ba1a2
Add todo
caendesilva Nov 19, 2022
a3b7e88
Remove error suppression in test
caendesilva Nov 19, 2022
e7f4ef1
Add todo
caendesilva Nov 19, 2022
49e7b6d
Merge branch 'publications-feature' into refactor-publications
caendesilva Nov 19, 2022
9eb27ad
Create PublicationPageTest.php
caendesilva Nov 19, 2022
464549d
Test publication pages are routable
caendesilva Nov 19, 2022
faa25da
Test publication pages are discoverable and parsable
caendesilva Nov 19, 2022
8b76a3e
Test publication pages are discoverable and compilable
caendesilva Nov 19, 2022
b0aea50
Extract method
caendesilva Nov 19, 2022
d524de8
Update test directory name
caendesilva Nov 19, 2022
3e2daca
Add TODOs
caendesilva Nov 19, 2022
da463ad
Implement compile() method
caendesilva Nov 19, 2022
aacf86a
Test with real files
caendesilva Nov 19, 2022
ca90658
Add todo
caendesilva Nov 19, 2022
c7f1295
Test publication pages are properly parsed
caendesilva Nov 19, 2022
0440ddc
Update PublicationPageTest.php
caendesilva Nov 19, 2022
f0f2c6d
Update PublicationPageTest.php
caendesilva Nov 19, 2022
e392193
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
d91c61d
Refactor to use setup/teardown methods
caendesilva Nov 19, 2022
9fa38bf
Add todo
caendesilva Nov 19, 2022
3e7c85c
Display memory usage after build is finished
caendesilva Nov 19, 2022
759886e
Refactor BuildPublications command to only build publications so it c…
caendesilva Nov 19, 2022
d3f0f74
Move demo files from vendor to project
caendesilva Nov 19, 2022
b711aec
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
05adc66
Breaking: Move PublicationHelper into Publications feature namespace
caendesilva Nov 19, 2022
59b08b2
Create PublicationListPage.php
caendesilva Nov 19, 2022
50e77be
Override directory information
caendesilva Nov 19, 2022
7a42176
Empty directory information
caendesilva Nov 19, 2022
d9ea643
Dynamically discover publication listing pages
caendesilva Nov 19, 2022
6bd5d85
Create PublicationListPageTest.php
caendesilva Nov 19, 2022
be98c03
Replace qualifier with an import
caendesilva Nov 19, 2022
07dbd60
Add PublicationType property to listing page
caendesilva Nov 19, 2022
dc442f9
Override listing page constructor to only accept the publication type
caendesilva Nov 19, 2022
5c29523
Add strict types declaration
caendesilva Nov 19, 2022
1d01628
Revert "Empty directory information"
caendesilva Nov 19, 2022
f9cf6cb
Add testing helpers
caendesilva Nov 19, 2022
cd6d99f
Add test for source path mappings
caendesilva Nov 19, 2022
d5e5f3e
Construct identifier
caendesilva Nov 19, 2022
fcdf9e1
Construct identifier via parent constructor
caendesilva Nov 19, 2022
ffc48ba
Blank out output directory
caendesilva Nov 19, 2022
894ee93
Add additional tests
caendesilva Nov 19, 2022
940eec0
Set file extension to JSON
caendesilva Nov 19, 2022
ae1719b
Remove extra newline
caendesilva Nov 19, 2022
0bc8e29
Change dynamic source directory to __publications
caendesilva Nov 19, 2022
a29ac36
Test getSourcePath
caendesilva Nov 19, 2022
370c3df
Fix delete path issue in test
caendesilva Nov 19, 2022
af64d91
Update expected route key
caendesilva Nov 19, 2022
7816c50
Convert test method case
caendesilva Nov 19, 2022
80981ba
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
99e08f9
Implement listing page compiler
caendesilva Nov 19, 2022
e2cae22
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
2833bbf
Test source path mappings
caendesilva Nov 19, 2022
6b2c343
Prefix publication directory to identifier using parent constructor
caendesilva Nov 19, 2022
d1b1627
Blank out source and output directories
caendesilva Nov 19, 2022
4480cfb
Reorder constructor calls
caendesilva Nov 19, 2022
290cc45
Unslash page source and output paths
caendesilva Nov 19, 2022
1665f82
Merge branch 'master' into refactor-publications
caendesilva Nov 19, 2022
a793906
Fall back to current time if stat fails in sitemap generator
caendesilva Nov 19, 2022
79a4e14
Delete blah directory
caendesilva Nov 19, 2022
a8a32ac
Update PageCollectionTest.php
caendesilva Nov 19, 2022
2a215c4
Update PublicationPageTest.php
caendesilva Nov 19, 2022
3ce9cca
Move test to feature namespace
caendesilva Nov 19, 2022
baf1c63
Test HtmlPages
caendesilva Nov 19, 2022
a9175ac
Revert "Delete blah directory"
caendesilva Nov 19, 2022
cfbbf8a
Fix test namespace
caendesilva Nov 19, 2022
e537511
Link to the test
caendesilva Nov 19, 2022
5a738c8
Link to the test
caendesilva Nov 19, 2022
a8a16dd
Link to related class
caendesilva Nov 19, 2022
f7aeae8
Force FQCN in PHPDocs
caendesilva Nov 19, 2022
baae78e
Override source page method to get consistent behaviour
caendesilva Nov 19, 2022
ab1566a
Change source path to be schema.json for listing pages
caendesilva Nov 19, 2022
bc8bf55
Use basename instead of str_replace
caendesilva Nov 19, 2022
9c44c8b
Display fully qualified class name for non-Hyde pages
caendesilva Nov 19, 2022
537d423
Remove class BuildPublicationsCommand merged into standard build command
caendesilva Nov 19, 2022
4479041
Delete BuildPublicationsCommand.php
caendesilva Nov 19, 2022
d98d033
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
a3cacf7
Add todo
caendesilva Nov 19, 2022
4ff2525
Remove legacy comment
caendesilva Nov 19, 2022
6cfd02c
Remove resolved todo
caendesilva Nov 19, 2022
079b667
Update constructor semantics to match sibling class
caendesilva Nov 19, 2022
c74f7f0
Merge branch 'publications-feature' into refactor-publications
caendesilva Nov 19, 2022
904c874
Merge branch 'publications-feature' into refactor-publications
caendesilva Nov 19, 2022
fa79eb5
Delete blah directory
caendesilva Nov 19, 2022
b21cae6
Remove file extension from templates to match actual schema
caendesilva Nov 19, 2022
594e9fe
No longer need to trim file extension not present in schema anymore
caendesilva Nov 19, 2022
7687016
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
275299b
Update legacy path expectation
caendesilva Nov 19, 2022
47780d6
Split out into two tests
caendesilva Nov 19, 2022
d921319
Formatting
caendesilva Nov 19, 2022
64f1ad6
Use class_basename as basename only works for classes on Windows
caendesilva Nov 19, 2022
171a144
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
40e065a
Update view function call syntax to match other classes
caendesilva Nov 19, 2022
636ecdd
Inline unnecessary local variables
caendesilva Nov 19, 2022
ef8192e
Apply fixes from StyleCI
StyleCIBot Nov 19, 2022
ac810b0
Update Blade comment to match file
caendesilva Nov 19, 2022
4c48512
Breaking: Rename view pubtype to publication
caendesilva Nov 19, 2022
0fffa97
Store publication list template in the publication directory
caendesilva Nov 20, 2022
4005ca8
Render template as is if it's a vendor view
caendesilva Nov 20, 2022
b8709da
Style fix
caendesilva Nov 20, 2022
f910db1
Apply fixes from StyleCI
StyleCIBot Nov 20, 2022
fbee205
Add code documentation
caendesilva Nov 20, 2022
ae16ae1
Refactor to render detail page in page class
caendesilva Nov 20, 2022
a7c862b
Apply fixes from StyleCI
StyleCIBot Nov 20, 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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ ij_php_phpdoc_keep_blank_lines = true
ij_php_phpdoc_param_spaces_between_name_and_description = 1
ij_php_phpdoc_param_spaces_between_tag_and_type = 1
ij_php_phpdoc_param_spaces_between_type_and_name = 1
ij_php_phpdoc_use_fqcn = false
ij_php_phpdoc_use_fqcn = true
ij_php_phpdoc_wrap_long_lines = false
ij_php_place_assignment_sign_on_next_line = false
ij_php_place_parens_for_constructor = 0
Expand Down
8 changes: 0 additions & 8 deletions blah/123.md

This file was deleted.

8 changes: 0 additions & 8 deletions blah/aaa.md

This file was deleted.

8 changes: 0 additions & 8 deletions blah/abc.md

This file was deleted.

30 changes: 0 additions & 30 deletions blah/schema.json

This file was deleted.

1 change: 1 addition & 0 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
Features::bladePages(),
Features::markdownPages(),
Features::documentationPages(),
Features::publicationPages(),
// Features::dataCollections(),

// Frontend Features
Expand Down
1 change: 1 addition & 0 deletions packages/framework/config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
Features::bladePages(),
Features::markdownPages(),
Features::documentationPages(),
Features::publicationPages(),
// Features::dataCollections(),

// Frontend Features
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{-- The Post Page Layout --}}
{{-- The Publication Page Layout --}}
@extends('hyde::layouts.app')
@section('content')

<main id="content" class="mx-auto max-w-7xl py-16 px-8">
@include($component, ['publication' => $publication])
{{ $publication }}
</main>

@endsection
205 changes: 0 additions & 205 deletions packages/framework/src/Console/Commands/BuildPublicationsCommand.php

This file was deleted.

3 changes: 3 additions & 0 deletions packages/framework/src/Console/Commands/BuildSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Hyde\Hyde;
use Illuminate\Support\Facades\Config;
use LaravelZero\Framework\Commands\Command;
use function memory_get_peak_usage;

/**
* Hyde Command to run the Build Process.
Expand Down Expand Up @@ -55,6 +56,8 @@ public function handle(): int

$this->printFinishMessage($time_start);

$this->output->writeln('Max memory used: '.memory_get_peak_usage() / 1024 / 1024 .' MB');

return Command::SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Hyde\Console\Commands\Interfaces\CommandHandleInterface;
use Hyde\Framework\Actions\CreatesNewPublicationFile;
use Hyde\HydeHelper;
use Hyde\Framework\Features\Publications\PublicationHelper;
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
use Rgasch\Collection\Collection;
Expand All @@ -29,7 +29,7 @@ public function handle(): int
{
$this->title('Creating a new Publication Item!');

$pubTypes = HydeHelper::getPublicationTypes();
$pubTypes = PublicationHelper::getPublicationTypes();
if ($pubTypes->isEmpty()) {
$this->output->error('Unable to locate any publication-types ... did you create any?');

Expand All @@ -44,11 +44,11 @@ public function handle(): int
$offset++;
$this->line(" $offset: $pubType->name");
}
$selected = (int) HydeHelper::askWithValidation($this, 'selected', "Publication type (1-$offset)", ['required', 'integer', "between:1,$offset"]);
$selected = (int) PublicationHelper::askWithValidation($this, 'selected', "Publication type (1-$offset)", ['required', 'integer', "between:1,$offset"]);
$pubType = $pubTypes->{$pubTypes->keys()[$selected - 1]};
}

$mediaFiles = HydeHelper::getMediaForPubType($pubType);
$mediaFiles = PublicationHelper::getMediaForPubType($pubType);
$fieldData = Collection::create();
$this->output->writeln('<bg=magenta;fg=white>Now please enter the field data:</>');
foreach ($pubType->fields as $field) {
Expand All @@ -63,7 +63,7 @@ public function handle(): int
// Useful for debugging
//$this->output->writeln("xxx " . $e->getTraceAsString());
$this->output->writeln("<bg=red;fg=white>$msg</>");
$overwrite = HydeHelper::askWithValidation(
$overwrite = PublicationHelper::askWithValidation(
$this,
'overwrite',
'Do you wish to overwrite the existing file (y/n)',
Expand Down Expand Up @@ -123,7 +123,7 @@ private function captureFieldInput(Collection $field, Collection $mediaFiles): s
$offset = $k + 1;
$this->output->writeln(" $offset: $file");
}
$selected = HydeHelper::askWithValidation($this, $field->name, $field->name, ['required', 'integer', "between:1,$offset"]);
$selected = PublicationHelper::askWithValidation($this, $field->name, $field->name, ['required', 'integer', "between:1,$offset"]);
$file = $mediaFiles->{$selected - 1};

return '_media/'.Str::of($file)->after('media/')->toString();
Expand All @@ -148,7 +148,7 @@ private function captureFieldInput(Collection $field, Collection $mediaFiles): s
}
}

return HydeHelper::askWithValidation($this, $field->name, $field->name, $fieldRules);
return PublicationHelper::askWithValidation($this, $field->name, $field->name, $fieldRules);
}

private function getValidationRulesPerType(): Collection
Expand Down
Loading