tapestry-cloud / tapestry

PHP static site generator using the plates template system
https://www.tapestry.cloud/
MIT License
32 stars 1 forks source link

Where should source's be stored? #321

Closed carbontwelve closed 6 years ago

carbontwelve commented 6 years ago

While writing the test for TaxonomyArchiveGenerator I stumbled upon a big error in the refactoring so far in that nowhere currently seems to store the actual source object itself. ContentTypes reference them by uid but do not store an actual reference to the object iself.

I was assuming that they would be stored in the graph itself, but again that looks to only be a reference to the uid. Investigate the best place for them to be put, and if they are actually put anywhere at all.

carbontwelve commented 6 years ago

image

Originally adding files to a "registry" was done via the addFile method on the Project. However that was deprecated by bb45e66 (here) with the addSource method replacing it.

Looking at the docbloc for addSource I have written that "all source being added to Project must implement Node interface." All source objects extend AbstractSource which implements the Node interface.

This should mean that each item found within the table property of the Graph should be able to be an AsbtractSource.

This should therefore mean that line 32 of RunContentCollectors should be removed and the act of adding a file to the source graph be done by the ContentType upon bucketing - which is done on line 99 of ContentTypeCollection.

carbontwelve commented 6 years ago

They should be stored in the source graph and were in some tests, but some Steps were still using the deprecated method of source storage.