Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: README updates #444

Merged
merged 2 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# ExMachina

[![Circle CI](https://circleci.com/gh/thoughtbot/ex_machina.svg?style=svg&circle-token=fea4685d4951936734e764796c4b37c3686cdab3)](https://circleci.com/gh/thoughtbot/ex_machina)

**ExMachina is part of the [thoughtbot Elixir family][elixir-phoenix] of projects.**
[![Continuous Integration](https://github.com/beam-community/ex_machina/actions/workflows/ci.yaml/badge.svg)](https://github.com/beam-community/ex_machina/actions/workflows/ci.yaml)
[![Module Version](https://img.shields.io/hexpm/v/ex_machina.svg)](https://hex.pm/packages/ex_machina)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/ex_machina/)
[![Total Download](https://img.shields.io/hexpm/dt/ex_machina.svg)](https://hex.pm/packages/ex_machina)
[![License](https://img.shields.io/hexpm/l/ex_machina.svg)](https://github.com/beam-community/ex_machina/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/beam-community/ex_machina.svg)](https://github.com/beam-community/ex_machina/commits/master)

ExMachina makes it easy to create test data and associations. It works great
with Ecto, but is configurable to work with any persistence library.
Expand All @@ -12,41 +15,17 @@ with Ecto, but is configurable to work with any persistence library.

## Installation

#### To install in all environments (useful for generating seed data in dev/prod):

In `mix.exs`, add the ExMachina dependency:

```elixir
def deps do
# Get the latest from hex.pm. Works with Ecto 3.0
[
{:ex_machina, "~> 2.7.0"},
]
end
```

And start the ExMachina application. For most projects (such as
Phoenix apps) this will mean adding `:ex_machina` to the list of applications in
`mix.exs`. You can skip this step if you are using Elixir 1.4 or later.

```elixir
def application do
[mod: {MyApp, []},
applications: [:ex_machina, :other_apps...]]
end
```

#### Install in just the test environment with Phoenix:

In `mix.exs`, add the ExMachina dependency:

<!-- {x-release-please-start-version} -->
```elixir
btkostner marked this conversation as resolved.
Show resolved Hide resolved
def deps do
[
{:ex_machina, "~> 2.7.0", only: :test},
]
end
```
<!-- {x-release-please-end} -->

Add your factory module inside `test/support` so that it is only compiled in the
test environment.
Expand All @@ -58,7 +37,7 @@ ExUnit.start:
{:ok, _} = Application.ensure_all_started(:ex_machina)
```

#### Install in just the test environment for non-Phoenix projects:
#### Install in just the test environment for non-Phoenix projects

You will follow the same instructions as above, but you will also need to add
`test/support` to your compilation paths (elixirc_paths) if you have not done
Expand Down Expand Up @@ -494,10 +473,10 @@ MyApp.Factory.json_encode(:user)

Before opening a pull request, please open an issue first.

$ git clone https://github.com/thoughtbot/ex_machina.git
$ cd ex_machina
$ mix deps.get
$ mix test
git clone https://github.com/thoughtbot/ex_machina.git
cd ex_machina
mix deps.get
mix test

Once you've made your additions and `mix test` passes, go ahead and open a PR!

Expand Down
Loading