exception_handler 0.3.3 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6a51465d9623e3eb082dbc4281b1070fcebdca3
4
- data.tar.gz: 333fcc4b0186cbf850c1e4c800ed7b78e67f6900
3
+ metadata.gz: 4e7b8d9040c7a3fe58087c21f46d0a94485dc932
4
+ data.tar.gz: 6a3a85d114984b38c8a07ad8cbb4f45d30df46cb
5
5
  SHA512:
6
- metadata.gz: ac95bafa2a1a53a7de082ec2cf6030de0cb24edac4c1fc55716b768d914598dd5918f9e95c13129b28596213be6bca71d8249e6564669f6b041770c9c45e01d2
7
- data.tar.gz: 243d091da3b9df96164dad839b04f7350f45546a789c94f5a8a0f62705dccf5854424b55f5695c77bf7e0f84a43c25983b85c87af1332dcc94cbfc7eb6ae3b32
6
+ metadata.gz: 8a2bdc955a9519bc3279d20c5181fcd179173cee895ee74000ad13c88e1fa98affd8d1237bd798028e70c659566b7151678e6296e77cc26e0cf730717104c833
7
+ data.tar.gz: ee1ac2fcc659461ce8642d9884392ec8fad90ba98892e6f49d652959f4517fb40cdd4ff35b3b3026447b68d9c834085836a0ccee1c2523aecb16eca6beef1ece
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [![Exception Handler](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/exception_handler.png "Exception Handler Logo")](http://frontlineutilities.co.uk/ruby-on-rails/exception-handler)
1
+ # [![Exception Handler](https://raw.githubusercontent.com/richpeck/exception_handler/master/readme/title.png "Exception Handler Logo")](http://frontlineutilities.co.uk/ruby-on-rails/exception-handler)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/exception_handler.svg)](http://badge.fury.io/rb/exception_handler)
4
4
  [![Code Climate](https://codeclimate.com/github/richpeck/exception_handler.png)](https://codeclimate.com/github/richpeck/exception_handler)
@@ -16,7 +16,7 @@ module ExceptionHandler
16
16
 
17
17
  #Show
18
18
  def show
19
- respond_with status: @status
19
+ render status: @status
20
20
  end
21
21
 
22
22
  ####################
@@ -51,7 +51,8 @@ module ExceptionHandler
51
51
 
52
52
  #Layout
53
53
  def layout_status
54
- @status.to_s != "404" ? "error" : "application"
54
+ return ExceptionHandler.config.exception_layout || 'error' if @status.to_s != "404"
55
+ ExceptionHandler.config.error_layout || 'application'
55
56
  end
56
57
 
57
58
  #App
@@ -60,4 +61,4 @@ module ExceptionHandler
60
61
  end
61
62
 
62
63
  end
63
- end
64
+ end
@@ -3,9 +3,7 @@
3
3
  <head>
4
4
 
5
5
  <!--Info -->
6
- <title>
7
- <%= "Error :: #{@app_name}" %>
8
- </title>
6
+ <title><%= "Error :: #{@app_name}" %></title>
9
7
 
10
8
  <!--Styling -->
11
9
  <style>
@@ -4,9 +4,9 @@
4
4
  require "action_dispatch"
5
5
 
6
6
  #Gem Files
7
- versions = %w(version parser config)
8
- for version in versions do
9
- require "exception_handler/#{version}"
7
+ libs = %w(version parser config)
8
+ for lib in libs do
9
+ require "exception_handler/#{lib}"
10
10
  end
11
11
 
12
12
  ###########################################
@@ -25,14 +25,17 @@ module ExceptionHandler
25
25
  # Config #
26
26
  ####################
27
27
 
28
- #Ref http://robots.thoughtbot.com/mygem-configure-block
29
- mattr_accessor :config, :table
28
+ class << self
30
29
 
31
- #Vars
32
- @@config ||= Config.new
30
+ #Ref http://robots.thoughtbot.com/mygem-configure-block
31
+ #Can call ExceptionHandler.config.x
32
+ mattr_accessor :config
33
+
34
+ end
33
35
 
34
36
  #Block (for initializer)
35
37
  def self.setup
38
+ self.config ||= Config.new
36
39
  yield(config) if block_given?
37
40
  end
38
41
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  module ExceptionHandler
10
10
  class Config
11
- attr_accessor :db, :social
11
+ attr_accessor :db, :social, :error_layout, :exception_layout
12
12
 
13
13
  def initialize
14
14
  @db = false # -> db name (false = no; true = "errors"; [value] = [value])
@@ -19,6 +19,8 @@ module ExceptionHandler
19
19
  youtube: "https://youtube.com/user/frontlineutils",
20
20
  fusion: "http://frontlinefusion.com/frontlineutils"
21
21
  }
22
+ @error_layout = nil
23
+ @exception_layout = nil
22
24
  end
23
25
  end
24
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module ExceptionHandler
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.5"
3
3
  end
@@ -10,7 +10,7 @@ module ExceptionHandler
10
10
  #Config
11
11
  def create_config_file
12
12
  return unless options.empty?
13
- template "exception_handler.rb", "config/initializers/exception_handler.rb" # https://github.com/plataformatec/devise/blob/master/lib/generators/devise/install_generator.rb#L13
13
+ template "config.rb", "config/initializers/exception_handler.rb" # https://github.com/plataformatec/devise/blob/master/lib/generators/devise/install_generator.rb#L13
14
14
  end
15
15
 
16
16
  ###########################################
@@ -18,10 +18,20 @@ module ExceptionHandler
18
18
 
19
19
  ###########################################
20
20
 
21
- #Create Migration
21
+ #Table Name - false = off, true = errors, value = value
22
+ #Always outputs string for some reason...
23
+ def table_name
24
+ ExceptionHandler.config.db || :errors
25
+ end
26
+
27
+ ###########################################
28
+
29
+ #Create
22
30
  def create_errors_migration
23
- migration_template "create_table.rb", "db/migrate/create_errors.rb"
31
+ migration_template "migration.rb.erb", "db/migrate/exception_handler.rb"
24
32
  end
25
33
 
34
+ ###########################################
35
+
26
36
  end
27
37
  end
@@ -0,0 +1,21 @@
1
+ # Exception Handler
2
+ ###
3
+ # You can add different settings using this block
4
+ # Use the docs at http://github.com/richpeck/exception_handler for info
5
+ ###
6
+ ExceptionHandler.setup do |config|
7
+ # DB -
8
+ # Options = false / true
9
+ config.db = false
10
+ # Email -
11
+ # Default = false / true
12
+ # config.email =
13
+ # Social
14
+ config.social = {
15
+ twitter: 'http://twitter.com/frontlineutils',
16
+ facebook: 'https://facebook.com/frontline.utilities',
17
+ linkedin: 'https://linkedin.com/company/frontline-utilities',
18
+ youtube: 'https://youtube.com/user/frontlineutils',
19
+ fusion: 'http://frontlinefusion.com/frontlineutils'
20
+ }
21
+ end
@@ -1,6 +1,6 @@
1
- class CreateErrors < ActiveRecord::Migration
1
+ class Create<%= table_name.to_s.gsub("_","").titleize %> < ActiveRecord::Migration
2
2
  def change
3
- create_table :errors do |t|
3
+ create_table :<%= table_name %> do |t|
4
4
  t.string :usable_type
5
5
  t.integer :usable_id
6
6
  t.text :class_name
Binary file
data/readme/title.png ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Peck
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-11 00:00:00.000000000 Z
12
+ date: 2015-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.6'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.6'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rails
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 4.0.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 4.0.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: activerecord
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: activesupport
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  description: Rails gem to create custom error pages. Captures exceptions using "exception_app"
@@ -104,9 +104,9 @@ executables: []
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
- - .gitignore
108
- - .rspec
109
- - .travis.yml
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".travis.yml"
110
110
  - Gemfile
111
111
  - LICENSE.txt
112
112
  - README.md
@@ -130,8 +130,8 @@ files:
130
130
  - lib/generators/exception_handler/install_generator.rb
131
131
  - lib/generators/exception_handler/migration_generator.rb
132
132
  - lib/generators/exception_handler/views_generator.rb
133
- - lib/generators/templates/create_table.rb
134
- - lib/generators/templates/exception_handler.rb
133
+ - lib/generators/templates/config.rb
134
+ - lib/generators/templates/migration.rb.erb
135
135
  - readme/404.png
136
136
  - readme/404_demo.png
137
137
  - readme/500.png
@@ -140,11 +140,12 @@ files:
140
140
  - readme/config_db.png
141
141
  - readme/db.png
142
142
  - readme/development.png
143
- - readme/exception_handler.png
144
143
  - readme/gem_install.png
145
144
  - readme/install.png
146
145
  - readme/install_migration.png
147
146
  - readme/install_views.png
147
+ - readme/source/title.psd
148
+ - readme/title.png
148
149
  - spec/installation_spec.rb
149
150
  - spec/spec_helper.rb
150
151
  homepage: http://frontlineutilities.co.uk/ror/custom_error_pages
@@ -157,17 +158,17 @@ require_paths:
157
158
  - lib
158
159
  required_ruby_version: !ruby/object:Gem::Requirement
159
160
  requirements:
160
- - - '>='
161
+ - - ">="
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
163
164
  required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
- - - '>='
166
+ - - ">="
166
167
  - !ruby/object:Gem::Version
167
168
  version: '0'
168
169
  requirements: []
169
170
  rubyforge_project:
170
- rubygems_version: 2.0.14
171
+ rubygems_version: 2.4.6
171
172
  signing_key:
172
173
  specification_version: 4
173
174
  summary: Rails gem to show custom error pages in production. Also logs errors in "errors"
@@ -1,25 +0,0 @@
1
- #Exception Handler
2
- ###
3
- #You can add different settings using this block
4
- #Use the docs at http://github.com/richpeck/exception_handler for info
5
- ###
6
- ExceptionHandler.setup do |config|
7
-
8
- #DB -
9
- #Options = false / true
10
- config.db = false
11
-
12
- #Email -
13
- #Default = false / true
14
- #config.email =
15
-
16
- #Social
17
- config.social = {
18
- twitter: "http://twitter.com/frontlineutils",
19
- facebook: "https://facebook.com/frontline.utilities",
20
- linkedin: "https://linkedin.com/company/frontline-utilities",
21
- youtube: "https://youtube.com/user/frontlineutils",
22
- fusion: "http://frontlinefusion.com/frontlineutils"
23
- }
24
-
25
- end
Binary file