Mate.Driver behaviour (Mate v0.1.1) 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.

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

Executes a command using the driver

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, Mate.Session.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, Mate.Session.t()} | {:error, String.t()}

Copy a file from local to remote

Link to this callback

exec(session, command, args)

View Source

Specs

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

Executes a command using the driver

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.