@@ -5,12 +5,10 @@ defmodule Mix.Tasks.Compile.Speck do
55
66 use Mix.Task.Compiler
77
8- @ schema_path Application . compile_env ( :speck , :schema_path , "protocol" )
9- @ manifest_path Path . join ( Mix.Project . app_path , "speck.manifest" )
10-
118 @ impl Mix.Task.Compiler
129 def run ( _args ) do
13- schema_files = Path . wildcard ( "#{ @ schema_path } /**/*.ex" )
10+ schema_path = Application . get_env ( :speck , :schema_path , "protocol" )
11+ schema_files = Path . wildcard ( "#{ schema_path } /**/*.ex" )
1412 hashes = hashes ( schema_files )
1513 manifest = load_manifest ( )
1614
@@ -90,12 +88,16 @@ defmodule Mix.Tasks.Compile.Speck do
9088
9189 @ impl Mix.Task.Compiler
9290 def manifests do
93- [ @ manifest_path ]
91+ [ manifest_path ( ) ]
9492 end
9593
9694 @ impl Mix.Task.Compiler
9795 def clean do
98- File . rm_rf ( @ manifest_path )
96+ File . rm_rf ( manifest_path ( ) )
97+ end
98+
99+ defp manifest_path do
100+ Path . join ( Mix.Project . app_path , "speck.manifest" )
99101 end
100102
101103 defp module_path ( module ) do
@@ -206,15 +208,15 @@ defmodule Mix.Tasks.Compile.Speck do
206208 end
207209
208210 defp load_manifest do
209- case File . read ( @ manifest_path ) do
211+ case File . read ( manifest_path ( ) ) do
210212 { :ok , contents } -> :erlang . binary_to_term ( contents )
211213 { :error , :enoent } -> [ ]
212214 { :error , reason } -> raise "Failed to load manifest: #{ reason } "
213215 end
214216 end
215217
216218 defp save_manifest ( manifest ) do
217- File . write! ( @ manifest_path , :erlang . term_to_binary ( manifest ) )
219+ File . write! ( manifest_path ( ) , :erlang . term_to_binary ( manifest ) )
218220 end
219221
220222 defp coerce ( :date , value ) when is_binary ( value ) do
0 commit comments