{"id":23431162,"url":"https://github.com/hasghari/conifer","last_synced_at":"2025-04-12T23:32:56.766Z","repository":{"id":40710580,"uuid":"243108062","full_name":"hasghari/conifer","owner":"hasghari","description":"Easily manage YAML configuration files and import them into your Ruby objects","archived":false,"fork":false,"pushed_at":"2024-11-25T17:16:10.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T10:16:00.259Z","etag":null,"topics":["ruby","yaml-configuration"],"latest_commit_sha":null,"homepage":"","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/hasghari.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-25T21:39:25.000Z","updated_at":"2024-11-25T17:16:15.000Z","dependencies_parsed_at":"2024-04-29T05:31:11.249Z","dependency_job_id":"8cdac5e0-9440-4f29-9e5b-433150c3162d","html_url":"https://github.com/hasghari/conifer","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.32258064516129037","last_synced_commit":"93fcd1268c48ba91eab0f3b49c8eed75235b6b4e"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasghari%2Fconifer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasghari%2Fconifer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasghari%2Fconifer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasghari%2Fconifer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasghari","download_url":"https://codeload.github.com/hasghari/conifer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647257,"owners_count":21139081,"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":["ruby","yaml-configuration"],"created_at":"2024-12-23T09:53:41.207Z","updated_at":"2025-04-12T23:32:56.734Z","avatar_url":"https://github.com/hasghari.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/hasghari/conifer/workflows/Ruby/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/f02c1de9e9d7dbfa5800/maintainability)](https://codeclimate.com/github/hasghari/conifer/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/f02c1de9e9d7dbfa5800/test_coverage)](https://codeclimate.com/github/hasghari/conifer/test_coverage)\n\n# Conifer\n\nConifer allows you to easily manage YAML configuration files and import them into your Ruby objects.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'conifer'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install conifer\n\n## Usage\n\nYou can include the `Conifer` module in any class or module and specify the YAML file you want to import by calling the\n`conifer` method:\n\n```ruby\nclass Config\n  include Conifer\n\n  conifer :config\nend\n```\n\nBy default, this will look for a file called `config.yml` in the same directory where the `Config` class is defined.\nIf no such file is found, it will look for that file in the parent directory. It will continue to traverse the ancestry\ntree until it finds that file. If the file is not found, it will raise a `Conifer::File::NotFoundError` error.\n\nWith the following `config.yml` file defined in the same directory as the source file for `Config`:\n\n```yaml\naws:\n  access_key_id: \u003c%= ENV.fetch('AWS_ACCESS_KEY_ID', 'my-access-key-id') %\u003e\n  bucket: atlantis\n```\n\nYou may access the values using a method that defaults to the same name as your YAML file:\n\n```ruby\nobject = Config.new\nobject.config['aws.access_key_id'] #=\u003e my-access-key-id\nobject.config['aws.bucket'] #=\u003e atlantis\n```\n\nThe `conifer` method accepts several optional keyword arguments:\n\n- `dir`: This option overrides the default location where the YAML file is expected to reside.\n- `method`: This option overrides the default method name that is defined on the class or module. The method name defaults to the name of the YAML file.\n    ```ruby\n    class Config\n      include Conifer\n\n      conifer :config, method: :foobar\n    end\n    ```\n\n    ```ruby\n    Config.new.foobar['aws.bucket'] #=\u003e atlantis\n    ```\n- `prefix`: This is a string that will be prepended to the lookup key. This is especially useful in Rails where you would like to have different values per environment.\n    ```ruby\n    class Config\n      include Conifer\n\n      conifer :config, prefix: Rails.env\n    end\n    ```\n\n    With the following `config.yml` file:\n\n    ```yaml\n    development:\n      aws:\n        bucket: atlantis-development\n\n    production:\n      aws:\n        bucket: atlantis-production\n    ```\n\n    You can lookup the values the same as before:\n\n    ```ruby\n    Rails.env #=\u003e development\n    Config.new.config['aws.bucket'] #=\u003e atlantis-development\n    ```\n- `singleton`: This is `false` by default. When set to `true`, the method will be defined at the class scope instead of the instance scope.\n    ```ruby\n    class Config\n      include Conifer\n\n      conifer :config, singleton: true\n    end\n    ```\n\n    ```ruby\n    Config.config['aws.bucket'] #=\u003e atlantis\n    ```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` 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 tags, 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/hasghari/conifer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\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 Conifer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/conifer/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasghari%2Fconifer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasghari%2Fconifer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasghari%2Fconifer/lists"}