Mate.Driver behaviour (Mate v0.1.5) View Source

This is the behaviour for Mate Drivers.

The idea behind supporting multiple drivers is allowing the user to decide how and where they want to build their application. By default is will use the SSH driver, but maybe in the near future there will be other built-in drivers. It is also possible to write your own, of course. For an example I recommend looking at Mate.Driver.SSH.

NOTE: Deployments currently always use the Mate.Driver.SSH.

Link to this section Summary

Callbacks

This one is optional and can be used to close the current connection, cleanup or whatever else might be needed.

Copy a file from remote to local

Copy a file from local to remote

Returns a description of the current host (defaults to context hostname)

Executes a command using the driver

Executes a script using the driver

Prepare source

Starts the driver, for example create an SSH connection, start a docker container, or whatever else might be needed for your new session.

Link to this section Callbacks

Link to this callback

close(session)

View Source (optional)

Specs

close(session :: Mate.Session.t()) :: {:ok, Mate.Session.t()}

This one is optional and can be used to close the current connection, cleanup or whatever else might be needed.

Link to this callback

copy_from(session, src, dest)

View Source

Specs

copy_from(session :: Mate.Session.t(), src :: String.t(), dest :: String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Copy a file from remote to local

Link to this callback

copy_to(session, src, dest)

View Source

Specs

copy_to(session :: Mate.Session.t(), src :: String.t(), dest :: String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Copy a file from local to remote

Link to this callback

current_host(session)

View Source (optional)

Specs

current_host(session :: Mate.Session.t()) :: String.t()

Returns a description of the current host (defaults to context hostname)

Link to this callback

exec(session, command, args)

View Source

Specs

exec(session :: Mate.Session.t(), command :: String.t(), args :: [String.t()]) ::
  {:ok, String.t()} | {:error, String.t()}

Executes a command using the driver

Link to this callback

exec_script(session, script)

View Source

Specs

exec_script(session :: Mate.Session.t(), script :: String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Executes a script using the driver

Link to this callback

prepare_source(session)

View Source (optional)

Specs

prepare_source(session :: Mate.Session.t()) ::
  {:ok, Mate.Session.t()} | {:error, String.t()}

Prepare source

Specs

start(session :: Mate.Session.t(), host :: String.t()) ::
  {:ok, Mate.Session.t()} | {:error, String.t()}

Starts the driver, for example create an SSH connection, start a docker container, or whatever else might be needed for your new session.