http_error_cats 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) 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_cats/errors_controller.rb +18 -0
  8. data/config/routes.rb +3 -0
  9. data/http_error_cats.gemspec +24 -0
  10. data/lib/assets/images/http_error_cats/100.jpg +0 -0
  11. data/lib/assets/images/http_error_cats/101.jpg +0 -0
  12. data/lib/assets/images/http_error_cats/200.jpg +0 -0
  13. data/lib/assets/images/http_error_cats/201.jpg +0 -0
  14. data/lib/assets/images/http_error_cats/202.jpg +0 -0
  15. data/lib/assets/images/http_error_cats/204.jpg +0 -0
  16. data/lib/assets/images/http_error_cats/206.jpg +0 -0
  17. data/lib/assets/images/http_error_cats/207.jpg +0 -0
  18. data/lib/assets/images/http_error_cats/300.jpg +0 -0
  19. data/lib/assets/images/http_error_cats/301.jpg +0 -0
  20. data/lib/assets/images/http_error_cats/302.jpg +0 -0
  21. data/lib/assets/images/http_error_cats/303.jpg +0 -0
  22. data/lib/assets/images/http_error_cats/304.jpg +0 -0
  23. data/lib/assets/images/http_error_cats/305.jpg +0 -0
  24. data/lib/assets/images/http_error_cats/307.jpg +0 -0
  25. data/lib/assets/images/http_error_cats/400.jpg +0 -0
  26. data/lib/assets/images/http_error_cats/401.jpg +0 -0
  27. data/lib/assets/images/http_error_cats/402.jpg +0 -0
  28. data/lib/assets/images/http_error_cats/403.jpg +0 -0
  29. data/lib/assets/images/http_error_cats/404.jpg +0 -0
  30. data/lib/assets/images/http_error_cats/405.jpg +0 -0
  31. data/lib/assets/images/http_error_cats/406.jpg +0 -0
  32. data/lib/assets/images/http_error_cats/408.jpg +0 -0
  33. data/lib/assets/images/http_error_cats/409.jpg +0 -0
  34. data/lib/assets/images/http_error_cats/410.jpg +0 -0
  35. data/lib/assets/images/http_error_cats/411.jpg +0 -0
  36. data/lib/assets/images/http_error_cats/413.jpg +0 -0
  37. data/lib/assets/images/http_error_cats/414.jpg +0 -0
  38. data/lib/assets/images/http_error_cats/416.jpg +0 -0
  39. data/lib/assets/images/http_error_cats/417.jpg +0 -0
  40. data/lib/assets/images/http_error_cats/418.jpg +0 -0
  41. data/lib/assets/images/http_error_cats/422.jpg +0 -0
  42. data/lib/assets/images/http_error_cats/423.jpg +0 -0
  43. data/lib/assets/images/http_error_cats/424.jpg +0 -0
  44. data/lib/assets/images/http_error_cats/425.jpg +0 -0
  45. data/lib/assets/images/http_error_cats/426.jpg +0 -0
  46. data/lib/assets/images/http_error_cats/429.jpg +0 -0
  47. data/lib/assets/images/http_error_cats/431.jpg +0 -0
  48. data/lib/assets/images/http_error_cats/444.jpg +0 -0
  49. data/lib/assets/images/http_error_cats/450.jpg +0 -0
  50. data/lib/assets/images/http_error_cats/451.jpg +0 -0
  51. data/lib/assets/images/http_error_cats/500.jpg +0 -0
  52. data/lib/assets/images/http_error_cats/502.jpg +0 -0
  53. data/lib/assets/images/http_error_cats/503.jpg +0 -0
  54. data/lib/assets/images/http_error_cats/506.jpg +0 -0
  55. data/lib/assets/images/http_error_cats/507.jpg +0 -0
  56. data/lib/assets/images/http_error_cats/508.jpg +0 -0
  57. data/lib/assets/images/http_error_cats/509.jpg +0 -0
  58. data/lib/assets/images/http_error_cats/599.jpg +0 -0
  59. data/lib/http_error_cats.rb +2 -0
  60. data/lib/http_error_cats/engine.rb +31 -0
  61. data/lib/http_error_cats/version.rb +3 -0
  62. metadata +146 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d497c289140d062ffadea3b0fc0994175296d2af
