reck 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -74
  3. data/lib/reck.rb +16 -1
  4. data/lib/reck/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e42763c73766c0f37b6d11774d0ae7d4c090e933142a293ab4fa8020fbc115c3
4
- data.tar.gz: 0b34320493ef0739d2bbe5c6c21ae2bd28b02c823de789172f302f5bd930f884
3
+ metadata.gz: c9e41fabc8f64172e6a876965805f8809f023d6a69a4c72658fab8e5ad5e7a7f
4
+ data.tar.gz: a7728943273b489293f1427c7a13d39527ebd7e401dccc91b4c52131583f0434
5
5
  SHA512:
6
- metadata.gz: 605e3033cafec280edff30012a1214ed09df89c012488f7a762ce63014410a668a7f20742899898681b538ae84a84d52207965fcdc12996720d187fe1078f5d1
7
- data.tar.gz: 70bcdc64891926d594082827225d43bf29c3490cb095478b5b1656784a73d4f0da64382073ac3ad43c13800fcd165eff707b6d71c0d253de80204ba7befeedd2
6
+ metadata.gz: b223feb28dc8c6e0f4a0dcbeacb529bab88cfc115a8ec9152e6df508835221e4145455c4146c45a1d2609e1e3f7cd948024be02554b137049a0a35af6ba7101d
7
+ data.tar.gz: d471b6fb88845324c7ae227e4e94ff1a00c2727fa1684e5d57d8728533444e02c1e4d919d66691256efa120173b2704545f8ec2726264cd505d448d7724f3295
data/README.md CHANGED
@@ -2,20 +2,22 @@
2
2
 
3
3
  An exception-based web framework for Ruby.
4
4
 
5
- # Why another framework?
5
+ [![Build Status](https://travis-ci.org/honeybadger-io/reck.svg?branch=master)](https://travis-ci.org/honeybadger-io/reck)
6
+ [![Gem Version](https://badge.fury.io/rb/reck.svg)](https://badge.fury.io/rb/reck)
7
+
8
+ ---
9
+ :zap: Brought to you by **Honeybadger.io**: Zero-instrumentation, 360 degree
10
+ coverage of errors, outages and service degradation. [Deploy with confidence and
11
+ be your team's devops
12
+ hero!](https://www.honeybadger.io/?utm_source=github&utm_medium=readme&utm_campaign=reck)
13
+ :zap:
6
14
 
7
- If you've ever programmed in Ruby on Rails, you know that it prefers convention
8
- over configuration. We believe this approach works well as a design paradigm but
9
- falls down over time (just ask anyone who has maintained a Rails application
10
- since version 1). In order to remain competitive with newer high-level (and
11
- often concurrent) programming languages like Node and Elixir, Ruby needs a
12
- strong component-based framework which let's you use the *right* tool for the
13
- job.
15
+ # Why another framework?
14
16
 
15
17
  Reck is very light-weight compared to other web frameworks such as Rails
16
- or even Sinatra. We handle the routing and controller layer using a very simple
17
- exception-based DSL and then get out of the way so that any existing model or
18
- view components may be used.
18
+ and Sinatra. We handle the routing layer using a very simple
19
+ exception-based DSL and then get out of the way so that you can use your
20
+ preferred model, view, and controller components.
19
21
 
20
22
  ## Installation
21
23
 
@@ -26,12 +28,12 @@ $ gem install reck
26
28
  ## Usage
27
29
 
28
30
  To respond to the defined route with rendered content, simply raise an
29
- exception. The message of the exception will be evaluated as ERB before being
30
- added to the response. If the exception is raised without a message, a
31
- no-content response will be sent. This exception-based DSL is dead-simple and
32
- great for controlling the flow of your application.
31
+ exception. The message of the exception will be evaluated as ERB before
32
+ being added to the response. If the exception is raised without a message,
33
+ a no-content response will be sent. This exception-based DSL is great for
34
+ controlling the flow of your application.
33
35
 
34
- Routing code to a controller is as simple as:
36
+ Routing is as simple as:
35
37
 
36
38
  ```ruby
37
39
  Reck.route '/' do |request|
@@ -39,7 +41,7 @@ Reck.route '/' do |request|
39
41
  end
40
42
  ```
41
43
 
42
- Want to add authentication? No problem. (Actually, with a single-page app, this *really is* all you need!)
44
+ Want to add authentication? No problem.
43
45
 
44
46
  ```ruby
45
47
  Reck.route '/admin' do |request|
@@ -49,7 +51,7 @@ Reck.route '/admin' do |request|
49
51
  end
50
52
  ```
51
53
 
52
- Since the message of each exception is actually a template, use ERB tags to
54
+ The message of each exception is actually a template. Use ERB tags to
53
55
  interpolate Ruby values in your views:
54
56
 
55
57
  ```ruby
@@ -58,7 +60,7 @@ Reck.route '/version' do |request|
58
60
  end
59
61
  ```
60
62
 
61
- Since Reck depends on Rack, you also have access to helper methods
63
+ Reck depends on Rack. You also have access to helper methods
62
64
  derived from the keys in Rack's env hash:
63
65
 
64
66
  ```ruby
@@ -87,65 +89,42 @@ Each response inherits from the exception `Reck::Response`.
87
89
  ## Handling exceptions
88
90
 
89
91
  While responses should always be raised, you may wish to handle other types of
90
- unexpected exceptions, or "exceptional exceptions", if you will. In these cases,
91
- we recommend using Honeybadger. Honeybadger provides middleware (and a bunch of
92
- other cool features) to catch exceptions in Ruby applications -- whether you're
93
- using Reck, Rails, Sinatra, Rack, or rolling your own Ruby web-framework.
94
-
95
- There are two ways you can get Honeybadger to monitor Reck:
96
-
97
- 1. Reporting errors inside a controller
98
-
99
- ```ruby
100
- require 'reck'
101
- require 'honeybadger'
102
-
103
- Honeybadger.configure do |config|
104
- config.api_key = 'your_api_key'
105
- end
106
-
107
- Reck.route '/oops' do |request|
108
- begin
109
- fail 'oops!'
110
- rescue Reck::Response
111
- raise # Raise the response to the router
112
- rescue => e
113
- # Exceptional Reck exception: report it with Honeybadger!
114
- Honeybadger.notify(e)
115
- end
116
- end
117
- ```
118
-
119
- ```sh
120
- ruby application.rb
121
- ```
92
+ unexpected exceptions, or "exceptional exceptions". In these cases, use
93
+ [Honeybadger](https://www.honeybadger.io/?utm_source=github&utm_medium=readme&utm_campaign=reck).
94
+ Honeybadger provides middleware (and a bunch of other cool features) to monitor
95
+ Ruby applications -- whether you're using Reck, Rails, Sinatra, Rack, or rolling
96
+ your own Ruby web-framework.
122
97
 
123
- 2. Automatically catching all errors which aren't responses
98
+ To monitor Reck for exceptions:
124
99
 
125
- ```ruby
126
- require 'reck/application'
127
- require 'honeybadger'
128
-
129
- Honeybadger.configure do |config|
130
- config.api_key = 'your_api_key'
131
- config.exceptions.ignore << Reck::Response
132
- end
100
+ ```ruby
101
+ # application.rb
102
+ require 'honeybadger'
103
+ require 'reck'
104
+
105
+ Honeybadger.configure do |config|
106
+ config.api_key = 'your_api_key'
107
+ config.report_data = true
108
+ config.exceptions.ignore = [Reck::Response]
109
+ end
133
110
 
134
- Reck.route '/oops' do |request|
135
- fail 'oops!'
136
- end
111
+ use Honeybadger::Rack::ErrorNotifier
137
112
 
138
- use Honeybadger::Rack::ErrorNotifier
113
+ Reck.route '/oops' do |request|
114
+ fail 'oops!'
115
+ end
116
+ ```
139
117
 
140
- run Reck::Application
141
- ```
118
+ Run the server:
142
119
 
143
- ```sh
144
- rackup application.ru
145
- ```
120
+ ```sh
121
+ $ ruby application.rb
122
+ ```
146
123
 
147
124
  Don't forget to replace `'your_api_key'` with the API key from your [project
148
- settings page](https://www.honeybadger.io/) on Honeybadger.
125
+ settings
126
+ page](https://www.honeybadger.io/?utm_source=github&utm_medium=readme&utm_campaign=reck)
127
+ in Honeybadger.
149
128
 
150
129
  ## TODO
151
130
 
@@ -163,8 +142,5 @@ settings page](https://www.honeybadger.io/) on Honeybadger.
163
142
 
164
143
  ## License
165
144
 
166
- Reck is Copyright 2015 © Honeybadger Industries LLC. It is free software, and
145
+ Reck is Copyright 2018 © Honeybadger Industries LLC. It is free software, and
167
146
  may be redistributed under the terms specified in the LICENSE file.
168
-
169
- Brought to you by :zap: **Honeybadger.io**: our kick-ass exception tracking is no joke. :trollface:
170
- [Start exterminating errors in your Ruby apps today](https://www.honeybadger.io/)!
@@ -1,7 +1,22 @@
1
1
  require 'reck/application'
2
2
 
3
+ $middleware = []
4
+
5
+ def use(middleware, *args, &block)
6
+ $middleware << [middleware, args, block]
7
+ end
8
+
3
9
  module Reck
4
10
  at_exit do
5
- Rack::Handler::WEBrick.run Reck::Application
11
+ app = Rack::Builder.new
12
+
13
+ $middleware.each { |c,a,b| app.use(c, *a, &b) }
14
+ app.run(Reck::Application)
15
+
16
+ begin
17
+ Rack::Handler::WEBrick.run(app)
18
+ rescue Interrupt
19
+ # Clean exit
20
+ end
6
21
  end
7
22
  end
@@ -1,3 +1,3 @@
1
1
  module Reck
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC