slack_log_device 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/slack_log_device.rb +1 -2
- data/slack_log_device.gemspec +3 -3
- data/spec/slack_log_device_spec.rb +5 -15
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc81637219036304853c58b3abdff5b0461746b6
|
4
|
+
data.tar.gz: cbd0673773540ba8b65ed7f7ed24a2a508a46df8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58320e47d7af2785ed9cf2c03a8770e5fa32ed4be7e3225491a9c36541693ba5be039a02aacb54e63d7761c9c4f7c9121b6a959eb24436722ec4882bebdbf9ef
|
7
|
+
data.tar.gz: 9e3d6ac73a9b43877069efc40adb431629131d5a2c99a7b3f7bc759fb443c846f51f2d6eec5b650e48d0adbf3f517a3a1596fb5c2a5b51bb1c83010de91697a2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/lib/slack_log_device.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'active_support/core_ext/hash'
|
2
|
-
require 'active_support/core_ext/integer'
|
3
2
|
require 'active_support/core_ext/string'
|
4
3
|
require 'httparty'
|
5
4
|
require 'logger'
|
@@ -66,7 +65,7 @@ class SlackLogDevice
|
|
66
65
|
data['channel'] = channel if channel.present?
|
67
66
|
data['username'] = username if username.present?
|
68
67
|
begin
|
69
|
-
HTTParty.post(webhook_url, body: data.to_json, headers: { 'Content-Type'
|
68
|
+
HTTParty.post(webhook_url, body: data.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: timeout)
|
70
69
|
rescue Exception => e
|
71
70
|
STDERR.puts(e)
|
72
71
|
end
|
data/slack_log_device.gemspec
CHANGED
@@ -9,14 +9,14 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.description = 'LogDevice implementation that post logs on a Slack channel'
|
10
10
|
s.license = 'MIT'
|
11
11
|
|
12
|
-
s.rubyforge_project = 'slack_log_device'
|
13
|
-
|
14
12
|
s.files = `git ls-files`.split("\n")
|
15
13
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
14
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
15
|
s.require_paths = ['lib']
|
18
16
|
|
19
|
-
s.
|
17
|
+
s.required_ruby_version = '>= 2.0.0'
|
18
|
+
|
19
|
+
s.add_dependency 'activesupport', '>= 4.1.0', '< 6.0.0'
|
20
20
|
s.add_dependency 'httparty', '>= 0.14.0', '< 0.15.0'
|
21
21
|
|
22
22
|
s.add_development_dependency 'byebug', '>= 9.0.0', '< 10.0.0'
|
@@ -144,35 +144,35 @@ describe SlackLogDevice do
|
|
144
144
|
|
145
145
|
it 'sends a post to webhook URL with given given message and specified username' do
|
146
146
|
device.write('BAM!')
|
147
|
-
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'username' => options[:username] }.to_json, headers: { 'Content-Type'
|
147
|
+
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'username' => options[:username] }.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: 5)
|
148
148
|
device.flush
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'does not send username if nil' do
|
152
152
|
options.delete(:username)
|
153
153
|
device.write('BAM!')
|
154
|
-
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!' }.to_json, headers: { 'Content-Type'
|
154
|
+
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!' }.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: 5)
|
155
155
|
device.flush
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'use specified channel' do
|
159
159
|
options[:channel] = '#foo'
|
160
160
|
device.write('BAM!')
|
161
|
-
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'channel'
|
161
|
+
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'channel' => '#foo', 'username' => options[:username] }.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: 5)
|
162
162
|
device.flush
|
163
163
|
end
|
164
164
|
|
165
165
|
it 'use specified timeout' do
|
166
166
|
options[:timeout] = 12
|
167
167
|
device.write('BAM!')
|
168
|
-
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'username' => options[:username] }.to_json, headers: { 'Content-Type'
|
168
|
+
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => 'BAM!', 'username' => options[:username] }.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: 12)
|
169
169
|
device.flush
|
170
170
|
end
|
171
171
|
|
172
172
|
it 'flushes all message writen separated by a new line' do
|
173
173
|
device.write('BAM!')
|
174
174
|
device.write('BIM!')
|
175
|
-
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => "BAM!\nBIM!", 'username' => options[:username] }.to_json, headers: { 'Content-Type'
|
175
|
+
expect(HTTParty).to receive(:post).with(options[:webhook_url], body: { 'text' => "BAM!\nBIM!", 'username' => options[:username] }.to_json, headers: { 'Content-Type' => 'application/json' }, timeout: 5)
|
176
176
|
device.flush
|
177
177
|
end
|
178
178
|
|
@@ -546,16 +546,6 @@ describe SlackLogDevice do
|
|
546
546
|
|
547
547
|
end
|
548
548
|
|
549
|
-
describe '#reopen' do
|
550
|
-
|
551
|
-
it 'does not raise any error' do
|
552
|
-
expect {
|
553
|
-
logger.reopen
|
554
|
-
}.not_to raise_error
|
555
|
-
end
|
556
|
-
|
557
|
-
end
|
558
|
-
|
559
549
|
describe '@logdev' do
|
560
550
|
|
561
551
|
let(:logdev) { logger.instance_variable_get(:@logdev) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_log_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
@@ -14,100 +14,100 @@ dependencies:
|
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- -
|
19
|
+
version: 4.1.0
|
20
|
+
- - <
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 6.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- -
|
29
|
+
version: 4.1.0
|
30
|
+
- - <
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 6.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: httparty
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - '>='
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.14.0
|
40
|
-
- -
|
40
|
+
- - <
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.15.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 0.14.0
|
50
|
-
- -
|
50
|
+
- - <
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.15.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: byebug
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - '>='
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 9.0.0
|
60
|
-
- -
|
60
|
+
- - <
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 10.0.0
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 9.0.0
|
70
|
-
- -
|
70
|
+
- - <
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 10.0.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rake
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - '>='
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 12.0.0
|
80
|
-
- -
|
80
|
+
- - <
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 13.0.0
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 12.0.0
|
90
|
-
- -
|
90
|
+
- - <
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 13.0.0
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rspec
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: 3.5.0
|
100
|
-
- -
|
100
|
+
- - <
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 3.6.0
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 3.5.0
|
110
|
-
- -
|
110
|
+
- - <
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 3.6.0
|
113
113
|
description: LogDevice implementation that post logs on a Slack channel
|
@@ -116,8 +116,8 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
-
|
120
|
-
-
|
119
|
+
- .gitignore
|
120
|
+
- .rspec
|
121
121
|
- Gemfile
|
122
122
|
- MIT-LICENSE
|
123
123
|
- README.mdown
|
@@ -137,17 +137,17 @@ require_paths:
|
|
137
137
|
- lib
|
138
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
142
|
+
version: 2.0.0
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - '>='
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.0.14.1
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: LogDevice for Slack
|