festive_errors 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 455f86da67e75d13f0377a345d32a5fa22db2b924627aa96d583bdc957995ae6
4
- data.tar.gz: c732a84c2b9157d4b4223ccd0b46783ef4902a566f73516fba97503c66a95981
3
+ metadata.gz: 8b618c052cd3092d15e1059210455dbf9c968e88b28221fb10cd4849274e2749
4
+ data.tar.gz: da162eb147a26d4df62798c8ac8bb6cdceeda8633a2bd4e72f9cc7e658ff7e3b
5
5
  SHA512:
6
- metadata.gz: 586fbd79595c31280c16cda8b99fb2e01f97b9fd29cc6522d887ceb497ce0a33b4e8bf47176ad0909ec7a09e043ba73c06fbdda9895c4f00e0fdd1a2701fefb4
7
- data.tar.gz: cc5fef6ab7976a091638d1299591acf74cffd4c07b41db8d7c1b8eb118cf4964c89c047f3a422cd99aa4f3a9809cf779f6d1e7b4aa464fcbcc2c19ab740a3a9c
6
+ metadata.gz: 9e33303c455658a40eb78cb73edc474301d721ac05e712818d59f9959c69a9d3f10dcb8f1bba88e29ac9daa2919809f765778e4fc1e6093a7e6eb5b5dc6bf392
7
+ data.tar.gz: ce224e1b55c7167d48d553fface26a57808b24332ad8d116807cf1c55f215271edd5b84a91e17589a42fb2be305dcadc1da9d981db3e042db6bb4b6c2486a528
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Customize theme colors (@omegahm, #1)
13
+
10
14
  ## [0.0.1] - 2024-11-02
11
15
 
12
16
  ### Added
data/README.md CHANGED
@@ -1,28 +1,54 @@
1
- # FestiveErrors
2
- Short description and motivation.
1
+ # Festive Errors
2
+
3
+ Festive Errors is a Rails gem that spices up the Rails error page with fun holiday themes. We all like to do a little coding around the holidays. Get into the holiday spirit with Festive Errors!
4
+
5
+ ![A screenshot of the Rails error page in a web browser that displays an exception that was raise. The error message reads "Happy Halloween!" and there is a ghost emoji in the page heading.](./festive_errors.png)
6
+ <p align="center"><small><em>Debugging an exception in the month of October.</em></small></p>
3
7
 
4
8
  ## Usage
5
- How to use my plugin.
9
+
10
+ The gem adds a CSS theme override to the Rails debug page when your app raises an error in development. All you need to do is install it.
6
11
 
7
12
  ## Installation
8
- Add this line to your application's Gemfile:
13
+
14
+ Add the gem to your Gemfile:
9
15
 
10
16
  ```ruby
11
- gem "festive_errors"
17
+ bundle add festive_errors --group development
12
18
  ```
13
19
 
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
20
+ ## Contributing
21
+
22
+ This is a new gem. The themes and holidays are limited, and it needs tests. Contributions are welcome!
23
+
24
+ 1. Fork it.
25
+ 2. Create a topic branch `git checkout -b my_branch`
26
+ 3. Make your changes and add an entry to [CHANGELOG.md](./CHANGELOG.md).
27
+ 4. Commit your changes `git commit -am "Happy Hanukkah!"`
28
+ 5. Push to your branch `git push origin my_branch`
29
+ 6. Send a [pull request](https://github.com/honeybadger-io/festive_errors/pulls)
30
+
31
+ ## Development
32
+
33
+ Run the local Rails server in the gem directory to raise a test exception:
18
34
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install festive_errors
35
+ ```
36
+ git clone git@github.com:honeybadger-io/festive_errors.git
37
+ cd festive_errors
38
+ bundle install
39
+ bin/rails server
22
40
  ```
23
41
 
24
- ## Contributing
25
- Contribution directions go here.
42
+ ...then visit http://localhost:3000/
43
+
44
+ ## Releasing
45
+
46
+ 1. `gem install gem-release`
47
+ 2. `gem bump -v [version] -t -r`
48
+ 3. Update unreleased heading in [CHANGELOG.md](./CHANGELOG.md) (TODO: automate
49
+ this in gem-release command)
50
+ 4. `git push origin main --tags`
26
51
 
27
52
  ## License
28
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
53
+
54
+ The gem is available as open source under the terms of the [MIT License](https://github.com/honeybadger-io/festive_errors/blob/main/MIT-LICENSE).
@@ -17,13 +17,40 @@ module FestiveErrors
17
17
  }
18
18
  end
19
19
 
20
+ def self.current_theme
21
+ today = Date.today
22
+ year = today.year
23
+
24
+ # Get holiday ranges for current year
25
+ ranges = FestiveErrors.holiday_ranges(year)
26
+
27
+ # Check if today falls within a holiday range
28
+ ranges.each do |theme, date_range|
29
+ if date_range.cover?(today)
30
+ return theme
31
+ end
32
+ end
33
+
34
+ # Also check ranges from previous year (for dates that span multiple years)
35
+ if today.month == 1
36
+ prev_ranges = FestiveErrors.holiday_ranges(year - 1)
37
+ prev_ranges.each do |theme, date_range|
38
+ if date_range.cover?(today)
39
+ return theme
40
+ end
41
+ end
42
+ end
43
+
44
+ nil # No theme if not within a holiday range
45
+ end
46
+
20
47
  module DebugExceptionsExtension
21
48
  private
22
49
 
23
50
  def create_template(*)
24
51
  template = super
25
52
 
26
- return template unless (theme_file = THEMES[__festive_errors_current_theme])
53
+ return template unless (theme_file = THEMES[FestiveErrors.current_theme])
27
54
 
28
55
  css_path = File.expand_path("../styles/#{theme_file}", __dir__)
29
56
  css_content = File.read(css_path)
@@ -34,32 +61,5 @@ module FestiveErrors
34
61
 
35
62
  template
36
63
  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
64
  end
65
65
  end
@@ -1,3 +1,3 @@
1
1
  module FestiveErrors
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,3 +1,34 @@
1
1
  header h1::after {
2
2
  content: " 🎅";
3
3
  }
4
+
5
+ header {
6
+ background: #034f1b;
7
+ }
8
+
9
+ .exception-message .message,
10
+ h2,
11
+ a {
12
+ color: #56705b;
13
+ }
14
+
15
+ a:hover {
16
+ color: #034f1b;
17
+ }
18
+
19
+ .line.active {
20
+ background-color: #9ab99e;
21
+ color: #444444;
22
+ }
23
+
24
+ @media (prefers-color-scheme: dark) {
25
+ .exception-message .message,
26
+ h2,
27
+ a {
28
+ color: #07B33D;
29
+ }
30
+
31
+ a:hover {
32
+ color: #09f152;
33
+ }
34
+ }
@@ -1,3 +1,35 @@
1
1
  header h1::after {
2
- content: " 🎃";
2
+ content: " 👻";
3
+ }
4
+
5
+ header {
6
+ background: #f18405;
7
+ color: #552E02;
8
+ }
9
+
10
+ .exception-message .message,
11
+ h2,
12
+ a {
13
+ color: #AE5F04;
14
+ }
15
+
16
+ a:hover {
17
+ color: #462602;
18
+ }
19
+
20
+ .line.active {
21
+ background-color: #f24f13;
22
+ color: #212121;
23
+ }
24
+
25
+ @media (prefers-color-scheme: dark) {
26
+ .exception-message .message,
27
+ h2,
28
+ a {
29
+ color: #CE7005;
30
+ }
31
+
32
+ a:hover {
33
+ color: #f98f15;
34
+ }
3
35
  }
@@ -1,3 +1,34 @@
1
1
  header h1::after {
2
2
  content: " 🎆";
3
3
  }
4
+
5
+ header {
6
+ background: #062844;
7
+ }
8
+
9
+ .exception-message .message,
10
+ h2,
11
+ a {
12
+ color: #8A701B;
13
+ }
14
+
15
+ a:hover {
16
+ color: #372d0b;
17
+ }
18
+
19
+ .line.active {
20
+ background-color: #d7b030;
21
+ color: #333;
22
+ }
23
+
24
+ @media (prefers-color-scheme: dark) {
25
+ .exception-message .message,
26
+ h2,
27
+ a {
28
+ color: #BA9724;
29
+ }
30
+
31
+ a:hover {
32
+ color: #DEBF56;
33
+ }
34
+ }
@@ -1,3 +1,34 @@
1
1
  header h1::after {
2
2
  content: " 🦃";
3
3
  }
4
+
5
+ header {
6
+ background: #5a391e;
7
+ }
8
+
9
+ .exception-message .message,
10
+ h2,
11
+ a {
12
+ color: #744D27;
13
+ }
14
+
15
+ a:hover {
16
+ color: #2e1f10;
17
+ }
18
+
19
+ .line.active {
20
+ background-color: #b78c55;
21
+ color: #2D2D2D;
22
+ }
23
+
24
+ @media (prefers-color-scheme: dark) {
25
+ .exception-message .message,
26
+ h2,
27
+ a {
28
+ color: #C98E5D;
29
+ }
30
+
31
+ a:hover {
32
+ color: #DFBA9D;
33
+ }
34
+ }
@@ -1,3 +1,35 @@
1
1
  header h1::after {
2
2
  content: " 💗";
3
3
  }
4
+
5
+ header {
6
+ background: #f7a3db;
7
+ color: #930D66;
8
+ }
9
+
10
+ .exception-message .message,
11
+ h2,
12
+ a {
13
+ color: #D81396;
14
+ }
15
+
16
+ a:hover {
17
+ color: #56083c;
18
+ }
19
+
20
+ .line.active {
21
+ background-color: #fe2eab;
22
+ color: #4A0733;
23
+ }
24
+
25
+ @media (prefers-color-scheme: dark) {
26
+ .exception-message .message,
27
+ h2,
28
+ a {
29
+ color: #F267C3;
30
+ }
31
+
32
+ a:hover {
33
+ color: #f585cf;
34
+ }
35
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: festive_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Wood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-02 00:00:00.000000000 Z
11
+ date: 2024-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails