Skip to content

Commit 34ef567

Browse files
authored
Merge pull request #446 from hydephp/handle-todos
Handle todo comments
2 parents 3ad9104 + d4cbe63 commit 34ef567

File tree

6 files changed

+167
-188
lines changed

6 files changed

+167
-188
lines changed

.github/workflows/end-to-end-testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
name: dusk-source
8282
path: _site
8383

84-
# @TODO compile latest hydefront version
84+
# @TODO #444 compile latest hydefront version
8585
- name: Download app.css
8686
uses: actions/download-artifact@v2
8787
with:

.github/workflows/split-monorepo.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
# Split the monorepo into readonly repositories
2-
# TODO: Some way to preserve commit messages? I'd love to get some help here.
3-
# ✔ 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.
4-
# @TODO add all previous commits to the commit message
5-
# @TODO change graceful git error handling to only catch working tree cleanness errors, allowing jobs to fail when it should
6-
# @TODO group similar jobs into matrix
7-
# @TODO merge workflow file into main ci file
82

93
name: 🪓 Split monorepo
104

packages/framework/src/Services/HydeSmartDocs.php

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*
1414
* @experimental 🧪 Subject to change without notice.
1515
*
16+
* @todo #445 Rename to HydeSemanticDocs
17+
*
1618
* @see \Hyde\Framework\Testing\Feature\Services\HydeSmartDocsTest
1719
*/
1820
class HydeSmartDocs

packages/framework/tests/Feature/Foundation/FilesystemTest.php

+164-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
use Hyde\Framework\Foundation\Filesystem;
66
use Hyde\Framework\Hyde;
7+
use Hyde\Framework\Models\Pages\BladePage;
8+
use Hyde\Framework\Models\Pages\DocumentationPage;
9+
use Hyde\Framework\Models\Pages\MarkdownPage;
10+
use Hyde\Framework\Models\Pages\MarkdownPost;
711
use Hyde\Testing\TestCase;
812

913
/**
14+
* @covers \Hyde\Framework\HydeKernel
1015
* @covers \Hyde\Framework\Foundation\Filesystem
11-
*
12-
* @see \Hyde\Framework\Testing\Unit\Foundation\FluentFilesystemModelPathHelpersTest
1316
*/
1417
class FilesystemTest extends TestCase
1518
{
@@ -146,4 +149,163 @@ public function test_unlink_helper_deletes_multiple_files_at_given_paths()
146149
$this->assertFileDoesNotExist(Hyde::path('foo'));
147150
$this->assertFileDoesNotExist(Hyde::path('bar'));
148151
}
152+
153+
public function test_get_model_source_path_method_returns_path_for_model_classes()
154+
{
155+
$this->assertEquals(
156+
Hyde::path('_posts'),
157+
Hyde::getModelSourcePath(MarkdownPost::class)
158+
);
159+
160+
$this->assertEquals(
161+
Hyde::path('_pages'),
162+
Hyde::getModelSourcePath(MarkdownPage::class)
163+
);
164+
165+
$this->assertEquals(
166+
Hyde::path('_docs'),
167+
Hyde::getModelSourcePath(DocumentationPage::class)
168+
);
169+
170+
$this->assertEquals(
171+
Hyde::path('_pages'),
172+
Hyde::getModelSourcePath(BladePage::class)
173+
);
174+
}
175+
176+
public function test_get_model_source_path_method_returns_path_to_file_for_model_classes()
177+
{
178+
$this->assertEquals(
179+
Hyde::path('_posts'.DIRECTORY_SEPARATOR.'foo.md'),
180+
Hyde::getModelSourcePath(MarkdownPost::class, 'foo.md')
181+
);
182+
183+
$this->assertEquals(
184+
Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'),
185+
Hyde::getModelSourcePath(MarkdownPage::class, 'foo.md')
186+
);
187+
188+
$this->assertEquals(
189+
Hyde::path('_docs'.DIRECTORY_SEPARATOR.'foo.md'),
190+
Hyde::getModelSourcePath(DocumentationPage::class, 'foo.md')
191+
);
192+
193+
$this->assertEquals(
194+
Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'),
195+
Hyde::getModelSourcePath(BladePage::class, 'foo.md')
196+
);
197+
}
198+
199+
public function test_helper_for_blade_pages()
200+
{
201+
$this->assertEquals(
202+
Hyde::path('_pages'),
203+
Hyde::getBladePagePath()
204+
);
205+
}
206+
207+
public function test_helper_for_markdown_pages()
208+
{
209+
$this->assertEquals(
210+
Hyde::path('_pages'),
211+
Hyde::getMarkdownPagePath()
212+
);
213+
}
214+
215+
public function test_helper_for_markdown_posts()
216+
{
217+
$this->assertEquals(
218+
Hyde::path('_posts'),
219+
Hyde::getMarkdownPostPath()
220+
);
221+
}
222+
223+
public function test_helper_for_documentation_pages()
224+
{
225+
$this->assertEquals(
226+
Hyde::path('_docs'),
227+
Hyde::getDocumentationPagePath()
228+
);
229+
}
230+
231+
public function test_helper_for_site_output_path()
232+
{
233+
$this->assertEquals(
234+
Hyde::path('_site'),
235+
Hyde::getSiteOutputPath()
236+
);
237+
}
238+
239+
public function test_helper_for_site_output_path_returns_path_to_file_within_the_directory()
240+
{
241+
$this->assertEquals(
242+
Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'),
243+
Hyde::getSiteOutputPath('foo.html')
244+
);
245+
}
246+
247+
public function test_get_site_output_path_returns_absolute_path()
248+
{
249+
$this->assertEquals(
250+
Hyde::path('_site'),
251+
Hyde::getSiteOutputPath()
252+
);
253+
}
254+
255+
public function test_site_output_path_helper_ignores_trailing_slashes()
256+
{
257+
$this->assertEquals(
258+
Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'),
259+
Hyde::getSiteOutputPath('/foo.html/')
260+
);
261+
}
262+
263+
public function test_path_to_relative_helper_decodes_hyde_path_into_relative()
264+
{
265+
$s = DIRECTORY_SEPARATOR;
266+
$this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('foo')));
267+
$this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('/foo/')));
268+
$this->assertEquals('foo.md', Hyde::pathToRelative(Hyde::path('foo.md')));
269+
$this->assertEquals("foo{$s}bar", Hyde::pathToRelative(Hyde::path("foo{$s}bar")));
270+
$this->assertEquals("foo{$s}bar.md", Hyde::pathToRelative(Hyde::path("foo{$s}bar.md")));
271+
}
272+
273+
public function test_path_to_relative_helper_does_not_modify_already_relative_paths()
274+
{
275+
$this->assertEquals('foo', Hyde::pathToRelative('foo'));
276+
$this->assertEquals('foo/', Hyde::pathToRelative('foo/'));
277+
$this->assertEquals('../foo', Hyde::pathToRelative('../foo'));
278+
$this->assertEquals('../foo/', Hyde::pathToRelative('../foo/'));
279+
$this->assertEquals('foo.md', Hyde::pathToRelative('foo.md'));
280+
$this->assertEquals('foo/bar', Hyde::pathToRelative('foo/bar'));
281+
$this->assertEquals('foo/bar.md', Hyde::pathToRelative('foo/bar.md'));
282+
}
283+
284+
public function test_path_to_relative_helper_does_not_modify_non_project_paths()
285+
{
286+
$testStrings = [
287+
'C:\Documents\Newsletters\Summer2018.pdf',
288+
'\Program Files\Custom Utilities\StringFinder.exe',
289+
'2018\January.xlsx',
290+
'..\Publications\TravelBrochure.pdf',
291+
'C:\Projects\library\library.sln',
292+
'C:Projects\library\library.sln',
293+
'/home/seth/Pictures/penguin.jpg',
294+
'~/Pictures/penguin.jpg',
295+
];
296+
297+
foreach ($testStrings as $testString) {
298+
$this->assertEquals(
299+
$this->systemPath(($testString)),
300+
Hyde::pathToRelative(
301+
$this->systemPath($testString)
302+
)
303+
);
304+
}
305+
}
306+
307+
protected function systemPath(string $path): string
308+
{
309+
return str_replace('/', DIRECTORY_SEPARATOR, $path);
310+
}
149311
}

packages/framework/tests/Unit/Foundation/FluentFilesystemModelPathHelpersTest.php

-178
This file was deleted.

packages/realtime-compiler/src/Routing/PageRouter.php

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ protected function normalizePath(string $path): string
5757

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

0 commit comments

Comments
 (0)