job_notifier 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/Gemfile.lock +2 -2
- data/README.md +4 -4
- data/lib/generators/job_notifier/install/templates/initializer.rb +4 -0
- data/lib/job_notifier.rb +6 -1
- data/lib/job_notifier/engine.rb +9 -3
- data/lib/job_notifier/error.rb +5 -5
- data/lib/job_notifier/version.rb +1 -1
- data/spec/dummy/config/initializers/job_notifier.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21ffc220bcb6f8ff44ad12e24bd1194de072ce08
|
4
|
+
data.tar.gz: 43341870fcd7f3423f140b9d3a48c65305dd083e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32cfd08816e6318de16e6d4a7a728e76f586ab29409e200d5258decbc35188151f4b915f8ed2e7c4bad10a59d07567bfd325cc862834ef3a212fa44145cf135f
|
7
|
+
data.tar.gz: 96888a7b4bff7199c1d633a068478559d8df213cd17819238f03f2ee2fbd2a67c47b681a91d972ae1ca24b20700cd23e003082523198c5118efd2aaebe6fc754
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
### v1.3.0
|
6
|
+
|
7
|
+
##### Added
|
8
|
+
|
9
|
+
- Add silenced_log config option to disable silencer gem.
|
10
|
+
|
5
11
|
### v1.2.4
|
6
12
|
|
7
13
|
##### Fixed
|
@@ -12,7 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
12
18
|
|
13
19
|
##### Changed
|
14
20
|
|
15
|
-
- Avoid raising error with undefined verify_authenticity_token method
|
21
|
+
- Avoid raising error with undefined verify_authenticity_token method.
|
16
22
|
|
17
23
|
### v1.2.2
|
18
24
|
|
@@ -73,4 +79,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
73
79
|
|
74
80
|
### v0.1.0
|
75
81
|
|
76
|
-
|
82
|
+
- Initial release.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
job_notifier (1.
|
4
|
+
job_notifier (1.3.0)
|
5
5
|
colorize (>= 0.7.7)
|
6
6
|
enumerize (>= 1.0)
|
7
7
|
rails (>= 4.2.0)
|
@@ -71,7 +71,7 @@ GEM
|
|
71
71
|
json (2.0.3)
|
72
72
|
loofah (2.0.3)
|
73
73
|
nokogiri (>= 1.5.9)
|
74
|
-
mail (2.6.
|
74
|
+
mail (2.6.6)
|
75
75
|
mime-types (>= 1.16, < 4)
|
76
76
|
method_source (0.8.2)
|
77
77
|
mime-types (3.1)
|
data/README.md
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
It's a Rails engine built on top of [Active Job](https://github.com/rails/activejob) in order to **improve user experience related to background processes**. To achieve this goal, the gem allows us to:
|
4
4
|
|
5
|
-
|
5
|
+
- **Relate jobs with entities**
|
6
6
|
|
7
7
|
Using [Active Job](https://github.com/rails/activejob), you can perform background jobs but, you can not relate them with, for example, a logged user. Job Notifier allows you to connect an entity with a job easily.
|
8
8
|
|
9
|
-
|
9
|
+
- **Persist job results**
|
10
10
|
|
11
11
|
Using [Active Job](https://github.com/rails/activejob), you can run jobs in background but, you are not be able to store the result of those jobs. This is a desired behavior if you, for example, want to provide validation feedback to users.
|
12
12
|
|
13
|
-
|
13
|
+
- **Notify users when their jobs change state.**
|
14
14
|
|
15
|
-
Using [Active Job](https://github.com/rails/activejob), you can run jobs in background but, you lose a real time response. To bring a solution to this issue, Job Notifier, through polling technique,
|
15
|
+
Using [Active Job](https://github.com/rails/activejob), you can run jobs in background but, you lose a real time response. To bring a solution to this issue, Job Notifier, through polling technique, gives you a way to know what's happening with your jobs.
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
@@ -2,4 +2,8 @@ JobNotifier.setup do |config|
|
|
2
2
|
# If you're using an app client that is not part of rails project where Job Notifier gem was
|
3
3
|
# installed, you can define a custom root_url. For example: "http://app.platan.us/"
|
4
4
|
# config.root_url = "/"
|
5
|
+
|
6
|
+
# This gem uses the polling technique to inform what's happening with your jobs. This generates
|
7
|
+
# a noisy log output. If you want to silence this output
|
8
|
+
# config.silenced_log = false
|
5
9
|
end
|
data/lib/job_notifier.rb
CHANGED
@@ -6,13 +6,18 @@ require "silencer"
|
|
6
6
|
module JobNotifier
|
7
7
|
extend self
|
8
8
|
|
9
|
-
attr_writer :root_url
|
9
|
+
attr_writer :root_url, :silenced_log
|
10
10
|
|
11
11
|
def root_url
|
12
12
|
return "/" unless @root_url
|
13
13
|
@root_url
|
14
14
|
end
|
15
15
|
|
16
|
+
def silenced_log
|
17
|
+
return false unless @silenced_log
|
18
|
+
@silenced_log
|
19
|
+
end
|
20
|
+
|
16
21
|
def setup
|
17
22
|
yield self
|
18
23
|
require "job_notifier"
|
data/lib/job_notifier/engine.rb
CHANGED
@@ -20,9 +20,15 @@ module JobNotifier
|
|
20
20
|
helper(JobNotifier::ApplicationHelper)
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
Rails
|
25
|
-
|
23
|
+
if JobNotifier.silenced_log
|
24
|
+
Rails.application.middleware.swap(
|
25
|
+
Rails::Rack::Logger,
|
26
|
+
Silencer::Logger,
|
27
|
+
silence: [%r{\/job_notifier\/\w+\/jobs\/\w+.json}]
|
28
|
+
)
|
29
|
+
|
30
|
+
Rails.application.middleware.insert_before(Silencer::Logger, JobNotifier::Logger)
|
31
|
+
end
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
data/lib/job_notifier/error.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
module JobNotifier
|
2
2
|
module Error
|
3
|
-
class InvalidIdentifier <
|
3
|
+
class InvalidIdentifier < RuntimeError
|
4
4
|
def initialize
|
5
5
|
super("you need to pass a non blank identifier")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
class MissingAttributes <
|
9
|
+
class MissingAttributes < RuntimeError
|
10
10
|
def initialize
|
11
11
|
super("you need to execute identify_job_through method on host model")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
class BlankAttribute <
|
15
|
+
class BlankAttribute < RuntimeError
|
16
16
|
def initialize(attribute)
|
17
17
|
super("#{attribute} cant be blank")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
class InvalidAdapter <
|
21
|
+
class InvalidAdapter < RuntimeError
|
22
22
|
def initialize
|
23
23
|
file_names = JobNotifier::Adapters.names.join(", ")
|
24
24
|
super("The adapter must be one of: #{file_names}")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
class Validation <
|
28
|
+
class Validation < RuntimeError
|
29
29
|
attr_reader :error
|
30
30
|
|
31
31
|
def initialize(error)
|
data/lib/job_notifier/version.rb
CHANGED
@@ -2,4 +2,8 @@ JobNotifier.setup do |config|
|
|
2
2
|
# If you're using an app client that is not part of rails project where Job Notifier gem was
|
3
3
|
# installed, you can define a custom root_url. For example: "http://app.platan.us/"
|
4
4
|
# config.root_url = "/"
|
5
|
+
|
6
|
+
# This gem uses the polling technique to inform what's happening with your jobs. This generates
|
7
|
+
# a noisy log output. If you want to silence this output
|
8
|
+
# config.silenced_log = false
|
5
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Platanus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-06-
|
13
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|