mosaic-errors 2.0.2 → 2.0.4

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.
data/README.md CHANGED
@@ -16,19 +16,52 @@ Then...
16
16
 
17
17
  Usage
18
18
  -----
19
+ ### Automated installation steps
19
20
 
20
- ### Installation steps
21
+ rails generate errors setup
21
22
 
22
- Add to ApplicationController:
23
+ This will create an Errors controller, views and update routing table.
23
24
 
24
- include Mosaic::Errors
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
- Restart your app.
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 "mount Mosaic::Errors::Engine => '/'"
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
@@ -0,0 +1,10 @@
1
+ class ErrorsController < ApplicationController
2
+ def internal_server_error
3
+ end
4
+
5
+ def not_found
6
+ end
7
+
8
+ def unprocessable_entity
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Mosaic
2
2
  module Errors
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.4"
4
4
  end
5
5
  end
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.2
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-23 00:00:00.000000000 Z
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,5 +0,0 @@
1
- module Errors
2
- class ApplicationController < ActionController::Base
3
-
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- module Errors
2
- class ErrorsController < ApplicationController
3
-
4
- def internal_server_error
5
- end
6
-
7
- def not_found
8
- end
9
-
10
- def unprocessable_entity
11
- end
12
-
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- module Errors
2
- module ApplicationHelper
3
- end
4
- end
@@ -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>
@@ -1,5 +0,0 @@
1
- Mosaic::Errors::Engine.routes.draw do
2
- match "/404", :to => "errors/errors#not_found"
3
- match "/422", :to => "errors/errors#unprocessable_entity"
4
- match "/500", :to => "errors/errors#internal_server_error"
5
- end