preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Non filesystem store #540

Open djerius opened 7 years ago

djerius commented 7 years ago

This PR adds a new non-filesystem based backend (based on Archive::Tar) as an example and test target. The store tests have been modified so that multiple backends may be tested, and no longer assume that the backend is file system based. The Store API has been cleaned up to make it agnostic to how the backend manages the files.

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 5da8a794aaf530ef7f318ffd4166555695013fe8 on djerius:non-filesystem-store into on preaction:master.

preaction commented 7 years ago

This is a pretty big commit, so I've not yet gotten all the way through it, but a quick question: Are you intending on using this Store in your site? If so, okay, I'll continue reviewing. But if not, there are easier ways to test that the Store API works no matter how you override the methods inside (so, trying to lock down the API).

djerius commented 7 years ago

The actual Store I'm working on uses a version control system as a storage backend. The Archive::Tar store is an exemplar of a non-filesystem store that doesn't require any modules outside of core Perl modules and no external resources, so is easier to incorporate into tests.

I needed something to flush out any assumptions in the Store code about how data was accessed, and the ability to run the Store tests on another implementation was very helpful. For example, it's not obvious from the API that stores can overlap, and that there's a precedence scheme. The tests brought that out.

There are very few changes to the actual Store API; most of the churn is in the tests. The former are worth reviewing. The changes to the tests (other than turning them into roles) were made to isolate them from the storage backend. I think those changes are also valid, although it's harder to see them because of the order of the commits. I can provide a more granular PR which puts them in a clearer context if that would be helpful.

I'm happy to work on a better means of testing the Store API that can be used on alternate Store implementations. What would you suggest?

djerius commented 7 years ago

I'm working on better structuring the commits so it's easier to review. Sorry about the state of this one; it escaped late on a Friday afternoon, and it shows.