rambulance 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +11 -20
- data/lib/rambulance/railtie.rb +20 -8
- data/lib/rambulance/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e269fee25c5c5b5d087d8d3ef0ff34153dbeda65a6af3fbff3ae7dec07a19a3
|
4
|
+
data.tar.gz: 905fe5bb0bdd960845f068ee9446a5ff3ae3444e14862586045deb8caf702a1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccff6fd760b1f6b3cb8fbd27e5312ac4765beedc9dbb5525915cf5d8f30aac392b4a6c81c853592583e6c6620cf16b7be85db872dd24470886104854fb6af43f
|
7
|
+
data.tar.gz: ba59cd558bc18a510a678e5ac306d2f0970a19882aab85797cf376443e94cb57a7015af47832b0e665020ec32acde67fc5c5cfecf53b94268c5b146cc94c58bc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [v1.0.2](https://github.com/yuki24/rambulance/tree/v1.0.2)
|
2
|
+
|
3
|
+
_<sup>released at 2019-06-06 23:39:38 UTC</sup>_
|
4
|
+
|
5
|
+
#### Fixes
|
6
|
+
|
7
|
+
- Fixes a bug where `ExceptionsApp` is not loaded when action controller is not loaded ([<tt>ec9d9e5</tt>](https://github.com/yuki24/rambulance/commit/ec9d9e5de98eeec501042a0bbb95ae8ac8d7b4e3))
|
8
|
+
|
1
9
|
## [v1.0.1](https://github.com/yuki24/rambulance/tree/v1.0.1)
|
2
10
|
|
3
11
|
_<sup>released at 2019-06-04 16:30:38 UTC</sup>_
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# Rambulance [![Build Status](https://travis-ci.org/yuki24/rambulance.svg?branch=master)](https://travis-ci.org/yuki24/rambulance)
|
1
|
+
# Rambulance [![Build Status](https://travis-ci.org/yuki24/rambulance.svg?branch=master)](https://travis-ci.org/yuki24/rambulance) [![Gem Version](https://badge.fury.io/rb/rambulance.svg)](https://rubygems.org/gems/rambulance)
|
2
2
|
|
3
|
-
|
3
|
+
A simple and safe way to dynamically render error pages for Rails apps.
|
4
4
|
|
5
5
|
## Features
|
6
6
|
|
@@ -10,7 +10,7 @@ Rambulance's exceptions app is simple, skinny and well-tested. It inherits from
|
|
10
10
|
|
11
11
|
### Flexible
|
12
12
|
|
13
|
-
You have full control of
|
13
|
+
You have full control of which error page to show for a specific exception. It also json rendering (perfect for API apps). It even provides a way to create a custom exceptions app.
|
14
14
|
|
15
15
|
### Easy installation and development
|
16
16
|
|
@@ -30,7 +30,7 @@ And then execute:
|
|
30
30
|
$ rails g rambulance:install
|
31
31
|
```
|
32
32
|
|
33
|
-
Rambulance
|
33
|
+
Rambulance's generator can only generate `erb` templates. If you want to use haml or slim templates, please see [How to Convert Your `.erb` to `.slim`](https://github.com/slim-template/slim/wiki/Template-Converters-ERB-to-SLIM) or [html2haml](https://github.com/haml/html2haml).
|
34
34
|
|
35
35
|
Now you can start editing templates like `app/views/errors/not_found.html.erb`. Edit, run `rails server` and open [`localhost:3000/rambulance/not_found`](http://localhost:3000/rambulance/not_found)!
|
36
36
|
|
@@ -56,19 +56,10 @@ config.rescue_responses = {
|
|
56
56
|
|
57
57
|
## Local Development
|
58
58
|
|
59
|
-
There are 2 ways of editing the templates.
|
60
|
-
|
61
|
-
<!---
|
62
|
-
### Open [`localhost:3000/rambulance`](http://localhost:3000/rambulance) in Your Browser
|
63
|
-
|
64
|
-
This page tells all the error pages as well as all the pairs of exceptions/corresponding http status. This is useful when you want to edit templates without changing Rails configuration. Click on one of the links in the page to see what the error page looks like.
|
65
|
-
|
66
|
-
**This feature hasn't been implemented yet.**
|
67
|
-
-->
|
68
|
-
|
69
59
|
### Open `localhost:3000/rambulance/***` in Your Browser
|
70
60
|
|
71
|
-
Just
|
61
|
+
Just open one of the error pages via Rambulance:
|
62
|
+
|
72
63
|
* [`localhost:3000/rambulance/not_found`](http://localhost:3000/rambulance/not_found) or
|
73
64
|
* [`localhost:3000/rambulance/internal_server_error`](http://localhost:3000/rambulance/internal_server_error)
|
74
65
|
|
@@ -92,13 +83,13 @@ If you want to do some more things in a exceptions app, you can also write your
|
|
92
83
|
$ rails g rambulance:exceptions_app
|
93
84
|
```
|
94
85
|
|
95
|
-
It
|
86
|
+
It will generate your own custom exceptions app. You can use whatever techniques you want to use in controllers like `before_filter` and `flash[:notice] = "message..."` since it's a grandchild of `ActionController::Base`!
|
96
87
|
|
97
|
-
**
|
88
|
+
**Heavily customizing the exceptions app is strongly discouraged as there would be no guard against bugs that occur in the exceptions app.**
|
98
89
|
|
99
90
|
## Testing
|
100
91
|
|
101
|
-
|
92
|
+
Rambulance ships with a test helper that allows you to test an error page generated by Rails. All you have to do is to `include Rambulance::TestHelper` and you will be able to use the `with_exceptions_app` DSDL:
|
102
93
|
|
103
94
|
Rspec:
|
104
95
|
|
@@ -132,8 +123,8 @@ Note that testing error pages is not encouraged in Rails as it leads to overuse
|
|
132
123
|
|
133
124
|
## Supported Versions
|
134
125
|
|
135
|
-
* Ruby 2.3, 2,4, 2,5, trunk, JRuby 9.
|
136
|
-
* Rails 4.2, 5.0, 5
|
126
|
+
* Ruby 2.3, 2,4, 2,5, 2.6, trunk, JRuby 9.2, and JRuby head
|
127
|
+
* Rails 4.2, 5.0, 5.1, 5.2, 6.0 and edge
|
137
128
|
|
138
129
|
Rambulance doesn't work with Rails 3.1 and below since they don't provide a way to use a custom exceptions app.
|
139
130
|
|
data/lib/rambulance/railtie.rb
CHANGED
@@ -5,15 +5,27 @@ module Rambulance
|
|
5
5
|
require "rambulance/exceptions_app"
|
6
6
|
end
|
7
7
|
|
8
|
-
app.config.exceptions_app =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
app.config.exceptions_app =
|
9
|
+
if app.config.respond_to?(:autoloader) && app.config.autoloader == :classic
|
10
|
+
->(env) {
|
11
|
+
begin
|
12
|
+
ActiveSupport::Dependencies.load_missing_constant(Object, :ExceptionsApp)
|
13
|
+
::ExceptionsApp.call(env)
|
14
|
+
rescue NameError
|
15
|
+
require "rambulance/exceptions_app" if !defined?(::Rambulance::ExceptionsApp)
|
16
|
+
::Rambulance::ExceptionsApp.call(env)
|
17
|
+
end
|
18
|
+
}
|
19
|
+
else
|
20
|
+
->(env) {
|
21
|
+
begin
|
22
|
+
::ExceptionsApp.call(env)
|
23
|
+
rescue NameError
|
24
|
+
require "rambulance/exceptions_app" if !defined?(::Rambulance::ExceptionsApp)
|
25
|
+
::Rambulance::ExceptionsApp.call(env)
|
26
|
+
end
|
27
|
+
}
|
15
28
|
end
|
16
|
-
}
|
17
29
|
|
18
30
|
ActiveSupport.on_load(:after_initialize) do
|
19
31
|
Rails.application.routes.append do
|
data/lib/rambulance/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rambulance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Nishijima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|