Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christhekeele/contingency
A framework agnostic exception catcher and custom error page generator in Ruby.
https://github.com/christhekeele/contingency
Last synced: about 2 months ago
JSON representation
A framework agnostic exception catcher and custom error page generator in Ruby.
- Host: GitHub
- URL: https://github.com/christhekeele/contingency
- Owner: christhekeele
- License: mit
- Created: 2013-04-11T21:47:16.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-15T15:07:15.000Z (over 11 years ago)
- Last Synced: 2024-06-10T00:13:33.532Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 141 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
> "Freedom is the recognition of contingency."
> * *Richard M. Rorty*
Contingency is the custom error page controller you've implemented in every project you've ever written. It's designed to be framework-agnostic and has [many integrations](#supported-integrations) to make using it as easy as calling a config block.
So why implement it yourself again?
It's quick to get started, gives you full customization over Exception coverage, gives you full control over rendering your own error page, and has a contingency plan itself in the event that your custom error views trigger an Exception.
It's also very lightweight: the core functionality (the module in `contingency/plan.rb`) is less than 50 lines; and only adds 3 integration methods, 2 helper methods, and 1 controller action method to your controller. Everything but the controller method is private.
* [Installation](#installation)
* [Configuration](#configuration)
* [Supported Integrations](#supported-integrations)
* [Rails](#rails-integration)
* [Integrating Contingency Yourself](#integrating-contingency-yourself)
* [Integration API](#three-integration-methods)
* [Please Contribute](#please-contribute)
* [Versioning](#versioning)s
* [Contingency Versioning](#contingency-versioning)
* [Integration Versioning](#contingency-integration-versioning)
* [Contributing Integrations](#contributing-integrations)
* [Contributing to Contingency](#contributing-to-contingency)
* [Credits](#credits)
* [Contributers](#contributers)
* [Shout-Outs](#shout-outs)Add this line to your application's Gemfile:
gem 'contingency-my_framework_name', '~> x.0'
...where [`my_framework_name`](#supported-integrations) is the name of your framework, and `x` is the major version of the framework you're using.
Then, execute:
$ bundle
Finally, enable Contingency in whatever object serves as your controller:
include Contingency::Plan
Contingency-Rails uses the same configuration object as Contingency, but has different defaults. Run 'rake contingency:generate:config' to create a highly documented `contingency.rb` file in the root of your project that goes over all configuration options and defaults.
Integration
Integration Quality
Supported Versions
Maintainer
Rails
**Bad**
3.x
christhekeele
**Great** integrations have functional tests and good documentation, **good** integrations only have functional tests, **poor** integrations only have documentaion, and **bad** ones have neither.
If the framework you're using doesn't have a Contingency integration, you're only 3 methods away from integrating it yourself.
If you decide to go through this trouble, you really should consider [contributing your Contingency integration](#contributing-integrations) to Contingency.
Contingency itself is versioned as it changes. It bumps its major version as its API changes, which is rarely, as its public API only requires [3 methods](#three-integration-methods). It uses [symantic versioning](http://http://semver.org/). This means you should safely be able to install it with [loose bundler dependencies](#installation).
Contingency integrations should take their major version number from [their frameworks](#supported-integrations). The rest is up to the maintainer.
See [contingency-rails](https://www.github.com/christhekeele/contingency-rails) as an example.
1. Create a new gem named after your framework (`bundle gem contingency-my_integration`)
1. Add Contingency as a dependency to your gemspec and bundle install
1. Generate an integration template (`bundle exec rake contingency:generate:plan[my_integration]`)
1. Implement the 3 API methods that rake instructs you to
1. Commit your changes (`git commit -am 'Created my_integration'`)
1. Push (`git push origin master`)
1. Create the intital build of your gem (`gem build contingency-my_integration`)
1. Release your gem (`gem push contingency-my_integration.gem`)
1. Revel in the fact that you've provided a Contingency plan for you and yours
1. Follow [the steps below](#contributing-to-contingency) to update this README with links to your Contingency integration
## Contributing to Contingency1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request* None, aside from [the creator](https://www.github.com/christhekeele). [Be the first!](#contributing-to-contingency)!
* Thanks to [ryanb](https://github.com/ryanb), and his subscription-worthy [Railscasts](http://railscasts.com/), which have inspired us all. Especially us [Pro users](http://railscasts.com/pro).