dogtrainer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/.rubocop.yml +27 -0
- data/ChangeLog.md +3 -0
- data/Gemfile +2 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +174 -0
- data/Rakefile +46 -0
- data/circle.yml +22 -0
- data/dogtrainer.gemspec +59 -0
- data/lib/dogtrainer.rb +6 -0
- data/lib/dogtrainer/api.rb +437 -0
- data/lib/dogtrainer/logging.rb +85 -0
- data/lib/dogtrainer/version.rb +4 -0
- data/spec/spec_helper.rb +57 -0
- data/spec/unit/api_spec.rb +1229 -0
- data/spec/unit/logging_spec.rb +80 -0
- metadata +423 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'dogtrainer'
|
2
|
+
|
3
|
+
class LogTest
|
4
|
+
include DogTrainer::Logging
|
5
|
+
end
|
6
|
+
|
7
|
+
describe DogTrainer::Logging do
|
8
|
+
subject do
|
9
|
+
LogTest.new
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#logger_name' do
|
13
|
+
it 'returns the string class name' do
|
14
|
+
expect(subject.logger_name).to eq('LogTest')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#logger' do
|
19
|
+
it 'returns a new logger with the right outputter' do
|
20
|
+
dbl = double(Log4r::Logger)
|
21
|
+
out_dbl = double
|
22
|
+
allow(subject).to receive(:logger_name).and_return('myname')
|
23
|
+
allow(Log4r::Logger).to receive(:[]).and_return(nil)
|
24
|
+
allow(Log4r::Logger).to receive(:new).and_return(dbl)
|
25
|
+
allow(DogTrainer::Logging).to receive(:outputter).and_return(out_dbl)
|
26
|
+
allow(dbl).to receive(:add)
|
27
|
+
|
28
|
+
expect(subject).to receive(:logger_name).once
|
29
|
+
expect(Log4r::Logger).to receive(:[]).once.with('myname')
|
30
|
+
expect(Log4r::Logger).to receive(:new).once.with('myname')
|
31
|
+
expect(dbl).to receive(:add).once.with(out_dbl)
|
32
|
+
expect(subject.logger).to eq(dbl)
|
33
|
+
end
|
34
|
+
it 'returns the existing @logger if present' do
|
35
|
+
dbl = double(Log4r::Logger)
|
36
|
+
out_dbl = double
|
37
|
+
log = subject.logger
|
38
|
+
allow(subject).to receive(:logger_name).and_return('myname')
|
39
|
+
allow(Log4r::Logger).to receive(:[]).and_return(nil)
|
40
|
+
allow(Log4r::Logger).to receive(:new).and_return(dbl)
|
41
|
+
allow(DogTrainer::Logging).to receive(:outputter).and_return(out_dbl)
|
42
|
+
allow(dbl).to receive(:add)
|
43
|
+
|
44
|
+
expect(subject).to_not receive(:logger_name)
|
45
|
+
expect(Log4r::Logger).to_not receive(:[])
|
46
|
+
expect(Log4r::Logger).to_not receive(:new)
|
47
|
+
expect(dbl).to_not receive(:add)
|
48
|
+
expect(subject.logger).to eq(log)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#level=' do
|
53
|
+
context 'level >= INFO' do
|
54
|
+
it 'sets the level' do
|
55
|
+
DogTrainer::Logging.level = Log4r::WARN
|
56
|
+
expect(DogTrainer::Logging.outputter.level).to eq(Log4r::WARN)
|
57
|
+
end
|
58
|
+
it 'sets the outputter to default' do
|
59
|
+
DogTrainer::Logging.level = Log4r::WARN
|
60
|
+
expect(DogTrainer::Logging.outputter.formatter)
|
61
|
+
.to be_a(Log4r::PatternFormatter)
|
62
|
+
expect(DogTrainer::Logging.outputter.formatter.pattern)
|
63
|
+
.to eq('%l\t -> %m')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
context 'level < INFO' do
|
67
|
+
it 'sets the level' do
|
68
|
+
DogTrainer::Logging.level = Log4r::DEBUG
|
69
|
+
expect(DogTrainer::Logging.outputter.level).to eq(Log4r::DEBUG)
|
70
|
+
end
|
71
|
+
it 'sets the outputter to default' do
|
72
|
+
DogTrainer::Logging.level = Log4r::DEBUG
|
73
|
+
expect(DogTrainer::Logging.outputter.formatter)
|
74
|
+
.to be_a(Log4r::PatternFormatter)
|
75
|
+
expect(DogTrainer::Logging.outputter.formatter.pattern)
|
76
|
+
.to eq('[%d - %C - %l] %m')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,423 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dogtrainer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jantman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dogapi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: log4r
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby_dep
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: listen
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.7
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.7
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rb-readline
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: cri
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: diplomat
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.15'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.15'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: faraday
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.9'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.9'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: ghpages_deploy
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.3'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: git
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.2'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 1.2.9.1
|
163
|
+
type: :development
|
164
|
+
prerelease: false
|
165
|
+
version_requirements: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '1.2'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 1.2.9.1
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: guard
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '2.13'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - "~>"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '2.13'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: guard-bundler
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '2.1'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '2.1'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: guard-rspec
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: 4.6.4
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: 4.6.4
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: guard-rubocop
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '1.2'
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '1.2'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: guard-yard
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '2.1'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - "~>"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '2.1'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: json
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 1.8.3
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 1.8.3
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: rake
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - "~>"
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '10'
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - "~>"
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '10'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: retries
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - "~>"
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: 0.0.5
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - "~>"
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: 0.0.5
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: rspec
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - "~>"
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '3'
|
292
|
+
type: :development
|
293
|
+
prerelease: false
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
295
|
+
requirements:
|
296
|
+
- - "~>"
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '3'
|
299
|
+
- !ruby/object:Gem::Dependency
|
300
|
+
name: rspec_junit_formatter
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - "~>"
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: '0.2'
|
306
|
+
type: :development
|
307
|
+
prerelease: false
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
309
|
+
requirements:
|
310
|
+
- - "~>"
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
version: '0.2'
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: rubocop
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
316
|
+
requirements:
|
317
|
+
- - "~>"
|
318
|
+
- !ruby/object:Gem::Version
|
319
|
+
version: '0.37'
|
320
|
+
type: :development
|
321
|
+
prerelease: false
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - "~>"
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0.37'
|
327
|
+
- !ruby/object:Gem::Dependency
|
328
|
+
name: simplecov
|
329
|
+
requirement: !ruby/object:Gem::Requirement
|
330
|
+
requirements:
|
331
|
+
- - "~>"
|
332
|
+
- !ruby/object:Gem::Version
|
333
|
+
version: '0.11'
|
334
|
+
type: :development
|
335
|
+
prerelease: false
|
336
|
+
version_requirements: !ruby/object:Gem::Requirement
|
337
|
+
requirements:
|
338
|
+
- - "~>"
|
339
|
+
- !ruby/object:Gem::Version
|
340
|
+
version: '0.11'
|
341
|
+
- !ruby/object:Gem::Dependency
|
342
|
+
name: simplecov-console
|
343
|
+
requirement: !ruby/object:Gem::Requirement
|
344
|
+
requirements:
|
345
|
+
- - ">="
|
346
|
+
- !ruby/object:Gem::Version
|
347
|
+
version: '0'
|
348
|
+
type: :development
|
349
|
+
prerelease: false
|
350
|
+
version_requirements: !ruby/object:Gem::Requirement
|
351
|
+
requirements:
|
352
|
+
- - ">="
|
353
|
+
- !ruby/object:Gem::Version
|
354
|
+
version: '0'
|
355
|
+
- !ruby/object:Gem::Dependency
|
356
|
+
name: yard
|
357
|
+
requirement: !ruby/object:Gem::Requirement
|
358
|
+
requirements:
|
359
|
+
- - "~>"
|
360
|
+
- !ruby/object:Gem::Version
|
361
|
+
version: '0.8'
|
362
|
+
type: :development
|
363
|
+
prerelease: false
|
364
|
+
version_requirements: !ruby/object:Gem::Requirement
|
365
|
+
requirements:
|
366
|
+
- - "~>"
|
367
|
+
- !ruby/object:Gem::Version
|
368
|
+
version: '0.8'
|
369
|
+
description: Provides a slightly opinionated wrapper class around DataDog's dogapi
|
370
|
+
to simplify the creation and updating of Monitors, TimeBoards and ScreenBoards.
|
371
|
+
email:
|
372
|
+
- jason@jasonantman.com
|
373
|
+
executables: []
|
374
|
+
extensions: []
|
375
|
+
extra_rdoc_files: []
|
376
|
+
files:
|
377
|
+
- ".gitignore"
|
378
|
+
- ".rubocop.yml"
|
379
|
+
- ChangeLog.md
|
380
|
+
- Gemfile
|
381
|
+
- Guardfile
|
382
|
+
- LICENSE.txt
|
383
|
+
- README.md
|
384
|
+
- Rakefile
|
385
|
+
- circle.yml
|
386
|
+
- dogtrainer.gemspec
|
387
|
+
- lib/dogtrainer.rb
|
388
|
+
- lib/dogtrainer/api.rb
|
389
|
+
- lib/dogtrainer/logging.rb
|
390
|
+
- lib/dogtrainer/version.rb
|
391
|
+
- spec/spec_helper.rb
|
392
|
+
- spec/unit/api_spec.rb
|
393
|
+
- spec/unit/logging_spec.rb
|
394
|
+
homepage: http://github.com/Manheim/dogtrainer
|
395
|
+
licenses:
|
396
|
+
- MIT
|
397
|
+
metadata:
|
398
|
+
allowed_push_host: https://rubygems.org
|
399
|
+
post_install_message:
|
400
|
+
rdoc_options: []
|
401
|
+
require_paths:
|
402
|
+
- lib
|
403
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
404
|
+
requirements:
|
405
|
+
- - ">="
|
406
|
+
- !ruby/object:Gem::Version
|
407
|
+
version: '0'
|
408
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
409
|
+
requirements:
|
410
|
+
- - ">="
|
411
|
+
- !ruby/object:Gem::Version
|
412
|
+
version: '0'
|
413
|
+
requirements: []
|
414
|
+
rubyforge_project:
|
415
|
+
rubygems_version: 2.4.8
|
416
|
+
signing_key:
|
417
|
+
specification_version: 4
|
418
|
+
summary: Wrapper around DataDog dogapi gem to simplify creation and management of
|
419
|
+
Monitors and Boards
|
420
|
+
test_files:
|
421
|
+
- spec/spec_helper.rb
|
422
|
+
- spec/unit/api_spec.rb
|
423
|
+
- spec/unit/logging_spec.rb
|