4
+ data.tar.gz: d9a5263e8f6dca3e21051de4d141b1404196fd14
5
+ SHA512:
6
+ metadata.gz: 2e5ddfc49ef4de95f49310deef3fa14ed86e7584b90613148387b6900fa7f13709ee625a2b08144e547f24b3fb45ac200281a0fa73b1599bf6996806997245cf
7
+ data.tar.gz: 9262de1d68ddf066953933e2e003b22c056a72221bca90a987fbee6cafd0e87963cebe5f12cab80b61846c8067d4fb2e1e118c4f4c5f59167ba0265de2c7fcba
@@ -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) girliemac
25
+ https://www.flickr.com/photos/girliemac/
@@ -0,0 +1,48 @@
1
+ # HttpErrorCats
2
+
3
+ Replace your HTTP error codes with cats As seen here https://www.flickr.com/photos/girliemac/sets/72157628409467125/
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'http_error_cats'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install http_error_cats
18
+
19
+ ## Usage
20
+
21
+ Configuration options in `config/application.rb`
22
+
23
+ # Layout to use for error page rendering. Default: false
24
+ HttpErrorCats.layout = false
25
+
26
+ # Cat codes to server. Default :all
27
+ HttpErrorCats.codes = :all
28
+ # or
29
+ HttpErrorCats.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_cats/#{status_code}.jpg", alt: "Status code #{status_code}"
35
+ # end
36
+ HttpErrorCats.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_cats/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_cats"
2
+
3
+ module HttpErrorCats
4
+ class ErrorsController < ::ApplicationController
5
+
6
+ def show
7
+ return unless HttpErrorCats.codes == :all
8
+ return if HttpErrorCats.codes.is_a?(Array) && !HttpErrorCats.codes.include?(status_code)
9
+ html = HttpErrorCats.html
10
+ html = html.call status_code if html.is_a?(Proc)
11
+ render inline: html, layout: HttpErrorCats.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_cats/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_cats/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "http_error_cats"
8
+ spec.version = HttpErrorCats::VERSION
9
+ spec.authors = ["Michael Sprauer"]
10
+ spec.email = ["Sprauer@Inline.de"]
11
+ spec.summary = %q{Replace your HTTP error codes with cats}
12
+ spec.description = %q{As seen here https://www.flickr.com/photos/girliemac/sets/72157628409467125/}
13
+ spec.homepage = "https://www.flickr.com/photos/girliemac/sets/72157628409467125/"
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_cats/version"
2
+ require "http_error_cats/engine" if defined? ::Rails
@@ -0,0 +1,31 @@
1
+ require 'rails/engine'
2
+ require 'action_view/helpers/asset_tag_helper'
3
+
4
+ module HttpErrorCats
5
+ class Engine < Rails::Engine
6
+ initializer 'http_error_cats.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_cats/#{status_code}.jpg", alt: "Status code #{status_code}"
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,3 @@
1
+ module HttpErrorCats
2
+ VERSION = '0.0.1'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: http_error_cats
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 https://www.flickr.com/photos/girliemac/sets/72157628409467125/
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_cats/errors_controller.rb
68
+ - config/routes.rb
69
+ - http_error_cats.gemspec
70
+ - lib/assets/images/http_error_cats/100.jpg
71
+ - lib/assets/images/http_error_cats/101.jpg
72
+ - lib/assets/images/http_error_cats/200.jpg
73
+ - lib/assets/images/http_error_cats/201.jpg
74
+ - lib/assets/images/http_error_cats/202.jpg
75
+ - lib/assets/images/http_error_cats/204.jpg
76
+ - lib/assets/images/http_error_cats/206.jpg
77
+ - lib/assets/images/http_error_cats/207.jpg
78
+ - lib/assets/images/http_error_cats/300.jpg
79
+ - lib/assets/images/http_error_cats/301.jpg
80
+ - lib/assets/images/http_error_cats/302.jpg
81
+ - lib/assets/images/http_error_cats/303.jpg
82
+ - lib/assets/images/http_error_cats/304.jpg
83
+ - lib/assets/images/http_error_cats/305.jpg
84
+ - lib/assets/images/http_error_cats/307.jpg
85
+ - lib/assets/images/http_error_cats/400.jpg
86
+ - lib/assets/images/http_error_cats/401.jpg
87
+ - lib/assets/images/http_error_cats/402.jpg
88
+ - lib/assets/images/http_error_cats/403.jpg
89
+ - lib/assets/images/http_error_cats/404.jpg
90
+ - lib/assets/images/http_error_cats/405.jpg
91
+ - lib/assets/images/http_error_cats/406.jpg
92
+ - lib/assets/images/http_error_cats/408.jpg
93
+ - lib/assets/images/http_error_cats/409.jpg
94
+ - lib/assets/images/http_error_cats/410.jpg
95
+ - lib/assets/images/http_error_cats/411.jpg
96
+ - lib/assets/images/http_error_cats/413.jpg
97
+ - lib/assets/images/http_error_cats/414.jpg
98
+ - lib/assets/images/http_error_cats/416.jpg
99
+ - lib/assets/images/http_error_cats/417.jpg
100
+ - lib/assets/images/http_error_cats/418.jpg
101
+ - lib/assets/images/http_error_cats/422.jpg
102
+ - lib/assets/images/http_error_cats/423.jpg
103
+ - lib/assets/images/http_error_cats/424.jpg
104
+ - lib/assets/images/http_error_cats/425.jpg
105
+ - lib/assets/images/http_error_cats/426.jpg
106
+ - lib/assets/images/http_error_cats/429.jpg
107
+ - lib/assets/images/http_error_cats/431.jpg
108
+ - lib/assets/images/http_error_cats/444.jpg
109
+ - lib/assets/images/http_error_cats/450.jpg
110
+ - lib/assets/images/http_error_cats/451.jpg
111
+ - lib/assets/images/http_error_cats/500.jpg
112
+ - lib/assets/images/http_error_cats/502.jpg
113
+ - lib/assets/images/http_error_cats/503.jpg
114
+ - lib/assets/images/http_error_cats/506.jpg
115
+ - lib/assets/images/http_error_cats/507.jpg
116
+ - lib/assets/images/http_error_cats/508.jpg
117
+ - lib/assets/images/http_error_cats/509.jpg
118
+ - lib/assets/images/http_error_cats/599.jpg
119
+ - lib/http_error_cats.rb
120
+ - lib/http_error_cats/engine.rb
121
+ - lib/http_error_cats/version.rb
122
+ homepage: https://www.flickr.com/photos/girliemac/sets/72157628409467125/
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.2.2
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Replace your HTTP error codes with cats
146
+ test_files: []