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

feat: renames mix task blend.init to blend.install #30

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end
### 1. Generate `blend.exs`

```
mix blend.init
mix blend.install
```

### 2. Define your blends
Expand Down Expand Up @@ -171,7 +171,7 @@ BLEND=plug_crypto_1 mix phx.server
## Tasks

```
mix blend.init # Generate blend.exs
mix blend.install # Generate blend.exs
mix blend.get # Generate blend lockfiles
mix blend.update --all # Update blend lockfiles to latest possible versions
mix blend.list # List blends
Expand Down
2 changes: 1 addition & 1 deletion lib/blend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Blend do
@premix_file_name "premix.exs"
@premix_file_template File.read!(Path.join(__DIR__, "blend/templates/premix.exs"))

def init do
def install do
case File.read(@blendfile_name) do
{:ok, _} ->
IO.puts("#{@blendfile_name} file already exists, doing nothing")
Expand Down
16 changes: 2 additions & 14 deletions lib/mix/tasks/blend/init.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
defmodule Mix.Tasks.Blend.Init do
@shortdoc "Initializes an empty blend.exs file"

@moduledoc """
A task to generates an empty blend.exs file for you
to define your blends, if you don't yet have one.

It is created with a commented example in it.

```
$ mix blend.init
Successfully created blend.exs file
```
"""
@moduledoc false

use Mix.Task

@impl true
def run(_args) do
Blend.init()
Blend.install()
end
end
22 changes: 22 additions & 0 deletions lib/mix/tasks/blend/install.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule Mix.Tasks.Blend.Install do
@shortdoc "Initializes an empty blend.exs file"

@moduledoc """
A task to generates an empty blend.exs file for you
to define your blends, if you don't yet have one.

It is created with a commented example in it.

```
$ mix blend.install
Successfully created blend.exs file
```
"""

use Mix.Task

@impl true
def run(_args) do
Blend.install()
end
end
4 changes: 2 additions & 2 deletions test/blend_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ defmodule BlendTest do
doctest Blend

@tag :tmp_dir
test "init/0 generates blend file", %{tmp_dir: tmp_dir} do
test "install/0 generates blend file", %{tmp_dir: tmp_dir} do
File.cd!(
tmp_dir,
fn ->
refute File.exists?("blend.exs")
Mix.Task.run("blend.init")
Mix.Task.run("blend.install")
assert File.exists?("blend.exs")
end
)
Expand Down