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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4a42600c4c16fa382df5bfe5c6cf10bde4dfc75
4
- data.tar.gz: edabfe1c6b5adafc952228d277ef9edbdfd7068e
3
+ metadata.gz: 21ffc220bcb6f8ff44ad12e24bd1194de072ce08
4
+ data.tar.gz: 43341870fcd7f3423f140b9d3a48c65305dd083e
5
5
  SHA512:
6
- metadata.gz: 80191498e36199a9525b997a9e5f863d9c9557c3e93a52e089324e3beba3b91e5fc4f2236d20f72a24b5dc18dbadb8364e9b65d9d55a41c53038cab498579445
7
- data.tar.gz: 4a0b2960c96969726b856f9c422d859d9168b277dd9dd2aaa102efc4c16cb4c0681b0ba046a8bcfaf51635578db2863417c41e5644fbf3d0a5d0d2f2908cf563
6
+ metadata.gz: 32cfd08816e6318de16e6d4a7a728e76f586ab29409e200d5258decbc35188151f4b915f8ed2e7c4bad10a59d07567bfd325cc862834ef3a212fa44145cf135f
7
+ data.tar.gz: 96888a7b4bff7199c1d633a068478559d8df213cd17819238f03f2ee2fbd2a67c47b681a91d972ae1ca24b20700cd23e003082523198c5118efd2aaebe6fc754
@@ -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
- * Initial release.
82
+ - Initial release.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- job_notifier (1.2.4)
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.5)
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
- 1. **Relate jobs with entities**
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
- 1. **Persist job results**
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
- 1. **Notify users when their jobs change state.**
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, gives you a way to know what's happening with your jobs.
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
@@ -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"
@@ -20,9 +20,15 @@ module JobNotifier
20
20
  helper(JobNotifier::ApplicationHelper)
21
21
  end
22
22
 
23
- Rails.application.middleware.swap(
24
- Rails::Rack::Logger, Silencer::Logger, silence: [%r{\/job_notifier\/\w+\/jobs\/\w+.json}])
25
- Rails.application.middleware.insert_before(Silencer::Logger, JobNotifier::Logger)
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
@@ -1,31 +1,31 @@
1
1
  module JobNotifier
2
2
  module Error
3
- class InvalidIdentifier < Exception
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 < Exception
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 < Exception
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 < Exception
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 < Exception
28
+ class Validation < RuntimeError
29
29
  attr_reader :error
30
30
 
31
31
  def initialize(error)
@@ -1,3 +1,3 @@
1
1
  module JobNotifier
2
- VERSION = "1.2.4"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -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.2.4
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-01 00:00:00.000000000 Z
13
+ date: 2017-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails