gaffe 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ html { font-size: 62.5% }
2
+ * { margin: 0; padding: 0; font-size: 100%; -moz-box-sizing: border-box; box-sizing: border-box; }
3
+
4
+ body {
5
+ font-size: 150%;
6
+ font-family: Helvetica, Arial, sans-serif;
7
+ background: #fafafa;
8
+ font-weight: 300;
9
+ padding: 60px;
10
+ line-height: 1.5;
11
+ }
12
+
13
+ #wrap {
14
+ width: 100%;
15
+ max-width: 700px;
16
+ margin: 0 auto;
17
+ background: #fff;
18
+ padding: 30px;
19
+ box-shadow: 0 0 20px rgba(0,0,0,0.2);
20
+ border-radius: 3px;
21
+ }
22
+
23
+ hr {
24
+ display: none;
25
+ }
26
+
27
+ p {
28
+ margin: 0 0 15px;
29
+ }
30
+
31
+ a {
32
+ color: #F3711B;
33
+ }
34
+
35
+ h1 {
36
+ font-size: 240%;
37
+ margin: 0 0 15px;
38
+ font-weight: 300;
39
+ }
40
+
41
+ .content {
42
+ background: #FFFCE1;
43
+ padding: 15px;
44
+ margin: 15px 0;
45
+ border: 1px solid rgba(0,0,0,0.1);
46
+ }
47
+
48
+ pre {
49
+ background: #fafafa;
50
+ padding: 15px;
51
+ line-height: 1.8;
52
+ color: rgba(0,0,0,0.8);
53
+ border: 1px solid rgba(0,0,0,0.1);
54
+ overflow: auto;
55
+ }
56
+
57
+ pre em {
58
+ font-style: normal;
59
+ color: rgba(0,0,0,0.5);
60
+ }
@@ -1,16 +1,29 @@
1
- <h1>Error!</h1>
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>Error!</title>
6
+ <style type="text/css">
7
+ <%= File.read(File.join(Gaffe.root, 'app/assets/stylesheets/errors.css')).gsub("\n", ' ').gsub(' ', ' ') %>
8
+ </style>
9
+ </head>
10
+ <body>
11
+ <div id="wrap">
12
+ <h1>Error!</h1>
13
+ <p>This is an error page brought to you by <a href="https://github.com/mirego/gaffe">Gaffe</a>.</p>
2
14
 
3
- <p>This is an error page brought to you by <strong>Gaffe</strong>.</p>
15
+ <div class="content">
16
+ <hr>
17
+ <%= yield %>
18
+ <hr>
19
+ </div>
4
20
 
5
- <hr>
6
-
7
- <%= yield %>
8
-
9
- <hr>
10
-
11
- <p>You can overwrite this page by creating these files:</p>
21
+ <p>You can overwrite this page by creating these files:</p>
12
22
 
13
23
  <pre>
14
- <code><%= Rails.root.join('app', 'views', 'layouts', "error.html.[handler]") %></code>
15
- <code><%= Rails.root.join('app', 'views', 'errors', "#{@rescue_response.to_s}.html.[handler]") %></code>
24
+ <code><%= Rails.root.join('app', 'views', 'layouts', "error.html.<em>[handler]</em>").to_s.html_safe %></code>
25
+ <code><%= Rails.root.join('app', 'views', 'errors', "#{@rescue_response.to_s}.html.<em>[handler]</em>").to_s.html_safe %></code>
16
26
  </pre>
27
+ </div>
28
+ </body>
29
+ </html>
data/lib/gaffe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gaffe
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/gaffe.rb CHANGED
@@ -2,26 +2,36 @@ require 'gaffe/version'
2
2
  require 'gaffe/errors'
3
3
 
4
4
  module Gaffe
5
+ # Yield a block to populate @configuration
5
6
  def self.configure
6
7
  yield configuration
7
8
  end
8
9
 
10
+ # Return the configuration settings
9
11
  def self.configuration
10
12
  @configuration ||= OpenStruct.new
11
13
  end
12
14
 
15
+ # Return either the user-defined controller or our default controller
13
16
  def self.errors_controller
14
17
  @errors_controller ||= (configuration.errors_controller || builtin_errors_controller)
15
18
  end
16
19
 
20
+ # Return our default controller
17
21
  def self.builtin_errors_controller
18
22
  require 'gaffe/errors_controller'
19
23
  Gaffe::ErrorsController
20
24
  end
21
25
 
26
+ # Configure Rails to use our code when encountering exceptions
22
27
  def self.enable!
23
28
  Rails.application.config.exceptions_app = lambda do |env|
24
29
  Gaffe.errors_controller.action(:show).call(env)
25
30
  end
26
31
  end
32
+
33
+ # Return the root path of the gem
34
+ def self.root
35
+ File.expand_path('../../', __FILE__)
36
+ end
27
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaffe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-13 00:00:00.000000000 Z
13
+ date: 2013-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -73,6 +73,7 @@ files:
73
73
  - LICENSE.md
74
74
  - README.md
75
75
  - Rakefile
76
+ - app/assets/stylesheets/errors.css
76
77
  - app/views/errors/forbidden.html.erb
77
78
  - app/views/errors/internal_server_error.html.erb
78
79
  - app/views/errors/not_found.html.erb
@@ -98,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
99
  version: '0'
99
100
  segments:
100
101
  - 0
101
- hash: 1401042202289846948
102
+ hash: -3771495489662381768
102
103
  required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  none: false
104
105
  requirements:
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  segments:
109
110
  - 0
110
- hash: 1401042202289846948
111
+ hash: -3771495489662381768
111
112
  requirements: []
112
113
  rubyforge_project:
113
114
  rubygems_version: 1.8.23