forked from wojtekmach/mix_install_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex_doc.exs
42 lines (35 loc) · 801 Bytes
/
ex_doc.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Mix.install(
[
{:ex_doc, "~> 0.28.0"}
],
elixir: "~> 1.13"
)
{:module, module, beam, _} =
defmodule Foo do
@moduledoc """
A module.
"""
@doc """
A function.
"""
def foo do
end
end
tmp_dir = Path.join(System.tmp_dir!(), "mix_install_ex_doc")
beam_path = "#{tmp_dir}/_build/dev/lib/example/ebin/#{module}.beam"
File.mkdir_p!(Path.dirname(beam_path))
File.write!(beam_path, beam)
Hex.start()
defmodule Example.MixProject do
use Mix.Project
def project do
[
app: :example,
version: "1.0.0",
build_path: "#{unquote(tmp_dir)}/_build",
lockfile: "#{unquote(tmp_dir)}/mix.lock",
deps_path: "#{unquote(tmp_dir)}/deps"
]
end
end
Mix.Task.run("docs", ~w(--formatter html --main Foo --output #{tmp_dir}/doc --open))