mosaic-errors 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +41 -8
- data/lib/generators/errors_generator.rb +8 -2
- data/lib/generators/templates/controllers/errors_controller.rb +10 -0
- data/{app/views/errors → lib/generators/templates/views}/errors/internal_server_error.html.haml +0 -0
- data/{app/views/errors → lib/generators/templates/views}/errors/not_found.html.haml +0 -0
- data/{app/views/errors → lib/generators/templates/views}/errors/unprocessable_entity.html.haml +0 -0
- data/lib/mosaic/errors/version.rb +1 -1
- metadata +6 -10
- data/app/controllers/errors/application_controller.rb +0 -5
- data/app/controllers/errors/errors_controller.rb +0 -14
- data/app/helpers/errors/application_helper.rb +0 -4
- data/app/views/errors/layouts/application.html +0 -14
- data/config/routes.rb +0 -5
data/README.md
CHANGED
@@ -16,19 +16,52 @@ Then...
|
|
16
16
|
|
17
17
|
Usage
|
18
18
|
-----
|
19
|
+
### Automated installation steps
|
19
20
|
|
20
|
-
|
21
|
+
rails generate errors setup
|
21
22
|
|
22
|
-
|
23
|
+
This will create an Errors controller, views and update routing table.
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
Add to config/routes.rb:
|
27
|
-
|
28
|
-
mount Errors::Engine => "/"
|
25
|
+
### Manual installation steps
|
29
26
|
|
30
27
|
Add to config/application.rb
|
31
28
|
|
32
29
|
config.exceptions_app = self.routes
|
33
30
|
|
34
|
-
|
31
|
+
Create new contoller ErrorsController with following three methods
|
32
|
+
|
33
|
+
class ErrorsController < ApplicationController
|
34
|
+
def internal_server_error
|
35
|
+
end
|
36
|
+
|
37
|
+
def not_found
|
38
|
+
end
|
39
|
+
|
40
|
+
def unprocessable_entity
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
Create an errors directory under app/views.
|
46
|
+
|
47
|
+
Add internal_server_error.html.haml, not_found.html.haml and unprocessable_entity.html.haml with your custom messages.
|
48
|
+
|
49
|
+
Add following to routing table
|
50
|
+
|
51
|
+
match "/404", :to => "errors#not_found"
|
52
|
+
match "/422", :to => "errors#unprocessable_entity"
|
53
|
+
match "/500", :to => "errors#internal_server_error"
|
54
|
+
|
55
|
+
Restart your app.
|
56
|
+
|
57
|
+
To test in your development environment:
|
58
|
+
|
59
|
+
Add to config/environments/development.rb
|
60
|
+
|
61
|
+
config.consider_all_requests_local = false
|
62
|
+
|
63
|
+
Note
|
64
|
+
-----
|
65
|
+
|
66
|
+
Remove 400, 422 and 500 from public directory.
|
67
|
+
|
@@ -1,8 +1,14 @@
|
|
1
1
|
class ErrorsGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path('../templates', __FILE__)
|
2
|
+
source_root File.expand_path('../templates/', __FILE__)
|
3
3
|
|
4
4
|
def setup
|
5
|
-
route "
|
5
|
+
route "/404", :to => "errors#not_found"
|
6
|
+
route "/422", :to => "errors#unprocessable_entity"
|
7
|
+
route "/500", :to => "errors#internal_server_error"
|
8
|
+
|
6
9
|
application "config.exceptions_app = self.routes"
|
10
|
+
|
11
|
+
copy_file 'controllers/errors_controller.rb', 'app/controllers/errors_controller.rb'
|
12
|
+
directory 'views/errors', 'app/views/errors'
|
7
13
|
end
|
8
14
|
end
|
data/{app/views/errors → lib/generators/templates/views}/errors/internal_server_error.html.haml
RENAMED
File without changes
|
File without changes
|
data/{app/views/errors → lib/generators/templates/views}/errors/unprocessable_entity.html.haml
RENAMED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mosaic-errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
@@ -74,17 +74,13 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- VERSION
|
77
|
-
- app/controllers/errors/application_controller.rb
|
78
|
-
- app/controllers/errors/errors_controller.rb
|
79
|
-
- app/helpers/errors/application_helper.rb
|
80
|
-
- app/views/errors/errors/internal_server_error.html.haml
|
81
|
-
- app/views/errors/errors/not_found.html.haml
|
82
|
-
- app/views/errors/errors/unprocessable_entity.html.haml
|
83
|
-
- app/views/errors/layouts/application.html
|
84
|
-
- config/routes.rb
|
85
77
|
- install.rb
|
86
78
|
- lib/generators/USAGE
|
87
79
|
- lib/generators/errors_generator.rb
|
80
|
+
- lib/generators/templates/controllers/errors_controller.rb
|
81
|
+
- lib/generators/templates/views/errors/internal_server_error.html.haml
|
82
|
+
- lib/generators/templates/views/errors/not_found.html.haml
|
83
|
+
- lib/generators/templates/views/errors/unprocessable_entity.html.haml
|
88
84
|
- lib/mosaic-errors.rb
|
89
85
|
- lib/mosaic/errors.rb
|
90
86
|
- lib/mosaic/errors/engine.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Errors</title>
|
5
|
-
<%= stylesheet_link_tag "errors/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "errors/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|