blogit v1.0.0 Blogit.RepositoryProviders.Git View Source
This module implements the Blogit.RepositoryProvider behaviour.
It provides access to a git repository which could contain posts as markdown files and blog configuration and styles.
If the git repository is not accessable in the moment the locally checked one will be used and won’t be updated.
The URL to the git remository have to be specified using the :blogit setting :repository_url in the configuration.
The main folder containing the posts could be specified with the :posts_folder setting. By default it is the root of the git repository.
For author of a post markdown file (if not specified manually in the meta data) is used the creator of the file in the git repository. For creation date is used the date of the first commit of the file and for the last update date is used the date of the last commit of the file.
The Blogit.RepositoryProvider.updated_repository implementation does
git pull
before returning the repository representation. The
Blogit.RepositoryProvider.fetch/1 implementation uses git fetch
to check
for deleted, added or updated files.
Link to this section Summary
Functions
Invoked to update the data represented by the given repository
to its most
recent version
Invoked to get the author of the file located at the given file_path
Invoked to get the creation date of the file located at the given
file_path
Checks if a file path is contained in the local version of the repository
Invoked to get the date of the last update of the file located at the given
file_path
Invoked to get a list of file paths of the files contained in the locally downloaded repository
Invoked to get the path to the locally downloaded data
Invoked in order to read the contents of the file located at the given
file_path
Invoked in order to read the contents of the file located at the given
file_path
. If the file could not be read an error is raised
Invoked in order to read the meta data of the file located at the given
file_path
Invoked to get representation structure of the repository the provider manages. This structure can be passed to other callbacs in order to manage files in the repository
Invoked to get a representation structure of the repository the provider manages. All the actual data represented by this structure will be updated to its newest versions first
Link to this section Functions
Invoked to update the data represented by the given repository
to its most
recent version.
If, for example the repository is remote, all the files in it should be downloaded so their most recent versions are accessable.
Callback implementation for Blogit.RepositoryProvider.fetch/1
.
Invoked to get the author of the file located at the given file_path
.
Callback implementation for Blogit.RepositoryProvider.file_author/2
.
Invoked to get the creation date of the file located at the given
file_path
.
Callback implementation for Blogit.RepositoryProvider.file_created_at/2
.
Checks if a file path is contained in the local version of the repository.
Callback implementation for Blogit.RepositoryProvider.file_in?/1
.
Invoked to get the date of the last update of the file located at the given
file_path
.
Callback implementation for Blogit.RepositoryProvider.file_updated_at/2
.
Invoked to get a list of file paths of the files contained in the locally downloaded repository.
Callback implementation for Blogit.RepositoryProvider.local_files/0
.
Invoked to get the path to the locally downloaded data.
Callback implementation for Blogit.RepositoryProvider.local_path/0
.
Invoked in order to read the contents of the file located at the given
file_path
.
The second parameter can be a path to a folder relative to
Blogit.RepositoryProvider.local_path/0 in which the given file_path
should
exist.
Callback implementation for Blogit.RepositoryProvider.read_file/2
.
Invoked in order to read the contents of the file located at the given
file_path
. If the file could not be read an error is raised.
The second parameter can be a path to a folder relative to
Blogit.RepositoryProvider.local_path/0 in which the given file_path
should
exist.
Callback implementation for Blogit.RepositoryProvider.read_file!/2
.
Invoked in order to read the meta data of the file located at the given
file_path
.
The second parameter can be a path to a folder relative to
Blogit.RepositoryProvider.local_path/0 in which the given file_path
should
exist.
Callback implementation for Blogit.RepositoryProvider.read_meta_file/2
.
Invoked to get representation structure of the repository the provider manages. This structure can be passed to other callbacs in order to manage files in the repository.
Callback implementation for Blogit.RepositoryProvider.repository/0
.
Invoked to get a representation structure of the repository the provider manages. All the actual data represented by this structure will be updated to its newest versions first.
If, for example the repository is remote, all the files in it should be downloaded so their most recent versions are accessable.
This structure can be passed to other callbacs in order to manage files in the repository.
Callback implementation for Blogit.RepositoryProvider.updated_repository/0
.