{"id":16068094,"url":"https://github.com/ged/ruby-mongrel2","last_synced_at":"2025-08-02T10:13:37.674Z","repository":{"id":27957907,"uuid":"31450830","full_name":"ged/ruby-mongrel2","owner":"ged","description":"Github mirror of Ruby-Mongrel2","archived":false,"fork":false,"pushed_at":"2020-04-09T01:29:35.000Z","size":904,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T10:14:14.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bitbucket.org/ged/ruby-mongrel2","language":"Ruby","has_issues":false,"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/ged.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2015-02-28T04:23:39.000Z","updated_at":"2021-11-28T23:35:03.000Z","dependencies_parsed_at":"2022-08-01T08:49:12.990Z","dependency_job_id":null,"html_url":"https://github.com/ged/ruby-mongrel2","commit_stats":null,"previous_names":[],"tags_count":78,"template":false,"template_full_name":null,"purl":"pkg:github/ged/ruby-mongrel2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fruby-mongrel2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fruby-mongrel2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fruby-mongrel2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fruby-mongrel2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ged","download_url":"https://codeload.github.com/ged/ruby-mongrel2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fruby-mongrel2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268370180,"owners_count":24239766,"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-08-02T02:00:12.353Z","response_time":74,"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-09T06:08:31.195Z","updated_at":"2025-08-02T10:13:37.644Z","avatar_url":"https://github.com/ged.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby-Mongrel2\n\nhome\n: https://hg.sr.ht/~ged/ruby-mongrel2\n\ncode\n: https://hg.sr.ht/~ged/ruby-mongrel2\n\ngithub\n: https://github.com/ged/ruby-mongrel2\n\ndocs\n: https://deveiate.org/code/mongrel2\n\n\n\n## Description\n\nRuby-Mongrel2 is a complete Ruby connector for Mongrel2[http://mongrel2.org/].\n\nThis library includes configuration-database ORM classes, a Ruby\nimplementation of the 'm2sh' tool, a configuration DSL for generating config\ndatabases in pure Ruby, a Control port interface object, and handler classes\nfor creating applications or higher-level frameworks.\n\n\n## Installation and Setup\n\nInstall mongrel2:\n\n    $ {brew,port,portmaster,apt-get install,etc} mongrel2\n\nInstall the mongrel2 gem:\n\n    $ gem install mongrel2\n\nDump a config database generation script into the current working directory:\n\n    $ m2sh.rb bootstrap\n\nEdit the generated file:\n\n    $ $EDITOR config.rb\n\nCreate a config database from the Ruby config:\n\n    $ m2sh.rb load config.rb\n\nStart the server:\n\n    $ m2sh.rb start\n\nOr combine \u003ctt\u003ebootstrap\u003c/tt\u003e, \u003ctt\u003eload\u003c/tt\u003e, and \u003ctt\u003estart\u003c/tt\u003e all into one\ncommand:\n\n    $ m2sh.rb quickstart\n\n\n## Usage\n\nThe library consists of three major parts: the Config ORM classes, the\nHandler classes, and the Control class.\n\n### Config ORM Classes\n\nThere's one class per table like with most ORMs, a Mongrel2::Config::DSL mixin\nfor adding the Ruby configuration DSL to your namespace, and the top-level\nMongrel2::Config class, which manages the database connection, installs the\nschema, etc.\n\nThe ORM classes use Jeremy Hinegardner's 'amalgalite' library, but it will\nalso fall back to using the sqlite3 library instead:\n\n    # Loading the sqlite3 library explicitly\n    $ rspec -rsqlite3 -cfp spec\n    \u003e\u003e\u003e Using SQLite3 1.3.4 for DB access.\n    .....[...]\n\n    Finished in 5.53 seconds\n    102 examples, 0 failures\n\n    # No -rsqlite3 means amalgalite loads first.\n    $ rspec -cfp spec\n    \u003e\u003e\u003e Using Amalgalite 1.1.2 for DB access.\n    .....[...]\n\n    Finished in 3.67 seconds\n    102 examples, 0 failures\n\nFor more detailed documentation, see:\n\n* Mongrel2::Config\n    * Mongrel2::Config::DSL\n    * Mongrel2::Config::Server\n    * Mongrel2::Config::Host\n    * Mongrel2::Config::Route\n    * Mongrel2::Config::Directory\n    * Mongrel2::Config::Proxy\n    * Mongrel2::Config::Handler\n    * Mongrel2::Config::Setting\n    * Mongrel2::Config::Mimetype\n    * Mongrel2::Config::Statistic\n    * Mongrel2::Config::Filter\n    * Mongrel2::Config::Log\n\n\n### Handler Classes\n\nThe main handler class is, unsurprisingly, Mongrel2::Handler. It uses a\nMongrel2::Connection object to talk to the server, wrapping the request data\nup in a Mongrel2::Request object, and expecting a Mongrel2::Response to be\nreturned in response.\n\nThere are specialized Request classes for each of the kinds of requests\nMongrel2 sends:\n\n* Mongrel2::HTTPRequest\n* Mongrel2::JSONRequest\n* Mongrel2::XMLRequest\n* Mongrel2::WebSocket::ClientHandshake\n* Mongrel2::WebSocket::Frame\n\nThese are all {overridable}[rdoc-ref:Mongrel2::Request.register_request_type]\nif you should want a more-specialized class for one of them.\n\nThe Mongrel2::Handler class itself has documentation on how to write your own\nhandlers.\n\n\n### The Control Class\n\nThe Mongrel2::Control class is an object interface to {the Mongrel2 control\nport}[http://mongrel2.org/static/book-finalch4.html#x6-390003.8]. It can be\nused to stop and restart the server, check its status, etc.\n\n\n### Other Classes\n\nThere are a few other classes and modules worth checking out, too:\n\nMongrel2::Table::\n  A hash-like data structure for headers, etc.\nMongrel2::Constants::\n  A collection of convenience constants for Mongrel2 handlers.\nMongrel2::RequestFactory::\n  A factory for generating fixtured requests of various types for testing.\n\n\n## Contributing\n\nYou can check out the current development source with Mercurial via its\n{project page}[https://hg.sr.ht/~ged/ruby-mongrel2]. Or if you\nprefer Git, via {its Github mirror}[https://github.com/ged/ruby-mongrel2].\n\nAfter checking out the source, run:\n\n    $ rake setup\n\nThis task will install any missing dependencies and do any other setup\nnecessary to start development.\n\n\n## Other Implementations\n\nThere are two other Mongrel2 Ruby libraries, +m2r+ +rack-mongrel2+.\nThis implementation differs from them in several ways:\n\n* It doesn't come with a Rack handler, or Rails examples, or anything too\n  fancy. I intend to build my own webby framework bits around Mongrel2, and\n  I thought maybe someone else might want to as well. If you don't, well\n  again, there are two other libraries for you.\n\n* It includes configuration stuff. I want to make tools that use the Mongrel2\n  config database, so I wrote config classes. Sequel::Model made it\n  stupid-easy. There's also a DSL for generating a config database, too,\n  mostly because I found it an interesting exercise, and I like the way it\n  looks.\n\n\n## Authors\n\n* Michael Granger \u003cged@faeriemud.org\u003e\n\n\n## License\n\nCopyright (c) 2011-2020, Michael Granger\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the author/s, nor the names of the project's\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fruby-mongrel2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fged%2Fruby-mongrel2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fruby-mongrel2/lists"}