http_error_dogs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +25 -0
  5. data/README.md +48 -0
  6. data/Rakefile +2 -0
  7. data/app/controllers/http_error_dogs/errors_controller.rb +18 -0
  8. data/config/routes.rb +3 -0
  9. data/http_error_dogs.gemspec +24 -0
  10. data/lib/assets/images/http_error_dogs/100.jpg +0 -0
  11. data/lib/assets/images/http_error_dogs/200.jpg +0 -0
  12. data/lib/assets/images/http_error_dogs/201.jpg +0 -0
  13. data/lib/assets/images/http_error_dogs/202.jpg +0 -0
  14. data/lib/assets/images/http_error_dogs/203.jpg +0 -0
  15. data/lib/assets/images/http_error_dogs/204.jpg +0 -0
  16. data/lib/assets/images/http_error_dogs/206.jpg +0 -0
  17. data/lib/assets/images/http_error_dogs/207.jpg +0 -0
  18. data/lib/assets/images/http_error_dogs/208.jpg +0 -0
  19. data/lib/assets/images/http_error_dogs/226.jpg +0 -0
  20. data/lib/assets/images/http_error_dogs/300.jpg +0 -0
  21. data/lib/assets/images/http_error_dogs/301.jpg +0 -0
  22. data/lib/assets/images/http_error_dogs/302.jpg +0 -0
  23. data/lib/assets/images/http_error_dogs/303.jpg +0 -0
  24. data/lib/assets/images/http_error_dogs/304.jpg +0 -0
  25. data/lib/assets/images/http_error_dogs/305.jpg +0 -0
  26. data/lib/assets/images/http_error_dogs/306.jpg +0 -0
  27. data/lib/assets/images/http_error_dogs/307.jpg +0 -0
  28. data/lib/assets/images/http_error_dogs/308.jpg +0 -0
  29. data/lib/assets/images/http_error_dogs/400.jpg +0 -0
  30. data/lib/assets/images/http_error_dogs/401.jpg +0 -0
  31. data/lib/assets/images/http_error_dogs/402.jpg +0 -0
  32. data/lib/assets/images/http_error_dogs/403.jpg +0 -0
  33. data/lib/assets/images/http_error_dogs/404.jpg +0 -0
  34. data/lib/assets/images/http_error_dogs/405.jpg +0 -0
  35. data/lib/assets/images/http_error_dogs/406.jpg +0 -0
  36. data/lib/assets/images/http_error_dogs/407.jpg +0 -0
  37. data/lib/assets/images/http_error_dogs/408.jpg +0 -0
  38. data/lib/assets/images/http_error_dogs/409.jpg +0 -0
  39. data/lib/assets/images/http_error_dogs/410.jpg +0 -0
  40. data/lib/assets/images/http_error_dogs/411.jpg +0 -0
  41. data/lib/assets/images/http_error_dogs/412.jpg +0 -0
  42. data/lib/assets/images/http_error_dogs/413.jpg +0 -0
  43. data/lib/assets/images/http_error_dogs/414.jpg +0 -0
  44. data/lib/assets/images/http_error_dogs/416.jpg +0 -0
  45. data/lib/assets/images/http_error_dogs/417.jpg +0 -0
  46. data/lib/assets/images/http_error_dogs/418.jpg +0 -0
  47. data/lib/assets/images/http_error_dogs/420.jpg +0 -0
  48. data/lib/assets/images/http_error_dogs/422.jpg +0 -0
  49. data/lib/assets/images/http_error_dogs/423.jpg +0 -0
  50. data/lib/assets/images/http_error_dogs/424.jpg +0 -0
  51. data/lib/assets/images/http_error_dogs/425.jpg +0 -0
  52. data/lib/assets/images/http_error_dogs/426.jpg +0 -0
  53. data/lib/assets/images/http_error_dogs/429.jpg +0 -0
  54. data/lib/assets/images/http_error_dogs/431.jpg +0 -0
  55. data/lib/assets/images/http_error_dogs/444.jpg +0 -0
  56. data/lib/assets/images/http_error_dogs/450.jpg +0 -0
  57. data/lib/assets/images/http_error_dogs/451.jpg +0 -0
  58. data/lib/assets/images/http_error_dogs/494.jpg +0 -0
  59. data/lib/assets/images/http_error_dogs/500.jpg +0 -0
  60. data/lib/assets/images/http_error_dogs/501.jpg +0 -0
  61. data/lib/assets/images/http_error_dogs/502.jpg +0 -0
  62. data/lib/assets/images/http_error_dogs/503.jpg +0 -0
  63. data/lib/assets/images/http_error_dogs/504.jpg +0 -0
  64. data/lib/assets/images/http_error_dogs/506.jpg +0 -0
  65. data/lib/assets/images/http_error_dogs/507.jpg +0 -0
  66. data/lib/assets/images/http_error_dogs/508.jpg +0 -0
  67. data/lib/assets/images/http_error_dogs/509.jpg +0 -0
  68. data/lib/assets/images/http_error_dogs/510.jpg +0 -0
  69. data/lib/http_error_dogs.rb +2 -0
  70. data/lib/http_error_dogs/engine.rb +31 -0
  71. data/lib/http_error_dogs/version.rb +3 -0
  72. metadata +156 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07d3397228cc2a2c8ca7cf4fad7367c5c8480643
