Skip to content

Commit

Permalink
📝 Move Elixir script docs up to Installation section
Browse files Browse the repository at this point in the history
  • Loading branch information
randycoulman committed Nov 10, 2024
1 parent 9b11818 commit f35d428
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ mode" which runs tests after every file change.

## Installation

The package can be installed by adding `mix_test_interactive` to your list of
dependencies in `mix.exs`:
`mix test.interactive` can be added as a dependency to your project, or it can
be run from an Elixir script without being added to your project.

### Installing as a Dependency

To install `mix test.interactive` as a dependency of your project, making it
available to anyone working in the project, add `mix_test_interactive` to the
list of dependencies in your project's `mix.exs` file:

```elixir
def deps do
Expand All @@ -35,6 +41,31 @@ def deps do
end
```

### Running from an Elixir Script

If you are working on a 3rd-party project, you may not be able to add
`mix test.interactive` as a dependency. In this case, it is possible
to invoke `mix test.interactive` from an Elixir script.

To accomplish this, put the following script somewhere on your PATH and make it
executable.

```elixir
#!/usr/bin/env elixir

Mix.install([
{:mix_test_interactive, "~> 4.1"}
])

MixTestInteractive.run(System.argv())
```

As an example, let's assume you've named the script `mti_exec`.

Now you can `cd` to the project's root directory, and run `mti_exec`. The script
will accept all of `mix_test_interactive`'s [command-line options](#options) and
allow you to use any of its [interactive commands](#interactive-commands).

## Usage

```shell
Expand Down Expand Up @@ -293,29 +324,6 @@ if Mix.env == :dev do
end
```

## Elixir Script Execution

If you are working on a 3rd-party repo, you may not want to add
`mix_text_interactive` as a `mix.exs` dependency. In this case, it is possible
to invoke `mix_test_interactive` from an Elixir script.

Put this executable script somewhere on your PATH. (let's call the script `mti_exec`)

```elixir
#!/usr/bin/env elixir

Mix.install([
{:mix_test_interactive, "~> 4.1"}
])

MixTestInteractive.run(System.argv())
```

Now cd to your project root, and type `mti_exec --help`. The script will accept
`mix_test_interactive` [options](#options) and [interactive
commands](#interactive-commands).


## Compatibility Notes

On Linux you may need to install `inotify-tools`.
Expand Down

0 comments on commit f35d428

Please sign in to comment.