YukiHelper.Config (YukiHelper v0.2.0) View Source

Provides the module and struct related to config files.

Loading config files are the following:

  1. ~/.yukihelper.config.yml
  2. ~/.config/yukihelper/.config.yml
  3. ./yuki_helper.config.yml

If there are multiple configuration filles, any same option is overridden.

Configuration File

# .yuki_helper.default.config.yml
#
# Configures about languages.
#
languages:
  # Specifies default language using on testing.
  # If `null`, default to `elixir`.
  primary: null
  #
  # Configure each languages.
  # `source_directory`: if `nil`, finds a source file from `./lib` and `./src`.
  # `path`: is optional.
  # `compiler_path`: set value if there is difference between `path` and `compiler_path`.
  # `prefix`: is optional.
  #
  elixir:
    # If `null`, finds a source file from `./lib` and `./src`.
    # If found multiple find, selects first found file. 
    source_directory: null
    # If 'null', solves `elixir` automatically.
    # Because of finding from export path, does not consider any version.
    path: null
    # If 'null', solves `elixirc` automatically.
    # Because of finding from export path, does not consider any version.
    compiler_path: null
    # If 'null', in case problem number is 10, name of source file is `10.ex`.
    # However, in Elixir, relates closely between file name and module name in point of naming rules.
    # In the above, regards module name as `P10`.
    # Strongly recommends to set `prefix` in Elixir.
    prefix: "p"
  c++11:
    source_directory: null
    path: null
    compiler_path: null
    prefix: null
  ruby:
    source_directory: null
    path: null
    compiler_path: null
    prefix: null
#
# Configures about testcase to download.
#
testcase:
  # Positive integer value more than 10.
  # If `bundile` is 100, directory of testcase for problem 10 is `testcase/100/p10`.
  bundle: null
  # Root direcotry of testcases to download
  directory: "testcase"
  # Prefix of testcase `testcase/p10`
  prefix: "p"
#
# Configures about providers to need to login.
# Supports for only YukiCoder in current version.
#
providers:
  yukicoder:
    # Access Token for Yukicoder. Be careful to treat.
    access_token: "your access token"

Link to this section Summary

Functions

Returns cofing files to load.

Returns headers for HTTPoison.

Loads a config file.

Loads all config files with ignoring any error.

Merges two configurations. Prioritizes to select a not nil value as well as possible.

Returns options for HTTPoison.

Link to this section Types

Specs

t() :: %YukiHelper.Config{
  languages: term(),
  providers: term(),
  testcase: term()
}

Link to this section Functions

Specs

config_files() :: [Path.t()]

Returns cofing files to load.

Specs

headers(t()) :: {:ok, list()} | {:error, term()}

Returns headers for HTTPoison.

Specs

headers!(t()) :: list()

Specs

load(Path.t()) :: {:ok, t()} | {:error, term()}

Loads a config file.

Specs

load_all() :: t()

Loads all config files with ignoring any error.

Merges two configurations. Prioritizes to select a not nil value as well as possible.

Specs

new() :: t()

Specs

new(map() | any()) :: t()

Specs

options(t()) :: {:ok, list()} | {:error, term()}

Returns options for HTTPoison.

Specs

options!(t()) :: list()