job_notifier 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -1
- data/job_notifier.gemspec +1 -0
- data/lib/job_notifier/engine.rb +3 -1
- data/lib/job_notifier/logger.rb +10 -14
- data/lib/job_notifier/version.rb +1 -1
- data/lib/job_notifier.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +35 -0
- data/spec/dummy/log/test.log +6404 -0
- data/spec/lib/job_notifier/adapters_spec.rb +4 -2
- data/spec/lib/job_notifier/logger_spec.rb +79 -0
- metadata +17 -3
- data/spec/dummy/tmp/pids/server.pid +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2d266e944b8ab6515fa0fbc7f09e7e014114f9f
|
4
|
+
data.tar.gz: 647d49a7ea0f74b637b986c13d244160c1a6a495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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"
|
data/lib/job_notifier/engine.rb
CHANGED
@@ -20,7 +20,9 @@ module JobNotifier
|
|
20
20
|
helper(JobNotifier::ApplicationHelper)
|
21
21
|
end
|
22
22
|
|
23
|
-
Rails.application.middleware.swap(
|
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
|
data/lib/job_notifier/logger.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
module JobNotifier
|
2
|
-
class Logger
|
3
|
-
def initialize(app
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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')}]
|
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)
|
data/lib/job_notifier/version.rb
CHANGED
data/lib/job_notifier.rb
CHANGED
Binary file
|
@@ -369597,3 +369597,38 @@ Started GET "/assets/application.self-00f52a752e66e73821cdcccac85802deae74aaa390
|
|
369597
369597
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
369598
369598
|
[1m[35mSQL (0.4ms)[0m 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
|
[1m[36m (1.5ms)[0m [1mcommit transaction[0m
|
369600
|
+
|
369601
|
+
|
369602
|
+
Started GET "/" for ::1 at 2016-07-16 23:55:00 -0300
|
369603
|
+
Processing by HomeController#index as HTML
|
369604
|
+
[1m[36mJobNotifier::Job Load (0.2ms)[0m [1mSELECT "job_notifier_jobs".* FROM "job_notifier_jobs" WHERE "job_notifier_jobs"."identifier" = ? LIMIT 1[0m [["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
|
+
[1m[35mJobNotifier::Job Load (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
369633
|
+
[1m[35mSQL (1.3ms)[0m 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
|
+
[1m[36m (0.6ms)[0m [1mcommit transaction[0m
|