{"id":17925071,"url":"https://github.com/zerowidth/configurable","last_synced_at":"2025-10-14T18:16:26.497Z","repository":{"id":450479,"uuid":"73641","full_name":"zerowidth/configurable","owner":"zerowidth","description":"Easy configuration setup and loading for Ruby modules","archived":false,"fork":false,"pushed_at":"2008-11-09T23:32:03.000Z","size":103,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T01:43:53.239Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/aniero/configurable","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerowidth.png","metadata":{"files":{"readme":"README.txt","changelog":"History.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-11-09T22:39:01.000Z","updated_at":"2019-08-13T13:41:42.000Z","dependencies_parsed_at":"2022-07-04T17:00:59.991Z","dependency_job_id":null,"html_url":"https://github.com/zerowidth/configurable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zerowidth/configurable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fconfigurable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fconfigurable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fconfigurable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fconfigurable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerowidth","download_url":"https://codeload.github.com/zerowidth/configurable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fconfigurable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020349,"owners_count":26086865,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-28T20:52:08.980Z","updated_at":"2025-10-14T18:16:26.482Z","avatar_url":"https://github.com/zerowidth.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"configurable\n    by Nathan Witmer\n    http://zerowidth.com\n    http://github.com/aniero/configurable\n\n== DESCRIPTION:\n\nConfigurable is a simple configuration description and loading mechanism for your modules or classes.\n\nConfigurable makes it easy to set default values for a configuration setup and then easily load and override those default settings. It supports YAML config files, either simple data or environment-based with environment name/value groupings like rails' database.yml.\n\nThis code was extracted from a production framework, where it manages configuration defaults and initialization for a base gem along with several supporting gems which add new features and config settings to the initialization process.\n\n== FEATURES/PROBLEMS:\n\n* Describe defaults, including config file paths and settings\n* Load a configuration from the specified defaults with easy overrides\n* Environment-aware config files, rails-style, so you can have multiple environments in your configuration files\n* Easy to add on additional configuration options from supporting code that need to hook into the config initialization process\n* Access to alternate configurations for settings loaded from environment-based config files\n\n== SYNOPSIS:\n\n  require \"configurable\"\n\n  class MyScript\n    include Configurable\n\n    # set up the defaults\n    default_configuration do |config|\n      config.option :database, \"database.yml\", :config_file =\u003e true\n      config.option :log_level, :info\n      config.option :output_location, \"/tmp\"\n    end\n\n    attr_reader :config\n\n    def initialize(environment, overrides={})\n      # load the configuration using the provided environment and override values\n      @config = self.class.load_configuration(environment, overrides)\n    end\n\n  end\n\n  # simple operation:\n  a = MyScript.new(\"production\")\n  a.config[:database] #=\u003e {\"user\" =\u003e \"bob\", \"host\" =\u003e \"production-db\"...}\n  a.config[:log_level] #=\u003e :info\n\n  # override default settings\n  b = MyScript.new \"production\", :log_level =\u003e :debug, :database =\u003e \"other_db_config.yml\"\n  b.config[:log_level] #=\u003e :debug\n  b.config[:database] #=\u003e {\"user\" =\u003e \"fred\", \"host\" =\u003e \"other-db\" ...}\n\n  # or override the config file settings directly\n  b = MyScript.new \"production\", :database =\u003e {\"user\" =\u003e \"overridden\", \"host\" =\u003e \"owned\"}\n  b.config[:database] #=\u003e {\"user\" =\u003e \"overridden\", \"host\" =\u003e \"owned\"}\n\n  # add a new setting:\n  MyScript.default_configuration { |config| config.option :flag, false }\n  MyScript.new.config[:flag] #=\u003e false\n\n  # retrieve an alternate configuration from an environment-based config file\n  a = MyScript.new(\"production\")\n  a.config[:database] #=\u003e {\"user\" =\u003e \"bob\", \"host\" =\u003e \"production-db\", ...}\n  a.config[:database].alternate(\"development\") #=\u003e {\"user\" =\u003e \"joe\", \"host\" =\u003e \"development-db\", ...}\n\n== REQUIREMENTS:\n\n* mrbones for development\n\n== INSTALL:\n\n  sudo gem install aniero-configurable --source http://gems.github.com\n\n== LICENSE:\n\n(The MIT License)\n\nCopyright (c) 2008 Nathan Witmer\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Fconfigurable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerowidth%2Fconfigurable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Fconfigurable/lists"}