job_notifier 1.1.0 → 1.1.1

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: c8937d5be6261a37e48eb27ab905ad9b93eb196c
4
- data.tar.gz: b72d27da476103948cc7da671edbd3c5deb583ff
3
+ metadata.gz: e2d266e944b8ab6515fa0fbc7f09e7e014114f9f
4
+ data.tar.gz: 647d49a7ea0f74b637b986c13d244160c1a6a495
5
5
  SHA512:
6
- metadata.gz: 3570373e7c9bd76cc1508e6a494f7429d00fee041e33a4cc37a1c6a1843d481b3095b96afde0272e7c572774e4c1b8e808a58a5b7aefcdc06fa8f499d95dd065
7
- data.tar.gz: f7fd01921da169626cf55b57149dfcabe68b5010210e7b5e064a6644eda05db5539451773f81fa87651c12607834095f85dfb0104918ba477acf619b8bd0cf21
6
+ metadata.gz: 1ed5a51e7747e06e25e68baaeb877caefa6c069e7c8974324bad70d885043782fc67af6bc3ec9a49eb03536f6e6919ade51402ac9f41af53c478731a43ef792e
7
+ data.tar.gz: 0e0c35136b45e10b8d1544b47aab38567b707e3eaf748f424b0c14b77eb5d418132ca342ad325862e8cfd56b4700c56f0d0a497206153adcf26f4d0e1c140108
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.1.1
6
+
7
+ #### Fixed
8
+
9
+ - Use silencer gem to ensure ActiveRecord's log is silenced too.
10
+
5
11
  ### v1.1.0
6
12
 
7
13
  #### Added
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- job_notifier (1.1.0)
4
+ job_notifier (1.1.1)
5
5
  colorize (~> 0.7, >= 0.7.7)
6
6
  enumerize (~> 1.0.0, ~> 1.0)
7
7
  rails (~> 4.2, >= 4.2.0)
8
+ silencer (= 1.0.0.rc3)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
@@ -123,6 +124,7 @@ GEM
123
124
  rspec-mocks (~> 3.4.0)
124
125
  rspec-support (~> 3.4.0)
125
126
  rspec-support (3.4.1)
127
+ silencer (1.0.0.rc3)
126
128
  slop (3.6.0)
127
129
  sprockets (3.6.3)
128
130
  concurrent-ruby (~> 1.0)
data/job_notifier.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency "rails", "~> 4.2", ">= 4.2.0"
21
21
  s.add_dependency "enumerize", "~> 1.0", "~> 1.0.0"
22
22
  s.add_dependency "colorize", "~> 0.7", ">= 0.7.7"
23
+ s.add_dependency "silencer", "1.0.0.rc3"
23
24
 
24
25
  s.add_development_dependency "pry"
25
26
  s.add_development_dependency "sqlite3"
@@ -20,7 +20,9 @@ module JobNotifier
20
20
  helper(JobNotifier::ApplicationHelper)
21
21
  end
22
22
 
23
- Rails.application.middleware.swap(Rails::Rack::Logger, JobNotifier::Logger)
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)
24
26
  end
25
27
  end
26
28
  end
@@ -1,23 +1,19 @@
1
1
  module JobNotifier
2
- class Logger < Rails::Rack::Logger
3
- def initialize(app, opts = {})
2
+ class Logger
3
+ def initialize(app)
4
4
  @app = app
5
- @opts = opts
6
- super
7
5
  end
8
6
 
9
7
  def call(env)
10
- if env["PATH_INFO"] =~ %r{\/job_notifier\/\w+\/jobs\/\w+.json}
11
- Rails.logger.silence do
12
- response = @app.call(env)
13
- log_jobs_info(response[2])
14
- return response
15
- end
16
- end
17
-
18
- super(env)
8
+ response = @app.call(env)
9
+ status = response[0]
10
+ return response if status != 200
11
+ log_jobs_info(response[2]) if env["PATH_INFO"] =~ %r{\/\w+\/jobs\/\w+.json}
12
+ response
19
13
  end
20
14
 
15
+ private
16
+
21
17
  def log_jobs_info(response)
22
18
  response.each do |resp|
23
19
  next if resp.blank?
@@ -28,7 +24,7 @@ module JobNotifier
28
24
  end
29
25
 
30
26
  def build_log_msg(result)
31
- msg = ["[#{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}] UNNOTIFIED JOBS".light_blue]
27
+ msg = ["[#{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}] JOBS".light_blue]
32
28
  grouped_jobs = result.group_by { |job| job["status"].to_sym }
33
29
  load_job_status_msg(grouped_jobs, msg, :pending, :yellow)
34
30
  load_job_status_msg(grouped_jobs, msg, :finished, :green)
@@ -1,3 +1,3 @@
1
1
  module JobNotifier
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/job_notifier.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "job_notifier/engine"
2
2
  require "enumerize"
3
3
  require "colorize"
4
+ require "silencer"
4
5
 
5
6
  module JobNotifier
6
7
  extend self
Binary file
@@ -369597,3 +369597,38 @@ Started GET "/assets/application.self-00f52a752e66e73821cdcccac85802deae74aaa390
369597
369597
   (0.1ms) begin transaction
369598
369598
  SQL (0.4ms) INSERT INTO "job_notifier_jobs" ("identifier", "status", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["identifier", "47d959691e12f7fd6f32d1030f848819"], ["status", "failed"], ["created_at", "2016-07-17 02:39:37.110001"], ["updated_at", "2016-07-17 02:39:37.110001"]]
369599
369599
   (1.5ms) commit transaction
369600
+
369601
+
369602
+ Started GET "/" for ::1 at 2016-07-16 23:55:00 -0300
369603
+ Processing by HomeController#index as HTML
369604
+ JobNotifier::Job Load (0.2ms) SELECT "job_notifier_jobs".* FROM "job_notifier_jobs" WHERE "job_notifier_jobs"."identifier" = ? LIMIT 1 [["identifier", "47d959691e12f7fd6f32d1030f848819"]]
369605
+ Rendered home/index.html.erb within layouts/application (1.3ms)
369606
+ Completed 200 OK in 240ms (Views: 190.1ms | ActiveRecord: 1.7ms)
369607
+
369608
+
369609
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-07-16 23:55:01 -0300
369610
+
369611
+
369612
+ Started GET "/assets/application.self-00f52a752e66e73821cdcccac85802deae74aaa390c44b49cf7569827f45aecb.js?body=1" for ::1 at 2016-07-16 23:55:01 -0300
369613
+
369614
+
369615
+ Started GET "/assets/job_notifier/notifier.self-aac4f869560ebd6c31292b7adb578f3b459fd7744c6f63f699a318ab39fa7f9c.js?body=1" for ::1 at 2016-07-16 23:55:01 -0300
369616
+
369617
+
369618
+ Started GET "/" for ::1 at 2016-07-16 23:55:10 -0300
369619
+ Processing by HomeController#index as HTML
369620
+ JobNotifier::Job Load (0.1ms) SELECT "job_notifier_jobs".* FROM "job_notifier_jobs" WHERE "job_notifier_jobs"."identifier" = ? LIMIT 1 [["identifier", "47d959691e12f7fd6f32d1030f848819"]]
369621
+ Rendered home/index.html.erb within layouts/application (0.1ms)
369622
+ Completed 200 OK in 12ms (Views: 11.1ms | ActiveRecord: 0.1ms)
369623
+
369624
+
369625
+ Started GET "/assets/application.self-00f52a752e66e73821cdcccac85802deae74aaa390c44b49cf7569827f45aecb.js?body=1" for ::1 at 2016-07-16 23:55:11 -0300
369626
+
369627
+
369628
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-07-16 23:55:11 -0300
369629
+
369630
+
369631
+ Started GET "/assets/job_notifier/notifier.self-aac4f869560ebd6c31292b7adb578f3b459fd7744c6f63f699a318ab39fa7f9c.js?body=1" for ::1 at 2016-07-16 23:55:11 -0300
369632
+  (0.1ms) begin transaction
369633
+ SQL (1.3ms) INSERT INTO "job_notifier_jobs" ("identifier", "status", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["identifier", "47d959691e12f7fd6f32d1030f848819"], ["status", "pending"], ["created_at", "2016-07-17 15:05:51.134740"], ["updated_at", "2016-07-17 15:05:51.134740"]]
369634
+  (0.6ms) commit transaction