Skip to content

Commit

Permalink
Reuse .build instead of adding a new file
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Sep 18, 2023
1 parent 032f625 commit aee35dc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ex_doc/formatter/epub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defmodule ExDoc.Formatter.EPUB do

defp create_output_dir(root, config) do
File.mkdir_p!(Path.join(config.output, "OEBPS"))
File.touch!(Path.join(root, ".ex_doc"))
File.touch!(Path.join(root, ".build"))
end

defp cleanup_output_dir(docs_root, config) do
Expand Down
4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ defmodule ExDoc.Formatter.HTML do
end

def setup_output(root, cleanup, create) do
safety_path = Path.join(root, ".ex_doc")
safety_path = Path.join(root, ".build")

cond do
File.exists?(safety_path) and File.exists?(root) ->
Expand Down Expand Up @@ -187,7 +187,7 @@ defmodule ExDoc.Formatter.HTML do
end

defp add_safety_file(root) do
File.touch!(Path.join(root, ".ex_doc"))
File.touch!(Path.join(root, ".build"))
end

defp cleanup_output_dir(docs_root, config) do
Expand Down
2 changes: 1 addition & 1 deletion test/ex_doc/formatter/html/erlang_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule ExDoc.Formatter.HTML.ErlangTest do
setup %{tmp_dir: tmp_dir} do
output = tmp_dir <> "/doc"
File.mkdir!(output)
File.touch!("#{output}/.ex_doc")
File.touch!("#{output}/.build")
end

test "smoke test", c do
Expand Down
2 changes: 1 addition & 1 deletion test/ex_doc/formatter/html/search_data_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule ExDoc.Formatter.HTML.SearchDataTest do
setup %{tmp_dir: tmp_dir} do
output = tmp_dir <> "/doc"
File.mkdir!(output)
File.touch!("#{output}/.ex_doc")
File.touch!("#{output}/.build")
end

test "Elixir module", c do
Expand Down
2 changes: 1 addition & 1 deletion test/ex_doc/formatter/html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule ExDoc.Formatter.HTMLTest do
setup %{tmp_dir: tmp_dir} do
output = tmp_dir <> "/html"
File.mkdir_p!(output)
File.touch!(output <> "/.ex_doc")
File.touch!(output <> "/.build")
end

defp read_wildcard!(path) do
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule TestHelper do

output_dir = context.tmp_dir <> "/html"
File.mkdir_p!(output_dir)
File.write!(output_dir <> "/.ex_doc", "")
File.write!(output_dir <> "/.build", "")

src_path = Path.join([dir, filename])
src_path |> Path.dirname() |> File.mkdir_p!()
Expand Down

0 comments on commit aee35dc

Please sign in to comment.