View Source Magma.Matter.Project (Magma v0.2.0)
Magma.Matter
type behaviour implementation for the project Magma is used for.
It is unique in the sense that there is only one instance of it, corresponding
to the one project for which artefacts are being created. It plays a central
role as its description (in the corresponding Magma.Concept
about this matter)
is included in every prompt.
The single Magma.Concept
for the project can be fetched with the concept/0
function.
Summary
Functions
Returns the project's app name as specified in the mix.exs
file.
Returns the list of Magma.Artefact
types available for a project.
Returns the Magma.Concept
about the project.
Returns the name of the Magma.Concept
document about the project.
Returns the title header text of the Magma.Concept
document about the project.
Returns a list of Obsidian aliases for the Magma.Concept
document about the project.
Returns a default description for the Magma.Concept
about the project.
Extracts the project name from the metadata of a Magma.Concept
document about the project and creates a new instance with it.
Returns all modules of the project as Magma.Matter.Module
s.
Creates a new Magma.Matter.Project
instance from the given name in an ok tuple.
Creates a new Magma.Matter.Project
instance from the given name and fails in error cases.
Returns the title for the description section of the project in artefact prompts.
Returns the base path segment to be used for the document about the project.
Returns the path for Magma.Concept
document about the project.
Renders the YAML frontmatter properties specific for the Magma.Concept
document about the project.
Returns the project's version as specified in the mix.exs
file.
Types
@type t() :: %Magma.Matter.Project{name: term()}
Functions
@spec app_name() :: binary()
Returns the project's app name as specified in the mix.exs
file.
Returns the list of Magma.Artefact
types available for a project.
iex> Magma.Matter.Project.artefacts()
[Magma.Artefacts.Readme]
@spec concept() :: {:ok, Magma.Concept.t()} | {:error, any()}
Returns the Magma.Concept
about the project.
Returns the name of the Magma.Concept
document about the project.
In order to not get in name conflict with any other document (e.g. the document about the top-level module which is usually the project name), and there's only one such matter the project concept is generally called "Project".
Example
iex> "Example"
...> |> Magma.Matter.Project.new!()
...> |> Magma.Matter.Project.concept_name()
"Project"
Returns the title header text of the Magma.Concept
document about the project.
Example
iex> "Example"
...> |> Magma.Matter.Project.new!()
...> |> Magma.Matter.Project.concept_title()
"Example project"
Returns a list of Obsidian aliases for the Magma.Concept
document about the project.
Example
iex> "Example"
...> |> Magma.Matter.Project.new!()
...> |> Magma.Matter.Project.default_concept_aliases()
["Example project", "Example-project"]
Returns a default description for the Magma.Concept
about the project.
Extracts the project name from the metadata of a Magma.Concept
document about the project and creates a new instance with it.
The project name must be specified in the magma_matter_name
YAML frontmatter property.
If the project name is not found, it returns an error.
@spec modules() :: [Magma.Matter.Module.t()]
Returns all modules of the project as Magma.Matter.Module
s.
which are not ignored in terms of Magma.Matter.Module.ignore?/1
@spec new(binary() | [{:name, binary()}]) :: {:ok, t()} | {:error, any()}
@spec new(binary() | [{:name, binary()}]) :: t()
Creates a new Magma.Matter.Project
instance from the given name in an ok tuple.
Creates a new Magma.Matter.Project
instance from the given name and fails in error cases.
Returns the title for the description section of the project in artefact prompts.
Example
iex> "Example"
...> |> Magma.Matter.Project.new!()
...> |> Magma.Matter.Project.prompt_concept_description_title()
"Description of the 'Example' project"
Returns the base path segment to be used for the document about the project.
Since there is just one such matter, and it has a central, this base path is empty, meaning it these documents are placed all at the root of the folders for the different document types.
Returns the path for Magma.Concept
document about the project.
See also concept_name/1
.
Example
iex> "Example"
...> |> Magma.Matter.Project.new!()
...> |> Magma.Matter.Project.relative_concept_path()
"Project.md"
Renders the YAML frontmatter properties specific for the Magma.Concept
document about the project.
In particular this includes magma_matter_name
with the project name.
@spec version() :: binary()
Returns the project's version as specified in the mix.exs
file.