{"id":15406760,"url":"https://github.com/dannyben/enforce","last_synced_at":"2025-06-14T11:04:22.354Z","repository":{"id":62558080,"uuid":"120082743","full_name":"DannyBen/enforce","owner":"DannyBen","description":"DSL for verifying file/folder content","archived":false,"fork":false,"pushed_at":"2023-03-28T15:38:42.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T11:03:10.172Z","etag":null,"topics":["dsl","gem","ruby","rules-engine"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DannyBen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-02-03T10:51:29.000Z","updated_at":"2023-11-29T12:16:32.000Z","dependencies_parsed_at":"2024-10-19T12:33:20.878Z","dependency_job_id":"c8fa96bd-cbd0-4b3a-a9d0-e36748aded0e","html_url":"https://github.com/DannyBen/enforce","commit_stats":{"total_commits":54,"total_committers":2,"mean_commits":27.0,"dds":"0.37037037037037035","last_synced_commit":"b686cfa2743ac1792ec490ff631d92f7619a68a0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/DannyBen/enforce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fenforce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fenforce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fenforce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fenforce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DannyBen","download_url":"https://codeload.github.com/DannyBen/enforce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fenforce/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259804839,"owners_count":22913901,"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":["dsl","gem","ruby","rules-engine"],"created_at":"2024-10-01T16:25:15.441Z","updated_at":"2025-06-14T11:04:22.328Z","avatar_url":"https://github.com/DannyBen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enforce - A DSL for verifying file/folder content\n\n[![Gem Version](https://badge.fury.io/rb/enforce.svg)](https://badge.fury.io/rb/enforce)\n[![Build Status](https://github.com/DannyBen/enforce/workflows/Test/badge.svg)](https://github.com/DannyBen/enforce/actions?query=workflow%3ATest)\n[![Maintainability](https://api.codeclimate.com/v1/badges/797b00ba3f6291f7b989/maintainability)](https://codeclimate.com/github/DannyBen/enforce/maintainability)\n\n---\n\nCreate globally available DSL scripts to verify the existence of files in\na folder, and the contents of these files.\n\n---\n\n## Install\n\n```\n$ gem install enforce\n```\n\n## Example\n\n[![asciicast](https://asciinema.org/a/bGvwdnrAzrUeHeGvY4UYfIdFZ.png)](https://asciinema.org/a/bGvwdnrAzrUeHeGvY4UYfIdFZ)\n\nAlso see the [example folder](/example).\n\n\n## Usage\n\n1. Create a rules file containing any of the DSL commands below.\n2. Run `$ enforce \u003crules file name\u003e` in the directory you want to test \n   (without the `.rb` extension)\n\nRules files are ruby scripts that are located either in the current directory\nor in your home directory, under `enforce` subdirectory (`~/enforce/*.rb`).\n\nIf you wish to place your rules files elsewhere, set the `ENFORCE_HOME` \nenvironment variable.\n\n## DSL\n\n### File Commands\n\nVerify that a file exists:\n\n```ruby\nfile 'filename'\n```\n\nVerify that a file exists, and has (or doesn't have) some content:\n\n```ruby\nfile 'filename' do\n  text 'any content'\n  no_text 'other content or regex'\n\n  regex /any.regex/\n  no_regex /any.regex/\n\n  line 'line to match, leading and trailing spaces are ignored'\n  no_line 'line to make sure is not in the file'\nend\n```\n\nVerify that a file does not exist:\n\n```ruby\nno_file 'filename'\n```\n\n\n### Folder Commands\n\nVerify that a folder exists:\n\n```ruby\nfolder 'dirname'\n```\n\nVerify that a folder does not exist:\n\n```ruby\nno_folder 'dirname'\n```\n\nVerify that a folder exists, and run additional validations inside it:\n\n```ruby\nfolder 'dirname' do\n  file 'file-inside-dirname'\n  file 'another-file' do\n    text 'some content'\n  end\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fenforce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannyben%2Fenforce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fenforce/lists"}