Skip to content

Commit 6658814

Browse files
committed
move lazy_doc under priv dir, release 0.5.2
1 parent 7a7624d commit 6658814

48 files changed

Lines changed: 41 additions & 41 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion

lib/lazy_doc.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule LazyDoc do
1111
It implements functions to read files matching a given path pattern, extract their AST and comments, group function definitions by names and arities, filter out undocumented functions and modules, and retrieve associated documentation for the extracted modules. The module serves as a utility for generating or managing documentation for Elixir projects.
1212
"""
1313

14-
@doc File.read!("lazy_doc/lazy_doc/extract_data_from_files.md")
14+
@doc File.read!("priv/lazy_doc/lazy_doc/extract_data_from_files.md")
1515
def extract_data_from_files() do
1616
patterns =
1717
Application.get_env(:lazy_doc, :patterns, [
@@ -83,7 +83,7 @@ defmodule LazyDoc do
8383
end)
8484
end
8585

86-
@doc File.read!("lazy_doc/lazy_doc/join_code_from_clauses.md")
86+
@doc File.read!("priv/lazy_doc/lazy_doc/join_code_from_clauses.md")
8787
def join_code_from_clauses(names) do
8888
join_code_from_clauses(names, [])
8989
end
@@ -146,7 +146,7 @@ defmodule LazyDoc do
146146
end
147147
end
148148

149-
@doc File.read!("lazy_doc/lazy_doc/extract_names.md")
149+
@doc File.read!("priv/lazy_doc/lazy_doc/extract_names.md")
150150

151151
# TO_DO: support defprotocol and defimpl
152152
def extract_names(ast) do
@@ -253,7 +253,7 @@ defmodule LazyDoc do
253253
acc
254254
end
255255

256-
@doc File.read!("lazy_doc/lazy_doc/filter_undocumented_functions.md")
256+
@doc File.read!("priv/lazy_doc/lazy_doc/filter_undocumented_functions.md")
257257
def filter_undocumented_functions(
258258
{module, module_ast, _code_mod, functions},
259259
{_mod, {_module_doc, function_docs}}
@@ -271,7 +271,7 @@ defmodule LazyDoc do
271271
{module, module_ast, functions}
272272
end
273273

274-
@doc File.read!("lazy_doc/lazy_doc/filter_documented_functions.md")
274+
@doc File.read!("priv/lazy_doc/lazy_doc/filter_documented_functions.md")
275275
def filter_documented_functions(
276276
{module, module_ast, _code_mod, functions},
277277
{_mod, {_module_doc, function_docs}}
@@ -285,7 +285,7 @@ defmodule LazyDoc do
285285
{module, module_ast, functions}
286286
end
287287

288-
@doc File.read!("lazy_doc/lazy_doc/filter_undocumented_modules.md")
288+
@doc File.read!("priv/lazy_doc/lazy_doc/filter_undocumented_modules.md")
289289
def filter_undocumented_modules(zip_to_process) do
290290
Enum.filter(zip_to_process, fn
291291
{_names_module, {_mod, {module_doc, _function_docs}}} ->
@@ -309,7 +309,7 @@ defmodule LazyDoc do
309309
signature: [binary()],
310310
metadata: map()
311311

312-
@doc File.read!("lazy_doc/lazy_doc/docs_per_module.md")
312+
@doc File.read!("priv/lazy_doc/lazy_doc/docs_per_module.md")
313313
def docs_per_module(modules) do
314314
Enum.map(modules, fn module ->
315315
{:docs_v1, _annotation, _beam_language, _format, module_doc, _metadata, function_docs} =
@@ -325,7 +325,7 @@ defmodule LazyDoc do
325325
end)
326326
end
327327

328-
@doc File.read!("lazy_doc/lazy_doc/group_docs_different_arities.md")
328+
@doc File.read!("priv/lazy_doc/lazy_doc/group_docs_different_arities.md")
329329
def group_docs_different_arities(func_docs) do
330330
Enum.group_by(
331331
func_docs,

lib/lazy_doc/application.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule LazyDoc.Application do
1111
"""
1212
use Application
1313

14-
@doc File.read!("lazy_doc/lazy_doc/application/start.md")
14+
@doc File.read!("priv/lazy_doc/lazy_doc/application/start.md")
1515
def start(_start_type, _start_args) do
1616
{:ok, self()}
1717
end

