Example #1
0
 def __init__(self, path=None, clear=False):
     self.path = path or DEFAULT_LOCAL_STORE
     if clear:
         self._clear()
     meta_repo = LocalMetadataRepository(
         os.path.join(self.path, 'metadata.json'))
     artifact_repo = LocalArtifactRepository(
         os.path.join(self.path, 'artifacts'))
     super().__init__(meta_repo, artifact_repo)
Example #2
0
    def local(cls, path=None, clear=False) -> 'Ebonite':
        """
        Get an instance of :class:`~ebonite.Ebonite` that stores metadata and artifacts on local filesystem

        :param path: path to storage dir. If None, `.ebonite` dir is used
        :param clear: if True, erase previous data from storage
        """
        path = path or '.ebonite'
        if clear and os.path.exists(path):
            shutil.rmtree(path)
        meta_repo = LocalMetadataRepository(os.path.join(path, 'metadata.json'))
        artifact_repo = LocalArtifactRepository(os.path.join(path, 'artifacts'))
        return Ebonite(meta_repo, artifact_repo)
Example #3
0
 def inmemory(cls):
     """
     Get an instance of :class:`~ebonite.Ebonite` with inmemory repositories
     """
     return Ebonite(LocalMetadataRepository(), InMemoryArtifactRepository())
Example #4
0
def local_meta(tmpdir):
    yield LocalMetadataRepository(os.path.join(tmpdir, 'db.json'))
Example #5
0
def meta():
    return LocalMetadataRepository()
Example #6
0
def metadata_repo():
    meta = LocalMetadataRepository()
    return meta