{"id":20936211,"url":"https://github.com/adzerk/frise","last_synced_at":"2025-05-13T21:31:02.446Z","repository":{"id":23826249,"uuid":"99025789","full_name":"adzerk/frise","owner":"adzerk","description":"Ruby config library with schema validation, default values and templating","archived":false,"fork":false,"pushed_at":"2025-04-04T09:03:36.000Z","size":203,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-05T02:36:58.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adzerk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-01T17:19:20.000Z","updated_at":"2024-10-30T13:57:45.000Z","dependencies_parsed_at":"2024-03-20T11:54:13.240Z","dependency_job_id":"6fcc4659-ab89-4b89-a827-5edb7c468ca9","html_url":"https://github.com/adzerk/frise","commit_stats":{"total_commits":106,"total_committers":6,"mean_commits":"17.666666666666668","dds":0.5660377358490566,"last_synced_commit":"24141229de8b90a59d59dfda421b64bb8b820714"},"previous_names":["velocidi/frise"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Ffrise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Ffrise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Ffrise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Ffrise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adzerk","download_url":"https://codeload.github.com/adzerk/frise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254030899,"owners_count":22002670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T22:18:24.383Z","updated_at":"2025-05-13T21:30:59.510Z","avatar_url":"https://github.com/adzerk.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frise\n[![Build Status](https://github.com/adzerk/frise/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/adzerk/frise/actions/workflows/CI.yml)\n[![Coverage Status](https://coveralls.io/repos/github/adzerk/frise/badge.svg?branch=master)](https://coveralls.io/github/adzerk/frise?branch=master)\n[![Gem Version](https://badge.fury.io/rb/frise.svg)](https://badge.fury.io/rb/frise)\n\nFrise is a library for loading configuration files as native Ruby structures. Besides reading and\nparsing the files themselves, it also:\n\n- Allows defining other files to be merged anywhere in the config, which can be used to provide default values specified\n  in another file or set of files;\n- Interprets [Liquid](https://shopify.github.io/liquid) templates in configs and defaults;\n- Validates the loaded config according to a schema file or set of files.\n\n## Install\n\n```\ngem install frise\n```\n\n## Usage\n\n### Basic configs\n\nThe simplest example would be to load [a simple configuration](example/config.yml) from a file:\n\n```ruby\nrequire 'frise'\n\nloader = Frise::Loader.new\nloader.load('example/config.yml')\n# =\u003e {\"movies\"=\u003e\n#     [{\"title\"=\u003e\"The Shawshank Redemption\",\n#       \"year\"=\u003e1994,\n#       \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#       \"rating\"=\u003e9.3},\n#      {\"title\"=\u003e\"The Godfather\",\n#       \"year\"=\u003e1972,\n#       \"director\"=\u003e\"Francis Ford Coppola\",\n#       \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#       \"rating\"=\u003e9.2}]}\n```\n\nCurrently Frise only supports YAML files, but it may support JSON and other formats in the future.\n\n### Default values\n\nBy using the `$include` directive pointing to the files where default values can be found (in this example,\n[example/_defaults/config.yml](example/_defaults/config.yml)), Frise can handle its application internally on load time:\n\n```ruby\nloader.load('example/config_with_defaults.yml')\n# =\u003e {\"movies\"=\u003e\n#     [{\"title\"=\u003e\"The Shawshank Redemption\",\n#       \"year\"=\u003e1994,\n#       \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#       \"rating\"=\u003e9.3,\n#       \"director\"=\u003e\"N/A\"},\n#      {\"title\"=\u003e\"The Godfather\",\n#       \"year\"=\u003e1972,\n#       \"director\"=\u003e\"Francis Ford Coppola\",\n#       \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#       \"rating\"=\u003e9.2}],\n#    \"ui\"=\u003e\n#     {\"default_movie\"=\u003e\"The Shawshank Redemption\",\n#      \"filter_from\"=\u003e1972,\n#      \"filter_to\"=\u003e1994}}\n```\n\nNote that files with default values follow exactly the same structure of the config file itself.\nSpecial values such as `$all` allow users to define default values for all elements of an object or\narray. Liquid templates are also used to define some defaults as a function of other objects of the\nconfig.\n\n### Schemas\n\nAdditionally, configuration files can also be validated against a schema. By specifying\n`$schema` in the config, users can provide schema files such as\n[example/_schemas/config.yml](example/_schemas/config.yml):\n\n```ruby\nloader.load('example/config_with_defaults_and_schema.yml')\n# {\"movies\"=\u003e\n#   [{\"title\"=\u003e\"The Shawshank Redemption\",\n#     \"year\"=\u003e1994,\n#     \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#     \"rating\"=\u003e9.3,\n#     \"director\"=\u003e\"N/A\"},\n#    {\"title\"=\u003e\"The Godfather\",\n#     \"year\"=\u003e1972,\n#     \"director\"=\u003e\"Francis Ford Coppola\",\n#     \"categories\"=\u003e[\"Crime\", \"Drama\"],\n#     \"rating\"=\u003e9.2}],\n#  \"ui\"=\u003e\n#   {\"default_movie\"=\u003e\"The Shawshank Redemption\",\n#    \"filter_from\"=\u003e1972,\n#    \"filter_to\"=\u003e1994}}\n```\n\nIf this config is loaded without the defaults instead, there are now required values that are\nmissing and Frise by default prints a summary of the errors and terminates the program:\n\n\n```ruby\nloader.load('example/config_with_schema.yml')\n# 2 config error(s) found:\n#  - At movies.0.director: missing required value\n#  - At ui: missing required value\n```\n\nOnce more, the structure of the schema mimics the structure of the config itself, making it easy to\nwrite schemas first and create a config scaffold from its schema later.\n\nUsers can check a whole range of properties in config values besides their type: optional values,\nhashes with validated keys, hashes with unknown keys and even custom validations are also supported.\nThe [specification](spec/frise/validator_spec.rb) of the validator provides various examples of\nschemas and describes the behavior of each value (more documentation will be written soon).\n\n### Other features\n\nUsers can also define custom code to be run before defaults and schemas are applied and can even do\neach of the steps separately. Additionally, defaults and schemas can be loaded at a specific path\ninside an existing Ruby object. The [Loader](lib/frise/loader.rb) class provides high-level methods\nto access those features, while lower-level functionality can be accessed through\n[Parser](lib/frise/parser.rb), [DefaultsLoader](lib/frise/defaults_loader.rb) and\n[Validator](lib/frise/validator.rb).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadzerk%2Ffrise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadzerk%2Ffrise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadzerk%2Ffrise/lists"}