lib/lazy_doc/example.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule LazyDoc.Example do
66
the task provided.
77
"""
88

9-
@doc File.read!("lazy_doc/lazy_doc/example/my_func_2.md")
9+
@doc File.read!("priv/lazy_doc/lazy_doc/example/my_func_2.md")
1010

1111
## This comment is just to ilustrate that the algorithm will
1212
## take the comments
@@ -23,15 +23,15 @@ defmodule LazyDoc.Example do
2323
"is #{inspect(n)}"
2424
end
2525

26-
@doc File.read!("lazy_doc/lazy_doc/example/hello.md")
26+
@doc File.read!("priv/lazy_doc/lazy_doc/example/hello.md")
2727
def hello do
2828
:world
2929
end
3030

31-
@doc File.read!("lazy_doc/lazy_doc/example/func_without_doc.md")
31+
@doc File.read!("priv/lazy_doc/lazy_doc/example/func_without_doc.md")
3232
def func_without_doc(), do: IO.puts("Hello world")
3333

34-
@doc File.read!("lazy_doc/lazy_doc/example/my_func.md")
34+
@doc File.read!("priv/lazy_doc/lazy_doc/example/my_func.md")
3535
def my_func(1) do
3636
"is one"
3737
end

lib/lazy_doc/provider.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ defmodule LazyDoc.Provider do
2424
token :: binary(),
2525
params :: keyword()
2626
) :: {:ok, Req.Response.t()} | {:error, Exception.t()}
27-
@doc File.read!("lazy_doc/lazy_doc/provider/request_prompt.md")
27+
@doc File.read!("priv/lazy_doc/lazy_doc/provider/request_prompt.md")
2828
def request_prompt(callback_module, prompt, model, token, params \\ []),
2929
do: callback_module.request_prompt(prompt, model, token, params)
3030

3131
@callback get_docs_from_response(response :: Req.Response.t()) :: binary()
3232
@spec get_docs_from_response(callback_module :: module(), response :: Req.Response.t()) ::
3333
binary()
34-
@doc File.read!("lazy_doc/lazy_doc/provider/get_docs_from_response.md")
34+
@doc File.read!("priv/lazy_doc/lazy_doc/provider/get_docs_from_response.md")
3535
def get_docs_from_response(callback_module, response),
3636
do: callback_module.get_docs_from_response(response)
3737

3838
@callback model(model :: atom()) :: binary()
3939
@spec model(callback_module :: module(), model :: atom()) :: binary()
40-
@doc File.read!("lazy_doc/lazy_doc/provider/model.md")
40+
@doc File.read!("priv/lazy_doc/lazy_doc/provider/model.md")
4141
def model(callback_module, model), do: callback_module.model(model)
4242

4343
@callback check_parameters?(params :: keyword()) :: boolean()
4444
@spec check_parameters?(callback_module :: module(), params :: keyword()) :: boolean()
45-
@doc File.read!("lazy_doc/lazy_doc/provider/check_parameters?.md")
45+
@doc File.read!("priv/lazy_doc/lazy_doc/provider/check_parameters?.md")
4646
def check_parameters?(callback_module, params), do: callback_module.check_parameters?(params)
4747
end

lib/lazy_doc/providers/github_ai.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ defmodule LazyDoc.Providers.GithubAi do
1717
## TO_DO: implement retry with customizable number of retries if fails but with default value.
1818
@spec request_prompt(binary(), binary(), binary(), keyword()) ::
1919
{:ok, Req.Response.t()} | {:error, Exception.t()}
20-
@doc File.read!("lazy_doc/lazy_doc/providers/github_ai/request_prompt.md")
20+
@doc File.read!("priv/lazy_doc/lazy_doc/providers/github_ai/request_prompt.md")
2121
def request_prompt(prompt, model, token, params \\ []) do
2222
req_query(prompt, model, token, params)
2323
|> Req.post()
2424
end
2525

26-
@doc File.read!("lazy_doc/lazy_doc/providers/github_ai/req_query.md")
26+
@doc File.read!("priv/lazy_doc/lazy_doc/providers/github_ai/req_query.md")
2727
def req_query(prompt, model, token, params \\ []) do
2828
temperature = Keyword.get(params, :temperature, 1)
2929
top_p = Keyword.get(params, :top_p, 1)
@@ -55,15 +55,15 @@ defmodule LazyDoc.Providers.GithubAi do
5555
## TO_DO: we should review if for each model in Github you have the same response format in the body.
5656
## Maybe this premise is not true and it will require changes.
5757
@spec get_docs_from_response(Req.Response.t()) :: binary()
58-
@doc File.read!("lazy_doc/lazy_doc/providers/github_ai/get_docs_from_response.md")
58+
@doc File.read!("priv/lazy_doc/lazy_doc/providers/github_ai/get_docs_from_response.md")
5959
def get_docs_from_response(%Req.Response{body: body} = _response) do
6060
## Take always first choice
6161
message = Enum.at(body["choices"], 0)["message"]["content"]
6262
message
6363
end
6464

6565
@spec model(atom()) :: binary()
66-
@doc File.read!("lazy_doc/lazy_doc/providers/github_ai/model.md")
66+
@doc File.read!("priv/lazy_doc/lazy_doc/providers/github_ai/model.md")
6767
def model(model) do
6868
case model do
6969
:codestral -> "Codestral-2501"
@@ -73,7 +73,7 @@ defmodule LazyDoc.Providers.GithubAi do
7373
end
7474

7575
@spec check_parameters?(params :: keyword()) :: boolean()
76-
@doc File.read!("lazy_doc/lazy_doc/providers/github_ai/check_parameters?.md")
76+
@doc File.read!("priv/lazy_doc/lazy_doc/providers/github_ai/check_parameters?.md")
7777
def check_parameters?(params) do
7878
valid_params = [:max_tokens, :top_p, :temperature]
7979
Enum.map(params, fn {key, _value} -> key in valid_params end) |> Enum.all?()

lib/mix/tasks/lazy_doc.check.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Mix.Tasks.LazyDoc.Check do
1212
require Logger
1313
use Mix.Task
1414

15-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.check/run.md")
15+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.check/run.md")
1616
def run(_command_line_args) do
1717
_result = LazyDoc.Application.start("", "")
1818

@@ -32,7 +32,7 @@ defmodule Mix.Tasks.LazyDoc.Check do
3232
end
3333
end
3434

35-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.check/get_undocumented_functions.md")
35+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.check/get_undocumented_functions.md")
3636
def get_undocumented_functions(entry_functions, file) do
3737
Enum.reduce(entry_functions, [], fn {mod, _mod_ast, functions} = mod_tuple, acc ->
3838
if functions != [] do
@@ -44,7 +44,7 @@ defmodule Mix.Tasks.LazyDoc.Check do
4444
end)
4545
end
4646

47-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.check/print_warnings.md")
47+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.check/print_warnings.md")
4848
def print_warnings(functions, mod, file) do
4949
Enum.each(functions, fn {:function, {name, _code}} ->
5050
Logger.warning("Function :#{name} in module `#{mod}` needs to be documented")
@@ -53,7 +53,7 @@ defmodule Mix.Tasks.LazyDoc.Check do
5353
Logger.info("file: #{file}")
5454
end
5555

56-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.check/get_undocumented_modules.md")
56+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.check/get_undocumented_modules.md")
5757
def get_undocumented_modules(modules, file) do
5858
if modules != [] do
5959
Enum.each(modules, fn {mod, _mod_ast, _cod} ->

lib/mix/tasks/lazy_doc.clean.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Mix.Tasks.LazyDoc.Clean do
1212
require Logger
1313
use Mix.Task
1414

15-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.clean/run.md")
15+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.clean/run.md")
1616
def run(_command_line_args) do
1717
_result = LazyDoc.Application.start("", "")
1818

@@ -41,7 +41,7 @@ defmodule Mix.Tasks.LazyDoc.Clean do
4141
end
4242

4343
## It will work if we suppose @doc is on top of the function.
44-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.clean/delete_doc_from_ast.md")
44+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.clean/delete_doc_from_ast.md")
4545
def delete_doc_from_ast(ast, module_ast, name_func) do
4646
{new_ast, _acc} =
4747
Macro.traverse(
@@ -98,7 +98,7 @@ defmodule Mix.Tasks.LazyDoc.Clean do
9898
new_ast
9999
end
100100

101-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc.clean/clean_tree?.md")
101+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc.clean/clean_tree?.md")
102102
def clean_tree?() do
103103
"git"
104104
|> System.cmd(["diff-files", "--quiet"])

lib/mix/tasks/lazy_doc.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule Mix.Tasks.LazyDoc do
1818

1919
@default_module_prompt ~s(You should describe what this module does based on the code given.\n\n Please do it in the following format given as an example, important do not return the code of the module, your output must be only the docs in the following format.\n\n@moduledoc """\n\n## Main functionality\n\nThe module GithubAi provides a way of communicating with Github AI API.\n\n## Description\n\nIt implements the behavior Provider a standard way to use a provider in LazyDoc.\n"""\n\nModule to document:\n)
2020

