22
22
23
23
init_schemas (App , Config ) ->
24
24
DepsDir = ? config (erlang_mk_depsdir , Config ),
25
- % Note: the schema for the rabbit app is named "rabbitmq.schema"
26
- RabbitSchemaInfo = {DepsDir , rabbit , " rabbitmq.schema" },
27
- RabbitSchema = find_app_schema (RabbitSchemaInfo ),
25
+ RabbitSchema = find_app_schema (rabbit , DepsDir ),
28
26
Schemas = case App of
29
27
rabbit -> [RabbitSchema ];
30
- _ ->
31
- SchemaFileName = atom_to_list (App ) ++ " .schema" ,
32
- SchemaInfo = {DepsDir , App , SchemaFileName },
33
- [RabbitSchema , find_app_schema (SchemaInfo )]
28
+ _ -> [RabbitSchema , find_app_schema (App , DepsDir )]
34
29
end ,
35
30
ct :pal (" Schemas ~p~n " , [Schemas ]),
36
31
SchemaDir = filename :join (? config (data_dir , Config ), " schema" ),
@@ -49,20 +44,21 @@ init_schemas(App, Config) ->
49
44
{conf_snippets , Snippets }
50
45
]).
51
46
52
- find_app_schema ({ DepsDir , App , SchemaFileName } = Info ) ->
53
- SchemaFile = get_schema_for ([DepsDir , App ], SchemaFileName ),
54
- does_schema_exist (filelib :is_regular (SchemaFile ), Info , SchemaFile , cont ).
47
+ find_app_schema (App , DepsDir ) ->
48
+ SchemaFile = get_schema_for ([DepsDir , App ], App ),
49
+ does_schema_exist (filelib :is_regular (SchemaFile ), App , DepsDir , SchemaFile , cont ).
55
50
56
- does_schema_exist (true , _Info , SchemaFile , _ ) ->
51
+ does_schema_exist (true , _App , _DepsDir , SchemaFile , _ ) ->
57
52
SchemaFile ;
58
- does_schema_exist (false , { _ , App , _ } , _SchemaFile , stop ) ->
53
+ does_schema_exist (false , App , _DepsDir , _SchemaFile , stop ) ->
59
54
ct :fail (" Could not find schema for app: ~p~n " , [App ]);
60
- does_schema_exist (false , { DepsDir , _ , SchemaFileName } = Info , _SchemaFile , cont ) ->
55
+ does_schema_exist (false , App , DepsDir , _SchemaFile , cont ) ->
61
56
% If not in umbrella, priv will be at ../priv
62
- SchemaFile = get_schema_for ([DepsDir , " .." ], SchemaFileName ),
63
- does_schema_exist (filelib :is_regular (SchemaFile ), Info , SchemaFile , stop ).
57
+ SchemaFile = get_schema_for ([DepsDir , " .." ], App ),
58
+ does_schema_exist (filelib :is_regular (SchemaFile ), App , DepsDir , SchemaFile , stop ).
64
59
65
- get_schema_for (Prefix , SchemaFileName ) ->
60
+ get_schema_for (Prefix , App ) ->
61
+ SchemaFileName = atom_to_list (App ) ++ " .schema" ,
66
62
filename :join (Prefix ++ [" priv" , " schema" , SchemaFileName ]).
67
63
68
64
copy_to (File , Dir ) ->
0 commit comments