blogit v1.0.0 Blogit.Models.Configuration View Source

A module for managing and reading the blog configuration.

A repository containing the blog data can also contain an ‘yml’ configuration file. The file should be in the form

title: <title>
sub_title: <a-sub-title-for-the-blog>
logo_path: <path to logo for the blog>
background_image_path: <path to image at the top of the feed as background>
styles_path: <path to css file with custom styles for the blog>

All of these properties are optional and there are defaults for them. For example the default title of the blog is the name of the repository, updated a bit.

Link to this section Summary

Functions

Creates a Configuration structure from a file contents

Checks if the name of the configuration file of the blog is in a list containing updated file names

Link to this section Types

Link to this type string_or_nil() View Source
string_or_nil() :: String.t | nil
Link to this type t() View Source
t() :: %Blogit.Models.Configuration{background_image_path: string_or_nil, logo_path: string_or_nil, styles_path: string_or_nil, sub_title: string_or_nil, title: String.t}

Link to this section Functions

Creates a Configuration structure from a file contents.

The name and the location of the file are read from the configuration of Blogit - the configuration property configuration_file.

If the file doesn’t exist or it is invalid YML file, the structure is creted using the defaults.

The defaults are:

  • title - the name of the repository of the blog.
  • sub_title - nil
  • local_path - nil
  • background_image_path - nil
  • styles_path - nil
Link to this function updated?(updates) View Source
updated?([String.t]) :: boolean

Checks if the name of the configuration file of the blog is in a list containing updated file names.

Examples

iex> Blogit.Models.Configuration.updated?(~w(one.md some_other.md))
false

iex> Blogit.Models.Configuration.updated?(~w(one.md blog.yml))
true