festive_errors 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 455f86da67e75d13f0377a345d32a5fa22db2b924627aa96d583bdc957995ae6
4
+ data.tar.gz: c732a84c2b9157d4b4223ccd0b46783ef4902a566f73516fba97503c66a95981
5
+ SHA512:
6
+ metadata.gz: 586fbd79595c31280c16cda8b99fb2e01f97b9fd29cc6522d887ceb497ce0a33b4e8bf47176ad0909ec7a09e043ba73c06fbdda9895c4f00e0fdd1a2701fefb4
7
+ data.tar.gz: cc5fef6ab7976a091638d1299591acf74cffd4c07b41db8d7c1b8eb118cf4964c89c047f3a422cd99aa4f3a9809cf779f6d1e7b4aa464fcbcc2c19ab740a3a9c
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2024-11-02
11
+
12
+ ### Added
13
+
14
+ - Initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Joshua Wood & Honeybadger Industries LLC
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.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # FestiveErrors
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "festive_errors"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install festive_errors
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,65 @@
1
+ module FestiveErrors
2
+ THEMES = {
3
+ christmas: "christmas.css",
4
+ halloween: "halloween.css",
5
+ valentines: "valentines.css",
6
+ thanksgiving: "thanksgiving.css",
7
+ newyears: "newyears.css"
8
+ }.freeze
9
+
10
+ def self.holiday_ranges(year)
11
+ {
12
+ christmas: Date.new(year, 12, 1)..Date.new(year, 12, 30),
13
+ halloween: Date.new(year, 10, 1)..Date.new(year, 10, 31),
14
+ valentines: (Date.new(year, 2, 14) - 7)..Date.new(year, 2, 14),
15
+ thanksgiving: Date.new(year, 11, 1)..Date.new(year, 11, 30),
16
+ newyears: Date.new(year, 12, 31)..Date.new(year + 1, 1, 1)
17
+ }
18
+ end
19
+
20
+ module DebugExceptionsExtension
21
+ private
22
+
23
+ def create_template(*)
24
+ template = super
25
+
26
+ return template unless (theme_file = THEMES[__festive_errors_current_theme])
27
+
28
+ css_path = File.expand_path("../styles/#{theme_file}", __dir__)
29
+ css_content = File.read(css_path)
30
+
31
+ template.content_for :style do
32
+ css_content.html_safe
33
+ end
34
+
35
+ template
36
+ end
37
+
38
+ def __festive_errors_current_theme
39
+ today = Date.today
40
+ year = today.year
41
+
42
+ # Get holiday ranges for current year
43
+ ranges = FestiveErrors.holiday_ranges(year)
44
+
45
+ # Check if today falls within a holiday range
46
+ ranges.each do |theme, date_range|
47
+ if date_range.cover?(today)
48
+ return theme
49
+ end
50
+ end
51
+
52
+ # Also check ranges from previous year (for dates that span multiple years)
53
+ if today.month == 1
54
+ prev_ranges = FestiveErrors.holiday_ranges(year - 1)
55
+ prev_ranges.each do |theme, date_range|
56
+ if date_range.cover?(today)
57
+ return theme
58
+ end
59
+ end
60
+ end
61
+
62
+ nil # No theme if not within a holiday range
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,7 @@
1
+ module FestiveErrors
2
+ class Engine < ::Rails::Engine
3
+ initializer "festive_errors.debug_exceptions" do |app|
4
+ ActionDispatch::DebugExceptions.prepend FestiveErrors::DebugExceptionsExtension
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module FestiveErrors
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "festive_errors/version"
2
+ require "festive_errors/engine"
3
+ require "festive_errors/debug_exceptions_extension"
4
+
5
+ module FestiveErrors
6
+ end
@@ -0,0 +1,3 @@
1
+ header h1::after {
2
+ content: " 🎅";
3
+ }
@@ -0,0 +1,3 @@
1
+ header h1::after {
2
+ content: " 🎃";
3
+ }
@@ -0,0 +1,3 @@
1
+ header h1::after {
2
+ content: " 🎆";
3
+ }
@@ -0,0 +1,3 @@
1
+ header h1::after {
2
+ content: " 🦃";
3
+ }
@@ -0,0 +1,3 @@
1
+ header h1::after {
2
+ content: " 💗";
3
+ }
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :festive_errors do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: festive_errors
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Wood
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-02 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: 7.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.0
27
+ description: Festive Errors is a Rails gem that spices up the Rails error page with
28
+ fun holiday themes. We all like to do a little coding around the holidays. Get into
29
+ the holiday spirit with Festive Errors!
30
+ email:
31
+ - josh@joshuawood.net
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - CHANGELOG.md
37
+ - MIT-LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - lib/festive_errors.rb
41
+ - lib/festive_errors/debug_exceptions_extension.rb
42
+ - lib/festive_errors/engine.rb
43
+ - lib/festive_errors/version.rb
44
+ - lib/styles/christmas.css
45
+ - lib/styles/halloween.css
46
+ - lib/styles/newyears.css
47
+ - lib/styles/thanksgiving.css
48
+ - lib/styles/valentines.css
49
+ - lib/tasks/festive_errors_tasks.rake
50
+ homepage: https://github.com/honeybadger-io/festive_errors
51
+ licenses:
52
+ - MIT
53
+ metadata:
54
+ homepage_uri: https://github.com/honeybadger-io/festive_errors
55
+ source_code_uri: https://github.com/honeybadger-io/festive_errors
56
+ changelog_uri: https://github.com/honeybadger-io/festive_errors/blob/master/CHANGELOG.md
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.5.11
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Add some year-round holiday cheer to the Rails error page.
76
+ test_files: []