{"id":18707542,"url":"https://github.com/discourse/mini_yaml","last_synced_at":"2025-04-12T10:24:01.413Z","repository":{"id":56883986,"uuid":"366961840","full_name":"discourse/mini_yaml","owner":"discourse","description":"A toolkit for amending and formatting YAML files","archived":false,"fork":false,"pushed_at":"2021-05-13T08:09:25.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-09T12:15:38.099Z","etag":null,"topics":["rubygem","yaml"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"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/discourse.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-13T06:56:33.000Z","updated_at":"2024-01-19T13:01:23.000Z","dependencies_parsed_at":"2022-08-20T23:40:18.021Z","dependency_job_id":null,"html_url":"https://github.com/discourse/mini_yaml","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmini_yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmini_yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmini_yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmini_yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discourse","download_url":"https://codeload.github.com/discourse/mini_yaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248551487,"owners_count":21123100,"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":["rubygem","yaml"],"created_at":"2024-11-07T12:18:49.139Z","updated_at":"2025-04-12T10:24:01.368Z","avatar_url":"https://github.com/discourse.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MiniYaml\n\nMiniYaml is a toolkit for amending and formatting YAML files.\n\nYou can use it to:\n\n- Enforce predictable and opinionated formatting for all YAML files\n- Amend YAML files programatically while maintaining comments\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'mini_yaml'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install mini_yaml\n\n## Usage\n\n\nTo lint an indevidual file use:\n\n```ruby\nlint-yaml FILENAME\n```\n\nTo amend an existing YAML file use:\n\n```ruby\nyaml = \u003c\u003c~YAML\n  # comment\n  - \"a\"\n  - b\nYAML\n\nlinter = MiniYaml::Linter.new(yaml)\nlinter.contents \u003c\u003c \"c\"\n\nputs linter.dump\n\n```\n\nThis will output:\n\n```\n---\n# comment\n- a\n- b\n- c\n```\n\n## Why not use prettier or some other tool?\n\nmini_yaml is deliberately opinionated. It enforces line length, chooses quoting styles and maintains comments.\n\nPrettier unfortunately is not as opinionated, it will not enforce quoting styles, line length and styles for multiple line strings and so on. This means that you can not rely on it to force consistent styling of YAML in your project.\n\n## Why not use mini-yaml?\n\nMiniYaml is extremely experimental, it includes a \"paranoid\" mode by default which makes it impossible that it will corrupt YAML, that said, it certainly may have bugs and may fail to handle all sorts of YAML files.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/SamSaffron/mini_yaml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/SamSaffron/mini_yaml/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the MiniYaml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/SamSaffron/mini_yaml/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscourse%2Fmini_yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscourse%2Fmini_yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscourse%2Fmini_yaml/lists"}