Multiple file sources
Closed this issue · 3 comments
Right now, the file source is a git repository via git2. But the analyzer is pretty flexible, and basically just needs to receive a filepath and bytes. So it might be cool to have a trait like FileSource
, which would require an iterator method that returns a path and bytes and a static .open
method
Besides a git repository, another source could be the filesystem.
This could also perhaps lead to multiple binaries -- git-gengo
would analyze a git repository, and gengo
would analyze a directory.
#150 (comment) Different file sources may have utilities that are too specific for a generic FileSource
trait. So it might make more sense to have multiple implementations for multiple file sources.
I also recommend to move the git-specific code into its own submodule to pave the way to one day allow it (and its dependencies) to be turned off. gengo
can compile much faster once gix
isn't in the dependency tree anymore.
Notes based on discussion in #174:
- Allowing sources to define their own overrides with
MySource::with_overrides(overrides)
could be nice, especially for more generic implementations- based on this, some sort of
Overrides::from_gitattributes()
could be nice
- based on this, some sort of