static_error_pages 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: edd5ae7a438aa70c6f805c8f76c79417c9c9d2c247d55427b8b86282a7851138
4
+ data.tar.gz: 4262cb87418728eb0e64d9c8b7c552c2bda6d4f9873d26dfed8f6cbae4d4c7c7
5
+ SHA512:
6
+ metadata.gz: 5def53668dea2221670c6cd0f10dfced127c5f1b8ecf17ed4eabf05bcdeaa8f5058d44c9e79adc64928a593af3b21e151cae398e1262e952d110cb44c02004ae
7
+ data.tar.gz: 9c61b36c8682410bfa859d97016527bfa32f2d659007b7610c6ba702bc88ed7891f213c698c1237194d80b5ebec0261a62f5c3cd920a2887c04a34c60de714da
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Stefan Wienert
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ # StaticErrorPages
2
+
3
+ Quick'n Dirty static error pages generator for Rails
4
+
5
+ - Relies on ``ApplicationController.renderer`` to generate 404.html, 500.html, 503.html, 422.html during deploy
6
+ - Adds a rake task ``bundle exec rails assets:error_pages`` and adds that to ``precompile`` for auto deployment.
7
+
8
+ This is a Rails Engine, and it provides some German language SLIM templates which should be copied over:
9
+
10
+ ```
11
+ bundle exec rails g static_error_pages:copy
12
+ ```
13
+
14
+ Afterwards, adjust the files in ``app/views/error_pages/*``, especially the layout file and include a minimalistic CSS for the error page.
15
+
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'StaticErrorPages'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,2 @@
1
+ h1 Nicht gefunden
2
+ p Diese Seite wurde leider nicht gefunden.
@@ -0,0 +1,4 @@
1
+ h1 = @title = 'Änderung abgelehnt/Formular ungültig'
2
+ p Ihre Formulareingabe konnte aus Sicherheitsgründen nicht bearbeitet werden. Dies kann u.a. auftreten, wenn Sie ein Formular mittels Zurück-Button wieder aufgerufen haben.
3
+ p Bitte probieren Sie es nach einem Seiten Reload erneut. Dies tut uns leid!
4
+
@@ -0,0 +1,3 @@
1
+ h1 = @title = 'Server-Fehler'
2
+ p Hier ist leider ein Programmier-Fehler passiert. Das tut uns leid.
3
+ p Wir werden über solche Fehler i.d.R. informiert und werkeln vielleicht sogar bereits an der Lösung. Sollte der Fehler bestehen bleiben, wenden Sie sich bitte an unseren Support oder Ihren Community-Manager.
@@ -0,0 +1,2 @@
1
+ h1 = @title = 'Server überlastet oder offline'
2
+ p Dieser Dienst ist momentan überlastet oder nicht verfügbar. Bitte probieren Sie es später noch einmal.
@@ -0,0 +1,20 @@
1
+ doctype html
2
+ html lang='de'
3
+ head
4
+ meta(http-equiv="Content-Type" content="text/html; charset=utf-8")
5
+ meta[name="viewport" content="width=device-width, initial-scale=1.0"]
6
+ meta(name="robots" content="noindex")
7
+ == stylesheet_link_tag "application", media: 'all'
8
+ title
9
+ = @title
10
+ = ' '
11
+ |&ndash; Empfehlungsbund.de
12
+ //link rel="shortcut icon" href=image_path('favicons/icon.ico')
13
+ body
14
+ main(style='min-height: 60vh')
15
+ .container
16
+ = yield
17
+ footer
18
+
19
+
20
+
@@ -0,0 +1,16 @@
1
+ module StaticErrorPages
2
+
3
+ class CopyGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Copies over all SLIM-views"
7
+
8
+ def copy_views
9
+ files = Dir["#{StaticErrorPages::Railtie.root.join('app/views')}/**/*.slim"]
10
+
11
+ files.each do |file|
12
+ copy_file(file, "app/views/error_pages/#{File.basename(file)}")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ require "static_error_pages/railtie"
2
+
3
+ module StaticErrorPages
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,10 @@
1
+ module StaticErrorPages
2
+ class Railtie < ::Rails::Engine
3
+ # generators do
4
+ # require "path/to/my_railtie_generator"
5
+ # end
6
+ config.static_error_pages = ActiveSupport::OrderedOptions.new
7
+ config.static_error_pages.pages = %w(404.html 500.html 503.html 422.html)
8
+ config.static_error_pages.layout = '../error_pages/layout'
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module StaticErrorPages
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,20 @@
1
+ # desc "Explaining what the task does"
2
+ # task :static_error_pages do
3
+ # # Task goes here
4
+ # end
5
+
6
+ namespace :assets do
7
+ desc "Generate all configured error-pages"
8
+ task error_pages: :environment do
9
+ Rails.application.config.static_error_pages.pages.each do |file|
10
+ out = ApplicationController.renderer.render("error_pages/#{file}", layout: '../error_pages/layout')
11
+ public_path = Rails.public_path.join(file)
12
+ File.write(public_path, out)
13
+ puts "Generated #{file}"
14
+ end
15
+ end
16
+ end
17
+
18
+ Rake::Task["assets:precompile"].enhance do
19
+ Rake::Task["assets:error_pages"].invoke
20
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: static_error_pages
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stefan Wienert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.4.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.4.3
27
+ description: Generate Rails error pages on deployment using application controller
28
+ renderer
29
+ email:
30
+ - info@stefanwienert.de
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - app/views/error_pages/404.html.slim
39
+ - app/views/error_pages/422.html.slim
40
+ - app/views/error_pages/500.html.slim
41
+ - app/views/error_pages/503.html.slim
42
+ - app/views/error_pages/layout.html.slim
43
+ - lib/generators/static_error_pages/copy_generator.rb
44
+ - lib/static_error_pages.rb
45
+ - lib/static_error_pages/railtie.rb
46
+ - lib/static_error_pages/version.rb
47
+ - lib/tasks/static_error_pages_tasks.rake
48
+ homepage: ''
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.7.6
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Generate Rails error pages on deployment using application-controller renderer
72
+ test_files: []