diff --git a/lib/ex_factor.ex b/lib/ex_factor.ex index 269ca4a..219a25b 100644 --- a/lib/ex_factor.ex +++ b/lib/ex_factor.ex @@ -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 diff --git a/lib/ex_factor/extractor.ex b/lib/ex_factor/extractor.ex index f33e2d6..454194f 100644 --- a/lib/ex_factor/extractor.ex +++ b/lib/ex_factor/extractor.ex @@ -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 diff --git a/lib/ex_factor/remover.ex b/lib/ex_factor/remover.ex index 053adc3..b7b1321 100644 --- a/lib/ex_factor/remover.ex +++ b/lib/ex_factor/remover.ex @@ -2,6 +2,7 @@ defmodule ExFactor.Remover do @moduledoc """ Documentation for `ExFactor.Remover`. """ +alias ExFactor.Util alias ExFactor.Parser @@ -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)