Sha256: 77dcde4f1baa850852252a91068596a001f4a9b8af88cf0a084ed497d7c03d07

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

-module(testgen).

%% API exports
-export([main/1]).

-include("tgen.hrl").

%%====================================================================
%% API functions
%%====================================================================

%% escript Entry point
main([]) ->
    io:format("Searching for git basedir~n"),
    {ok, PWD} = file:get_cwd(),
    case tg_git_tools:find_git(PWD) of
        {ok, GitDir} -> main([GitDir]);
        error -> io:format("No git basedir found, please specifiy manually~n")
    end;
main([GitPath]) ->
    io:format("Using ~s as basepath~n", [GitPath]),
    SpecFiles0 = filelib:wildcard("canonical_data/exercises/*/canonical-data.json", GitPath),
    SpecFiles1 = lists:filtermap(fun filter_by_generator_and_create_record/1, SpecFiles0),
    SpecFiles2 = lists:map(fun(TGen) -> TGen#tgen{path = GitPath ++ "/" ++ TGen#tgen.path, dest = GitPath ++ "/exercises/" ++ TGen#tgen.name} end, SpecFiles1),
    lists:map(fun tgen:generate/1, SpecFiles2).

%%====================================================================
%% Internal functions
%%====================================================================

filter_by_generator_and_create_record(Path) ->
    Name = tg_file_tools:extract_name(Path),
    case tgen:check(Name) of
        {true, Module} ->
            {true, #tgen{
                module = Module,
                name   = Name,
                path   = Path
            }};
        _ -> false
    end.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackler-2.2.1.53 tracks/erlang/testgen/src/testgen.erl
trackler-2.2.1.52 tracks/erlang/testgen/src/testgen.erl
trackler-2.2.1.51 tracks/erlang/testgen/src/testgen.erl