Skip to content

Commit

Permalink
ensure we return output
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoch-cars committed Sep 20, 2021
1 parent bc0269b commit afb8b51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ex_factor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ defmodule ExFactor do

emplace = Extractor.emplace(opts)
remove = Remover.remove(opts)
_changes = Changer.change(opts)
|> IO.inspect(label: "")
{emplace, remove}
changes = Changer.change(opts)
{emplace, remove, changes}
|> IO.inspect(label: "refactor all changes")
end

def path(module) do
Expand Down
8 changes: 8 additions & 0 deletions lib/ex_factor/extractor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@ defmodule ExFactor.Extractor do

defp write_file(target_path, contents, _module, _dry_run) do
File.write(target_path, contents, [:write])
defp write_file(target_path, contents, module, _dry_run) do
_ = File.write(target_path, contents, [:write])
%{
module: module,
path: target_path,
message: "changes to make",
file_contents: contents
}
end
end
3 changes: 2 additions & 1 deletion lib/ex_factor/remover.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule ExFactor.Remover do
@moduledoc """
Documentation for `ExFactor.Remover`.
"""
alias ExFactor.Util

alias ExFactor.Parser

Expand Down Expand Up @@ -68,7 +69,7 @@ defmodule ExFactor.Remover do
File.write(path, contents, [:write])
end

defp path(module), do: ExFactor.path(module)
defp path(module), do: Util.path(module)

defp function_name(name) when is_binary(name) do
String.to_atom(name)
Expand Down

0 comments on commit afb8b51

Please sign in to comment.