Automatically clean neotoma-generated erl files
Add myself to THANKS
diff --git a/THANKS b/THANKS
index 0d4b5ac..b4ae84a 100644
--- a/THANKS
+++ b/THANKS
@@ -146,3 +146,4 @@
 Andrey Teplyashin
 Duncan McGreggor
 Sebastien Serre
+John Daily
diff --git a/src/rebar_neotoma_compiler.erl b/src/rebar_neotoma_compiler.erl
index 5549dc4..f93d492 100644
--- a/src/rebar_neotoma_compiler.erl
+++ b/src/rebar_neotoma_compiler.erl
@@ -40,7 +40,7 @@
 %% source_ext: extension of peg source files
 -module(rebar_neotoma_compiler).
 
--export([compile/2]).
+-export([compile/2, clean/2]).
 
 %% for internal use only
 -export([info/2]).
@@ -59,6 +59,20 @@
                             option(module_ext, NeoOpts) ++ ".erl",
                             fun compile_neo/3, [{check_last_mod, true}]).
 
+-spec clean(rebar_config:config(), file:filename()) -> 'ok'.
+clean(Config, _AppFile) ->
+    NeoOpts = neotoma_opts(Config),
+    GeneratedFiles = neotoma_generated_files(
+                       option(out_dir, NeoOpts),
+                       option(module_ext, NeoOpts),
+                       neotoma_source_files(
+                         option(doc_root, NeoOpts),
+                         option(source_ext, NeoOpts)
+                        )
+                      ),
+    ok = rebar_file_utils:delete_each(GeneratedFiles),
+    ok.
+
 %% ============================================================================
 %% Internal functions
 %% ============================================================================
@@ -161,3 +175,20 @@
         _ -> referenced_pegs1(sets:to_list(New), Config,
                               sets:union(New, Seen))
     end.
+
+neotoma_source_files(SrcDir, Ext) ->
+    lists:map(
+      fun filename:basename/1,
+      filelib:wildcard(filename:join([SrcDir, "*" ++ Ext]))
+     ).
+
+
+neotoma_generated_files(OutDir, ModExt, SourceFiles) ->
+    lists:map(
+      fun(PegFile) ->
+              Base = filename:rootname(PegFile),
+              NewName = Base ++ ModExt ++ ".erl",
+              filename:join(OutDir, NewName)
+      end,
+      SourceFiles
+     ).