{"id":16431394,"url":"https://github.com/stephencelis/app","last_synced_at":"2025-04-08T03:12:22.746Z","repository":{"id":537078,"uuid":"166484","full_name":"stephencelis/app","owner":"stephencelis","description":"Easy App config.","archived":false,"fork":false,"pushed_at":"2020-10-02T05:30:17.000Z","size":176,"stargazers_count":98,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T18:20:01.802Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephencelis.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.rdoc","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":"2009-04-02T19:37:33.000Z","updated_at":"2024-09-25T09:08:42.000Z","dependencies_parsed_at":"2022-07-07T14:10:18.831Z","dependency_job_id":null,"html_url":"https://github.com/stephencelis/app","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Fapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Fapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Fapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Fapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephencelis","download_url":"https://codeload.github.com/stephencelis/app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"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-10-11T08:30:01.186Z","updated_at":"2025-04-08T03:12:22.717Z","avatar_url":"https://github.com/stephencelis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= App\n\nMove the config out of your app, and into App.\n\n\n== WARNING:\n\nThis release is new, improved, and almost completely incompatible with the\ngem formerly known as App. (See \"What about YAML?\", below.)\n\n\n== K.\n\n=== Rails (3.0)\n\n  % echo 'gem \"app\"' \u003e\u003e Gemfile\n  % bundle install\n  % rails g configurable\n\n\nYou now have App config files at config/app. It will generate an override per\nRails environment.\n\n  # config/app.rb\n  class App \u003c Configurable\n    # Settings in config/app/* take precedence over those specified here.\n\n    # config.key = \"value\"\n\n    config.javascript_expansions = {\n      :prototype     =\u003e \"prototype\"\n      :scriptaculous =\u003e %w(effects dragdrop controls)\n    }\n  end\n\n\nNeed to update those sources for production?\n\n  # config/app/production.rb\n  App.configure do\n    # Settings specified here will take precedence over those in config/app.rb\n\n    # config.key = \"value\"\n\n    ajax_lib_base = \"http://ajax.googleapis.com/ajax/libs\"\n\n    config.javascript_expansions.update({\n      :prototype     =\u003e \"#{ajax_lib_base}/prototype/1.6.1.0/prototype.js\"\n      :scriptaculous =\u003e \"#{ajax_lib_base}/scriptaculous/1.8.3/scriptaculous.js\"\n    })\n  end\n\n\n=== Ruby\n\nApp can be used in any Ruby application. Just bundle (see \"Rails\", above, less\nthe \u003ctt\u003erails g\u003c/tt\u003e) or install the gem.\n\nMake sure \"app\" is required in your environment, and define a class from there.\n\n  class MySite \u003c Configurable\n    config.launched_at = Time.now.utc\n  end\n\n\n== What about YAML?\n\nYAML is great, really, but it just wasn't great beyond simple configuration.\n\nTake that last example. ERB would be required, and still it's cumbersome.\n\n  # app.yml\n  ---\n  launched_at: \u003c%= Time.now.utc.iso8601 %\u003e\n\n\nForget the ISO 8601 formatting and you'll get a string back, instead.\n\nBut that's just the surface. Where you're manipulating the primitive objects\nthat YAML supports most easily, you could have stored complex Ruby objects:\nPathname, Proc, or anything else.\n\n  class App \u003c Configurable\n    config.config_path = Rails.root.join \"config\"\n    config.uptime = Proc.new { (Time.now.utc - App.launched_at).seconds }\n    config.asset_host = ActiveSupport::StringInquirer.new \"amazon\"\n  end\n\n  App.config_path.join(\"app\") # =\u003e #\u003cPathname:config/app\u003e\n  App.uptime.call             # =\u003e 430.198400 seconds\n  App.asset_host.amazon?      # =\u003e true\n\n\nAnd because these configuration files are just class definitions, you can\nwrite your own methods, as well.\n\n  class App \u003c Configurable\n    def self.destroy_sessions!\n      Session.delete_all\n    end\n  end\n\n  App.destroy_sessions! # =\u003e 1\n\n\nIf Ruby can handle it, so can App.\n\nBut OK, OK, there's still an upgrade path:\n\n  class App \u003c Configurable\n    # This must come first.\n    self.config = \u003c\u003cYAML\n  legacy: \u003c%= \"configuration\" %\u003e\n  YAML\n\n    # config.key = \"value\"\n  end\n\n\nThis is not backwards-compatible. This is only to help ease the transition.\nYou will most likely have to upgrade your calls.\n\n\n== LICENSE\n\n(The MIT License)\n\n(c) 2009-2010 Stephen Celis, stephen@stephencelis.com.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Fapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephencelis%2Fapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Fapp/lists"}