mix belodon.create (belodon v0.3.0)
View SourceGenerate boilerplate solution and test files for a specific puzzle based on the given year, day and module prefix.
This Mix task creates two files:
- A solution file under
lib/year<YEAR>/day<DAY>.ex, which defines a module for the puzzle's solution. - A test file under
test/year<YEAR>/day<DAY>_test.exs, which provides a starting point for testing the solution.
Command-Line parameters
--year(-y): Specifies the target year for the puzzle. Defaults to the environment variableBELODON_TEST_YEAR.--day(-d): Specifies the target day for the puzzle. Defaults to the environment variableBELODON_TEST_DAY.--module(-m): Specifies the module prefix to be used for the generated modules. Defaults to the environment variableBELODON_TEST_MODULE.
Examples
To create files for the puzzle corresponding to year 2024 and day 25 with
a module prefix of MyCoolModule, you can run:
$ mix belodon.create --year 2024 --day 25 --module MyCoolModule
# Alternate invocation using short options
$ mix belodon.create -y 2024 -d 25 -m MyCoolModule
This will generate:
- A solution file:
lib/year2024/day25.excontaining the moduleMyCoolModule.Year2024.Day25. - A test file:
lib/year2024/day25_test.exscontaining the tests for the solution.