Skip to content

Commit

Permalink
Merge branch 'master' into 445-rename-to-hydesmartdocs-to-hydesemanti…
Browse files Browse the repository at this point in the history
…cdocs
  • Loading branch information
caendesilva committed Aug 28, 2022
2 parents 3139b27 + 34ef567 commit 163b389
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/end-to-end-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
name: dusk-source
path: _site

# @TODO compile latest hydefront version
# @TODO #444 compile latest hydefront version
- name: Download app.css
uses: actions/download-artifact@v2
with:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/split-monorepo.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# Split the monorepo into readonly repositories
# TODO: Some way to preserve commit messages? I'd love to get some help here.
# ✔ Done, though it only gets the latest commit. It would be great to have something that handles all commit messages. Or at least says "<commit msg> (and X more [commits]) Maybe this could be done by creating an auto-closing PR listing all the commits since the last merge? Preferably filtered to only contain changes affecting the package.
# @TODO add all previous commits to the commit message
# @TODO change graceful git error handling to only catch working tree cleanness errors, allowing jobs to fail when it should
# @TODO group similar jobs into matrix
# @TODO merge workflow file into main ci file

name: 🪓 Split monorepo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*
* @experimental 🧪 Subject to change without notice.
*
* @todo #445 Rename to HydeSemanticDocs
*
* @see \Hyde\Framework\Testing\Feature\Services\HydeSmartDocsTest
*/
class SemanticDocumentationArticle
Expand Down
166 changes: 164 additions & 2 deletions packages/framework/tests/Feature/Foundation/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

use Hyde\Framework\Foundation\Filesystem;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Pages\BladePage;
use Hyde\Framework\Models\Pages\DocumentationPage;
use Hyde\Framework\Models\Pages\MarkdownPage;
use Hyde\Framework\Models\Pages\MarkdownPost;
use Hyde\Testing\TestCase;

/**
* @covers \Hyde\Framework\HydeKernel
* @covers \Hyde\Framework\Foundation\Filesystem
*
* @see \Hyde\Framework\Testing\Unit\Foundation\FluentFilesystemModelPathHelpersTest
*/
class FilesystemTest extends TestCase
{
Expand Down Expand Up @@ -146,4 +149,163 @@ public function test_unlink_helper_deletes_multiple_files_at_given_paths()
$this->assertFileDoesNotExist(Hyde::path('foo'));
$this->assertFileDoesNotExist(Hyde::path('bar'));
}

public function test_get_model_source_path_method_returns_path_for_model_classes()
{
$this->assertEquals(
Hyde::path('_posts'),
Hyde::getModelSourcePath(MarkdownPost::class)
);

$this->assertEquals(
Hyde::path('_pages'),
Hyde::getModelSourcePath(MarkdownPage::class)
);

$this->assertEquals(
Hyde::path('_docs'),
Hyde::getModelSourcePath(DocumentationPage::class)
);

$this->assertEquals(
Hyde::path('_pages'),
Hyde::getModelSourcePath(BladePage::class)
);
}

public function test_get_model_source_path_method_returns_path_to_file_for_model_classes()
{
$this->assertEquals(
Hyde::path('_posts'.DIRECTORY_SEPARATOR.'foo.md'),
Hyde::getModelSourcePath(MarkdownPost::class, 'foo.md')
);

$this->assertEquals(
Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'),
Hyde::getModelSourcePath(MarkdownPage::class, 'foo.md')
);

$this->assertEquals(
Hyde::path('_docs'.DIRECTORY_SEPARATOR.'foo.md'),
Hyde::getModelSourcePath(DocumentationPage::class, 'foo.md')
);

$this->assertEquals(
Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'),
Hyde::getModelSourcePath(BladePage::class, 'foo.md')
);
}

public function test_helper_for_blade_pages()
{
$this->assertEquals(
Hyde::path('_pages'),
Hyde::getBladePagePath()
);
}

public function test_helper_for_markdown_pages()
{
$this->assertEquals(
Hyde::path('_pages'),
Hyde::getMarkdownPagePath()
);
}

public function test_helper_for_markdown_posts()
{
$this->assertEquals(
Hyde::path('_posts'),
Hyde::getMarkdownPostPath()
);
}

public function test_helper_for_documentation_pages()
{
$this->assertEquals(
Hyde::path('_docs'),
Hyde::getDocumentationPagePath()
);
}

public function test_helper_for_site_output_path()
{
$this->assertEquals(
Hyde::path('_site'),
Hyde::getSiteOutputPath()
);
}

public function test_helper_for_site_output_path_returns_path_to_file_within_the_directory()
{
$this->assertEquals(
Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'),
Hyde::getSiteOutputPath('foo.html')
);
}

public function test_get_site_output_path_returns_absolute_path()
{
$this->assertEquals(
Hyde::path('_site'),
Hyde::getSiteOutputPath()
);
}

public function test_site_output_path_helper_ignores_trailing_slashes()
{
$this->assertEquals(
Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'),
Hyde::getSiteOutputPath('/foo.html/')
);
}

public function test_path_to_relative_helper_decodes_hyde_path_into_relative()
{
$s = DIRECTORY_SEPARATOR;
$this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('foo')));
$this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('/foo/')));
$this->assertEquals('foo.md', Hyde::pathToRelative(Hyde::path('foo.md')));
$this->assertEquals("foo{$s}bar", Hyde::pathToRelative(Hyde::path("foo{$s}bar")));
$this->assertEquals("foo{$s}bar.md", Hyde::pathToRelative(Hyde::path("foo{$s}bar.md")));
}

public function test_path_to_relative_helper_does_not_modify_already_relative_paths()
{
$this->assertEquals('foo', Hyde::pathToRelative('foo'));
$this->assertEquals('foo/', Hyde::pathToRelative('foo/'));
$this->assertEquals('../foo', Hyde::pathToRelative('../foo'));
$this->assertEquals('../foo/', Hyde::pathToRelative('../foo/'));
$this->assertEquals('foo.md', Hyde::pathToRelative('foo.md'));
$this->assertEquals('foo/bar', Hyde::pathToRelative('foo/bar'));
$this->assertEquals('foo/bar.md', Hyde::pathToRelative('foo/bar.md'));
}

public function test_path_to_relative_helper_does_not_modify_non_project_paths()
{
$testStrings = [
'C:\Documents\Newsletters\Summer2018.pdf',
'\Program Files\Custom Utilities\StringFinder.exe',
'2018\January.xlsx',
'..\Publications\TravelBrochure.pdf',
'C:\Projects\library\library.sln',
'C:Projects\library\library.sln',
'/home/seth/Pictures/penguin.jpg',
'~/Pictures/penguin.jpg',
];

foreach ($testStrings as $testString) {
$this->assertEquals(
$this->systemPath(($testString)),
Hyde::pathToRelative(
$this->systemPath($testString)
)
);
}
}

protected function systemPath(string $path): string
{
return str_replace('/', DIRECTORY_SEPARATOR, $path);
}
}

This file was deleted.

1 change: 0 additions & 1 deletion packages/realtime-compiler/src/Routing/PageRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected function normalizePath(string $path): string

protected function getHtml(PageContract $page): string
{
// todo add caching as we don't need to recompile pages that have not changed
return file_get_contents((new StaticPageBuilder($page))->__invoke());
}

Expand Down

0 comments on commit 163b389

Please sign in to comment.