aqua v0.9.2 Aqua.Schema.Inject

Link to this section Summary

Functions

Sets Inject to invalid, if the value of project_type is :none

Calculate pathes for injecting file. Pathes for umbrella differs from pathes for flat project

This function populate generic assigns, that will be used inside injected document

Loads LocalTemplate, and stores it inside :template key inside

Identifies the type of a project, on which the mix aqua command is called. Set the valuse inside Inject structure under project_type

Link to this section Types

Link to this type

t()
t() :: %Aqua.Schema.Inject{
  assigns: Map.t(),
  module_name: atom(),
  path: String.t(),
  project_type: :none | :flat | :umbrella,
  raw: String.t(),
  template: any(),
  valid?: :ok | {:error, atom()}
}

Link to this section Functions

Link to this function

assert_in_project(inject)
assert_in_project(Aqua.Schema.Inject.t()) :: Aqua.Schema.Inject.t()

Sets Inject to invalid, if the value of project_type is :none.

If the project_type value is anything else - pathes the Inject struct as is.

Link to this function

calculate_pathes(inject)
calculate_pathes(Aqua.Schema.Inject.t()) :: Aqua.Schema.Inject.t()

Calculate pathes for injecting file. Pathes for umbrella differs from pathes for flat project.

Function will populate:

  • fils-system path of injecting file under :path key;
  • module_name for injecting module under :module_name key;

Calculation is preformed from value of :raw key inside Inject. Raw path can either be file-system OR valid Elixir's module name.

This function as the result either will populate structure with pathes, or invalidate the Inject with well-formed error, if path or Elixir's module name from raw input are invalid for this type of a project and injection.

Link to this function

generate(inject)

Link to this function

generate_assigns(inject, args)

This function populate generic assigns, that will be used inside injected document

Link to this function

load_template(inject, template)
load_template(Aqua.Schema.Inject.t(), any()) :: Aqua.Schema.Inject.t()

Loads LocalTemplate, and stores it inside :template key inside.

Populates errors, that appears during LocalTemplates loading from LocalTemplate struct into Inject struct.

Can return either Inject struct with populated valid LocalTemplate under :template key, or Inject with well-formed error under :valid? key.

Link to this function

set_project_type(inject)
set_project_type(inject :: Aqua.Schema.Inject.t()) :: Aqua.Schema.Inject.t()

Identifies the type of a project, on which the mix aqua command is called. Set the valuse inside Inject structure under project_type.

Project structure can be:

  • :none - we are not inside the project;
  • :flat - we are inside flat [common] project;
  • :umbrella - we are inside umbrella project;