Coherence v0.5.2 mix coh.install

Configure the Coherence User Model for your Phoenix application. Coherence is composed of a number of modules that can be enabled with this installer.

This installer will normally do the following unless given an option not to do so:

  • Append the :coherence configuration to your config/config.exs file.
  • Generate appropriate migration files.
  • Generate appropriate view files.
  • Generate appropriate template files.
  • Generate a web/coherence_web.ex file.
  • Generate a web/coherence_messages.ex file.
  • Generate a web/models/user.ex file if one does not already exist.

Install Examples

# Install with only the `authenticatable` option
mix coh.install

# Install all the options except `confirmable` and `invitable`
mix coh.install --full

# Install all the options except `invitable`
mix coh.install --full-confirmable

# Install all the options except `confirmable`
mix coh.install --full-invitable

# Install the `full` options except `lockable` and `trackable`
mix coh.install --full --no-lockable --no-trackable

Reinstall Examples

# Reinstall with defaults (--silent --no-migrations --no-config --confirm-once)
mix coh.install --reinstall

# Confirm to overwrite files, show instructions, and generate migrations
mix coh.install --reinstall --no-confirm-once --with-migrations

Option list

A Coherence configuration will be appended to your config/config.exs file unless the --no-config option is given.

A --model="SomeModule tablename" option can be given to override the default User module.

A --repo=CustomRepo option can be given to override the default Repo module

A --router=CustomRouter option can be given to override the default Router module

A --web-path="lib/my_project/web" option can be given to specify the web path

A --default option will include only authenticatable

A --full option will include options authenticatable, recoverable, lockable, trackable, unlockable_with_token, registerable

A --full-confirmable option will include the --full options in addition to the --confirmable option

A --full-invitable option will include the --full options in addition to the --invitable option

An --authenticatable option provides authentication support to your User model.

A --recoverable option provides the ability to request a password reset email.

A --lockable option provides login locking after too many failed login attempts.

An --unlockable-with-token option provides the ability to request an unlock email.

A --trackable option provides login count, current login timestamp, current login ip, last login timestamp, last login ip in your User model.

A --trackable-table option provides trackable fields in the trackables table.

A --confirmable option provides support for confirmation email before the account can be logged in.

An --invitable option provides support for invitation emails, allowing the new user to create their account including password creation.

A --registerable option provide support for new users to register for an accountA—rememberableoption provide a remember me? check box for persistent logins

A --migration-path option to set the migration path

A --module option to override the module

A --web-module option to override the web module

A --installed-options option to list the previous install options

A --reinstall option to reinstall the coherence boilerplate based on your existing configuration options

A --silent option to disable printing instructions

A --confirm-once option to only confirm overwriting existing files once

A --with-migrations option to reinstall migrations. only valid for —reinstall option

A --layout (false) generate layout template and view

A --user-active-field (false) add active field to user schema and disable logins when set to false.

Disable Options

  • --no-config — Don’t append to your config/config.exs file.
  • --no-web — Don’t create the coherence_web.ex file.
  • --no-messages — Don’t create the coherence_messages.ex file.
  • --no-views — Don’t create the web/views/coherence/ files.
  • --no-migrations — Don’t create the migration files.
  • --no-templates — Don’t create the web/templates/coherence files.
  • --no-boilerplate — Don’t create any of the boilerplate files.
  • --no-models — Don’t generate the model file.
  • --no-confirm — Don’t confirm overwriting files.

Link to this section Summary

Link to this section Functions

Link to this function copy_from(apps, source_dir, target_dir, binding, mapping, config)

Copies files from source dir to target dir according to the given map. Files are evaluated against EEx according to the given binding.

Link to this function find_existing_model(config, path)
Link to this function gen_coherence_templates(config)
Link to this function gen_coherence_views(config)
Link to this function gen_layout_template(config)
Link to this function gen_schema_schema(config, file_name)
Link to this function gen_schemas_module(config)
Link to this function get_config_options(opts)
Link to this function get_config_options(config_opts, opts)
Link to this function list_config_options(acc, opts)

A task needs to implement run which receives a list of command line args.

Callback implementation for Mix.Task.run/1.

Link to this function template_files()