4
+ data.tar.gz: 3c359eefc1cae057d8e0366d787cfb82eba90614
5
+ SHA512:
6
+ metadata.gz: fd1f45bced69ce21a1bb055b975a3d1fa3f74e6a709fc6df9b053e40be8c39947ff424298862142fc7e02af2d87d890e10325cbab7d731a3de0b47297de1ae9c
7
+ data.tar.gz: 0cd169e8a148927c6c896c191b94c40b28b29202f91a503c1eb2a67558e906a517dc9c197bf9174f9821c1fed52c8bd68831c945a4486ae6bc112af57e7db20b
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in http_error_cats.gemspec
4
+ gemspec
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2014 Michael Sprauer
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ Images (c) @mikeleeorg
25
+ http://httpstatusdogs.com/
@@ -0,0 +1,48 @@
1
+ # HttpErrorDogs
2
+
3
+ Replace your HTTP error codes with dogs. As seen here http://httpstatusdogs.com
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'http_error_dogs'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install http_error_dogs
18
+
19
+ ## Usage
20
+
21
+ Configuration options in `config/application.rb`
22
+
23
+ # Layout to use for error page rendering. Default: false
24
+ HttpErrorDogs.layout = false
25
+
26
+ # Cat codes to server. Default :all
27
+ HttpErrorDogs.codes = :all
28
+ # or
29
+ HttpErrorDogs.codes = [404, 500]
30
+
31
+ # Html used to render the error code.
32
+ # Default:
33
+ # Proc.new do |status_code|
34
+ # image_tag "/assets/http_error_dogs/#{status_code}.jpg", alt: "Status code #{status_code}"
35
+ # end
36
+ HttpErrorDogs.html = Proc.new {|code| "<h2>Error #{code}</h2>"}
37
+
38
+ ## License
39
+
40
+ Images (c) girlimac - https://www.flickr.com/photos/girliemac/
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it ( https://github.com/[my-github-username]/http_error_dogs/fork )
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,18 @@
1
+ require "http_error_dogs"
2
+
3
+ module HttpErrorDogs
4
+ class ErrorsController < ::ApplicationController
5
+
6
+ def show
7
+ return unless HttpErrorDogs.codes == :all
8
+ return if HttpErrorDogs.codes.is_a?(Array) && !HttpErrorDogs.codes.include?(status_code)
9
+ html = HttpErrorDogs.html
10
+ html = html.call status_code if html.is_a?(Proc)
11
+ render inline: html, layout: HttpErrorDogs.layout
12
+ end
13
+
14
+ def status_code
15
+ params[:code] || 500
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ match '/:code', constraints: {code: /\d+/ }, via: :all, to: 'http_error_dogs/errors#show'
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'http_error_dogs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "http_error_dogs"
8
+ spec.version = HttpErrorDogs::VERSION
9
+ spec.authors = ["Michael Sprauer"]
10
+ spec.email = ["Sprauer@Inline.de"]
11
+ spec.summary = %q{Replace your HTTP error codes with dogs}
12
+ spec.description = %q{As seen here http://httpstatusdogs.com/}
13
+ spec.homepage = "https://github.com/MichaelSp/http_status_dogs"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_dependency 'rails', '~> 4'
24
+ end
@@ -0,0 +1,2 @@
1
+ require "http_error_dogs/version"
2
+ require "http_error_dogs/engine" if defined? ::Rails
@@ -0,0 +1,31 @@
1
+ require 'rails/engine'
2
+ require 'action_view/helpers/asset_tag_helper'
3
+
4
+ module HttpErrorDogs
5
+ class Engine < Rails::Engine
6
+ initializer 'http_error_dogs.load_static_assets' do |app|
7
+ app.config.assets.precompile += %w(*.jpg)
8
+ end
9
+
10
+ end
11
+
12
+ extend ActionView::Helpers::AssetTagHelper
13
+ extend ActionView::Helpers::TagHelper
14
+
15
+ mattr_accessor :layout, :codes, :html
16
+
17
+ def self.layout
18
+ @@layout || false
19
+ end
20
+
21
+ def self.codes
22
+ @@codes || :all
23
+ end
24
+
25
+ def self.html
26
+ @@html || Proc.new do |status_code|
27
+ image_tag "/assets/http_error_dogs/#{status_code}.jpg", alt: "Status code #{status_code}"
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,3 @@
1
+ module HttpErrorDogs
2
+ VERSION = '0.0.1'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: http_error_dogs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Sprauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4'
55
+ description: As seen here http://httpstatusdogs.com/
56
+ email:
57
+ - Sprauer@Inline.de
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - app/controllers/http_error_dogs/errors_controller.rb
68
+ - config/routes.rb
69
+ - http_error_dogs.gemspec
70
+ - lib/assets/images/http_error_dogs/100.jpg
71
+ - lib/assets/images/http_error_dogs/200.jpg
72
+ - lib/assets/images/http_error_dogs/201.jpg
73
+ - lib/assets/images/http_error_dogs/202.jpg
74
+ - lib/assets/images/http_error_dogs/203.jpg
75
+ - lib/assets/images/http_error_dogs/204.jpg
76
+ - lib/assets/images/http_error_dogs/206.jpg
77
+ - lib/assets/images/http_error_dogs/207.jpg
78
+ - lib/assets/images/http_error_dogs/208.jpg
79
+ - lib/assets/images/http_error_dogs/226.jpg
80
+ - lib/assets/images/http_error_dogs/300.jpg
81
+ - lib/assets/images/http_error_dogs/301.jpg
82
+ - lib/assets/images/http_error_dogs/302.jpg
83
+ - lib/assets/images/http_error_dogs/303.jpg
84
+ - lib/assets/images/http_error_dogs/304.jpg
85
+ - lib/assets/images/http_error_dogs/305.jpg
86
+ - lib/assets/images/http_error_dogs/306.jpg
87
+ - lib/assets/images/http_error_dogs/307.jpg
88
+ - lib/assets/images/http_error_dogs/308.jpg
89
+ - lib/assets/images/http_error_dogs/400.jpg
90
+ - lib/assets/images/http_error_dogs/401.jpg
91
+ - lib/assets/images/http_error_dogs/402.jpg
92
+ - lib/assets/images/http_error_dogs/403.jpg
93
+ - lib/assets/images/http_error_dogs/404.jpg
94
+ - lib/assets/images/http_error_dogs/405.jpg
95
+ - lib/assets/images/http_error_dogs/406.jpg
96
+ - lib/assets/images/http_error_dogs/407.jpg
97
+ - lib/assets/images/http_error_dogs/408.jpg
98
+ - lib/assets/images/http_error_dogs/409.jpg
99
+ - lib/assets/images/http_error_dogs/410.jpg
100
+ - lib/assets/images/http_error_dogs/411.jpg
101
+ - lib/assets/images/http_error_dogs/412.jpg
102
+ - lib/assets/images/http_error_dogs/413.jpg
103
+ - lib/assets/images/http_error_dogs/414.jpg
104
+ - lib/assets/images/http_error_dogs/416.jpg
105
+ - lib/assets/images/http_error_dogs/417.jpg
106
+ - lib/assets/images/http_error_dogs/418.jpg
107
+ - lib/assets/images/http_error_dogs/420.jpg
108
+ - lib/assets/images/http_error_dogs/422.jpg
109
+ - lib/assets/images/http_error_dogs/423.jpg
110
+ - lib/assets/images/http_error_dogs/424.jpg
111
+ - lib/assets/images/http_error_dogs/425.jpg
112
+ - lib/assets/images/http_error_dogs/426.jpg
113
+ - lib/assets/images/http_error_dogs/429.jpg
114
+ - lib/assets/images/http_error_dogs/431.jpg
115
+ - lib/assets/images/http_error_dogs/444.jpg
116
+ - lib/assets/images/http_error_dogs/450.jpg
117
+ - lib/assets/images/http_error_dogs/451.jpg
118
+ - lib/assets/images/http_error_dogs/494.jpg
119
+ - lib/assets/images/http_error_dogs/500.jpg
120
+ - lib/assets/images/http_error_dogs/501.jpg
121
+ - lib/assets/images/http_error_dogs/502.jpg
122
+ - lib/assets/images/http_error_dogs/503.jpg
123
+ - lib/assets/images/http_error_dogs/504.jpg
124
+ - lib/assets/images/http_error_dogs/506.jpg
125
+ - lib/assets/images/http_error_dogs/507.jpg
126
+ - lib/assets/images/http_error_dogs/508.jpg
127
+ - lib/assets/images/http_error_dogs/509.jpg
128
+ - lib/assets/images/http_error_dogs/510.jpg
129
+ - lib/http_error_dogs.rb
130
+ - lib/http_error_dogs/engine.rb
131
+ - lib/http_error_dogs/version.rb
132
+ homepage: https://github.com/MichaelSp/http_status_dogs
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.2.2
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Replace your HTTP error codes with dogs
156
+ test_files: []