kitty_events 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +2 -0
- data/README.md +22 -0
- data/kitty_events.gemspec +3 -4
- data/lib/kitty_events/handle_worker.rb +5 -1
- data/lib/kitty_events/version.rb +1 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8965397fdf3d791c6ab72fe42abb37406979d517a5691dde8b0f10765a1de7e3
|
4
|
+
data.tar.gz: 52ecfd32b7f24c193b96c3967a31eed4225eaa6d4ccf845e57882c1ef1f39d4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ab055f956e98b2fa8754516e4d6dd94fe3e9d1d823ed796e3a781d777b4ac0a893a7303875ac7441b8dffe80b3e64474760811a6308dd4f9ad0fdcfcc15768e
|
7
|
+
data.tar.gz: f399d651ab66f32ed84f0f3a9e70a84544f6601b4b13eb482d4ec1ed739fb9315fd223ae47a9bcb25c3e8470cd1fcddca2da71712b5dda3e9eef7b6339672fa0
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# :heart_eyes_cat: KittyEvents
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/kitty_events.svg)](https://badge.fury.io/rb/kitty_events) [![Build Status](https://travis-ci.org/producthunt/KittyEvents.svg?branch=master)](https://travis-ci.org/producthunt/KittyEvents)
|
2
3
|
|
3
4
|
Super simple event system built on top of ActiveJob.
|
4
5
|
|
@@ -68,6 +69,27 @@ SyncProfileImageWorker,
|
|
68
69
|
ExampleWorker.set(wait: 5.minutes)
|
69
70
|
```
|
70
71
|
|
72
|
+
## Worker Configuration
|
73
|
+
The worker is configurable via the initializer. Here are examples for catching errors and setting the queue.
|
74
|
+
|
75
|
+
```Ruby
|
76
|
+
# config/initializers/application_events.rb
|
77
|
+
module ApplicationEvents
|
78
|
+
extend KittyEvents
|
79
|
+
|
80
|
+
event :user_signup, [
|
81
|
+
WelcomeEmailWorker,
|
82
|
+
WelcomeTweetWorker,
|
83
|
+
]
|
84
|
+
|
85
|
+
handle_worker.rescue_from ActiveJob::DeserializationError do |exception|
|
86
|
+
# handle deserialization errors
|
87
|
+
end
|
88
|
+
|
89
|
+
handle_worker.queue_as :events # use a specific queue
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
71
93
|
## Development
|
72
94
|
|
73
95
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/kitty_events.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'kitty_events/version'
|
@@ -22,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
22
21
|
spec.require_paths = ['lib']
|
23
22
|
|
24
23
|
spec.add_dependency 'activejob', '>= 4.2'
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
26
|
-
spec.add_development_dependency 'rake', '
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.1.4'
|
25
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
27
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.50'
|
29
28
|
end
|
@@ -4,7 +4,11 @@ require 'active_support/core_ext/module/introspection'
|
|
4
4
|
module KittyEvents
|
5
5
|
class HandleWorker < ActiveJob::Base
|
6
6
|
def perform(event, object)
|
7
|
-
self.class.
|
7
|
+
if self.class.respond_to?(:module_parent)
|
8
|
+
self.class.module_parent.handle(event, object)
|
9
|
+
else
|
10
|
+
self.class.parent.handle(event, object)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
data/lib/kitty_events/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitty_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Coutermarsh
|
8
8
|
- Radoslav Stankov
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activejob
|
@@ -31,28 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 2.1.4
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 2.1.4
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 12.3.3
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 12.3.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
76
|
+
version: '0.50'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0.
|
83
|
+
version: '0.50'
|
84
84
|
description: Super simple event system on top of ActiveJob
|
85
85
|
email:
|
86
86
|
- coutermarsh.mike@gmail.com
|
@@ -108,7 +108,7 @@ homepage: https://github.com/producthunt/kittyevents
|
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
110
|
metadata: {}
|
111
|
-
post_install_message:
|
111
|
+
post_install_message:
|
112
112
|
rdoc_options: []
|
113
113
|
require_paths:
|
114
114
|
- lib
|
@@ -123,9 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
127
|
-
|
128
|
-
signing_key:
|
126
|
+
rubygems_version: 3.1.4
|
127
|
+
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: Super simple event system on top of ActiveJob
|
131
130
|
test_files: []
|