21-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/run.md")
21+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/run.md")
2222
def run(_command_line_args) do
2323
## Start req
2424

@@ -35,17 +35,17 @@ defmodule Mix.Tasks.LazyDoc do
3535
|> proccess_files()
3636
end
3737

38-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/docs_are_ok?.md")
38+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/docs_are_ok?.md")
3939
def docs_are_ok?(docs) when is_binary(docs) do
4040
match?("@doc \" " <> _, docs) or match?("@doc \"\"\"\n" <> _, docs)
4141
end
4242

43-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/write_to_file.md")
43+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/write_to_file.md")
4444
def write_to_file(file, ast) do
4545
File.write(file, Macro.to_string(ast))
4646
end
4747

48-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/write_to_file_formatted.md")
48+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/write_to_file_formatted.md")
4949
def write_to_file_formatted(file, ast, comments) do
5050
line_length = Application.get_env(:lazy_doc, :line_length, 98)
5151

@@ -59,7 +59,7 @@ defmodule Mix.Tasks.LazyDoc do
5959
File.write(file, to_write)
6060
end
6161

62-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/insert_doc_for_function.md")
62+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/insert_doc_for_function.md")
6363
def insert_doc_for_function(ast, name_func, ast_doc, module_ast) do
6464
{new_ast, _acc} =
6565
Macro.traverse(
@@ -127,7 +127,7 @@ defmodule Mix.Tasks.LazyDoc do
127127
new_ast
128128
end
129129

130-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/proccess_files.md")
130+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/proccess_files.md")
131131
def proccess_files(entries) do
132132
{provider_mod, model, params} = Application.get_env(:lazy_doc, :provider)
133133

@@ -181,7 +181,7 @@ defmodule Mix.Tasks.LazyDoc do
181181
end)
182182
end
183183

184-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/insert_nodes_in_module.md")
184+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/insert_nodes_in_module.md")
185185
def insert_nodes_in_module(
186186
{module, module_ast, functions},
187187
final_prompt,
@@ -213,7 +213,7 @@ defmodule Mix.Tasks.LazyDoc do
213213
to_string(module.module_info(:compile)[:source])
214214
|> String.split("/lib")
215215
|> Enum.at(1)
216-
|> then(fn path -> "lazy_doc#{path}" end)
216+
|> then(fn path -> "priv/lazy_doc#{path}" end)
217217
|> String.replace(
218218
".ex",
219219
""
@@ -250,7 +250,7 @@ defmodule Mix.Tasks.LazyDoc do
250250
end
251251
end
252252

253-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/docs_to_module_doc_node.md")
253+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/docs_to_module_doc_node.md")
254254
def docs_to_module_doc_node(docs, acc_ast, module_ast) do
255255
result =
256256
Code.string_to_quoted_with_comments(docs,
@@ -269,7 +269,7 @@ defmodule Mix.Tasks.LazyDoc do
269269
end
270270
end
271271

272-
@doc File.read!("lazy_doc/mix/tasks/lazy_doc/insert_module_doc.md")
272+
@doc File.read!("priv/lazy_doc/mix/tasks/lazy_doc/insert_module_doc.md")
273273
def insert_module_doc(ast, module_ast, ast_doc) do
274274
{new_ast, _acc} =
275275
Macro.prewalk(

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule LazyDoc.MixProject do
22
use Mix.Project
33

4-
@version "0.5.1"
4+
@version "0.5.2"
55

66
def project do
77
[

0 commit comments

Comments
 (0)