Workspace.Checks.ValidateConfigPath (Workspace v0.2.1)

View Source

Checks that the given path is properly configured

Common use case

This is useful in cases you want to specify a common path for some of your project's artifacts, e.g. deps_path or build_path. This will check that the configuration option of the given project matches the expected path. Notice that the expected path is always considered to be relative to the project's workspace path.

Configuration

  • :config_attribute - Required. The configuration attribute to check. This can either be a single atom or a list of atoms for nested config options.

  • :expected_path - Relative path with respect to the workspace root. This can either be a relative path with respect to workspace root or an anonymous function taking as input a Workspace.Project and returning a dynamic expected path.

Example

In order to configure this check add the following, under checks, in your .workspace.exs:

[
  module: Workspace.Checks.ValidateConfigPath,
  description: "all projects must have a common dependencies path",
  opts: [
    config_attribute: :deps_path,
    expected_path: "artifacts/deps"
  ]
]