ayadn 1.7.2 → 1.7.3
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 +7 -0
- data/doc/01-index.md +10 -5
- data/doc/02-install.md +2 -2
- data/doc/03-first-steps.md +2 -2
- data/doc/04-options.md +4 -2
- data/doc/05-streams.md +22 -12
- data/doc/06-post.md +17 -7
- data/doc/07-actions.md +20 -20
- data/doc/08-listings.md +20 -2
- data/doc/09-accounts.md +2 -2
- data/doc/10-nicerank.md +12 -15
- data/doc/11-blacklist.md +13 -3
- data/doc/13-bookmark.md +4 -2
- data/doc/14-set.md +7 -3
- data/doc/15-nowplaying.md +3 -1
- data/doc/16-movie.md +4 -11
- data/doc/17-tvshow.md +3 -1
- data/doc/18-contact.md +6 -0
- data/doc/19-examples.md +1 -1
- data/lib/ayadn/action.rb +3 -1
- data/lib/ayadn/app.rb +1 -0
- data/lib/ayadn/cnx.rb +3 -0
- data/lib/ayadn/errors.rb +1 -0
- data/lib/ayadn/set.rb +189 -127
- data/lib/ayadn/settings.rb +4 -0
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn/workers.rb +6 -1
- data/spec/unit/set_spec.rb +42 -5
- data/spec/unit/workers_spec.rb +2 -7
- metadata +2 -2
data/lib/ayadn/set.rb
CHANGED
@@ -10,7 +10,6 @@ module Ayadn
|
|
10
10
|
else
|
11
11
|
abort(Status.error_missing_parameters)
|
12
12
|
end
|
13
|
-
scroll_config.log(args)
|
14
13
|
scroll_config.save
|
15
14
|
end
|
16
15
|
|
@@ -23,7 +22,6 @@ module Ayadn
|
|
23
22
|
else
|
24
23
|
abort(Status.error_missing_parameters)
|
25
24
|
end
|
26
|
-
movie_config.log(args)
|
27
25
|
movie_config.save
|
28
26
|
end
|
29
27
|
|
@@ -36,7 +34,6 @@ module Ayadn
|
|
36
34
|
else
|
37
35
|
abort(Status.error_missing_parameters)
|
38
36
|
end
|
39
|
-
tvshow_config.log(args)
|
40
37
|
tvshow_config.save
|
41
38
|
end
|
42
39
|
|
@@ -49,7 +46,6 @@ module Ayadn
|
|
49
46
|
else
|
50
47
|
abort(Status.error_missing_parameters)
|
51
48
|
end
|
52
|
-
nicerank_config.log(args)
|
53
49
|
nicerank_config.save
|
54
50
|
end
|
55
51
|
|
@@ -69,7 +65,6 @@ module Ayadn
|
|
69
65
|
else
|
70
66
|
abort(Status.error_missing_parameters)
|
71
67
|
end
|
72
|
-
timeline_config.log(args)
|
73
68
|
timeline_config.save
|
74
69
|
end
|
75
70
|
|
@@ -90,7 +85,6 @@ module Ayadn
|
|
90
85
|
else
|
91
86
|
abort(Status.error_missing_parameters)
|
92
87
|
end
|
93
|
-
counts_config.log(args)
|
94
88
|
counts_config.save
|
95
89
|
end
|
96
90
|
|
@@ -113,7 +107,6 @@ module Ayadn
|
|
113
107
|
else
|
114
108
|
abort(Status.error_missing_parameters)
|
115
109
|
end
|
116
|
-
color_config.log(args)
|
117
110
|
color_config.save
|
118
111
|
end
|
119
112
|
|
@@ -133,7 +126,6 @@ module Ayadn
|
|
133
126
|
else
|
134
127
|
abort(Status.error_missing_parameters)
|
135
128
|
end
|
136
|
-
backup_config.log(args)
|
137
129
|
backup_config.save
|
138
130
|
end
|
139
131
|
|
@@ -143,9 +135,30 @@ module Ayadn
|
|
143
135
|
Settings.restore_defaults
|
144
136
|
puts Status.done
|
145
137
|
end
|
138
|
+
|
139
|
+
desc "formats ITEM VALUE", "Set values for formatting fields"
|
140
|
+
def formats(*args)
|
141
|
+
formats_config = SetFormats.new
|
142
|
+
if args[0]
|
143
|
+
begin
|
144
|
+
command = args.shift
|
145
|
+
formats_config.send(command, args)
|
146
|
+
rescue NoMethodError, ArgumentError
|
147
|
+
puts Status.error_missing_parameters
|
148
|
+
exit
|
149
|
+
rescue => e
|
150
|
+
raise e
|
151
|
+
end
|
152
|
+
else
|
153
|
+
abort(Status.error_missing_parameters)
|
154
|
+
end
|
155
|
+
formats_config.save
|
156
|
+
end
|
157
|
+
|
146
158
|
end
|
147
159
|
|
148
160
|
class Validators
|
161
|
+
|
149
162
|
def self.boolean(value)
|
150
163
|
case value.downcase
|
151
164
|
when "true", "1", "yes"
|
@@ -156,6 +169,7 @@ module Ayadn
|
|
156
169
|
abort(Status.error_missing_parameters)
|
157
170
|
end
|
158
171
|
end
|
172
|
+
|
159
173
|
def self.index_range(min, max, value)
|
160
174
|
x = value.to_i
|
161
175
|
if x >= min && x <= max
|
@@ -164,6 +178,7 @@ module Ayadn
|
|
164
178
|
abort(Status.must_be_integer)
|
165
179
|
end
|
166
180
|
end
|
181
|
+
|
167
182
|
def self.cache_range value
|
168
183
|
if value >= 1 && value <= 168
|
169
184
|
value.round
|
@@ -171,6 +186,15 @@ module Ayadn
|
|
171
186
|
abort(Status.cache_range)
|
172
187
|
end
|
173
188
|
end
|
189
|
+
|
190
|
+
def self.width_range value
|
191
|
+
if value >= 60 && value <= 90
|
192
|
+
value.round
|
193
|
+
else
|
194
|
+
75
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
174
198
|
def self.threshold value
|
175
199
|
value = value.to_f
|
176
200
|
if value > 0 and value < 5
|
@@ -179,232 +203,270 @@ module Ayadn
|
|
179
203
|
abort(Status.threshold)
|
180
204
|
end
|
181
205
|
end
|
206
|
+
|
182
207
|
def self.timer(t)
|
183
|
-
t = t.
|
208
|
+
t = t.to_f.round
|
184
209
|
t >= 1 ? t : 3
|
185
210
|
end
|
211
|
+
|
186
212
|
def self.color(color)
|
187
213
|
colors_list = %w{red green magenta cyan yellow blue white black}
|
188
214
|
unless colors_list.include?(color.to_s)
|
189
215
|
puts Status.error_missing_parameters
|
190
216
|
abort(Status.valid_colors(colors_list))
|
191
217
|
else
|
192
|
-
return color
|
218
|
+
return color.to_sym
|
193
219
|
end
|
194
220
|
end
|
221
|
+
|
195
222
|
end
|
196
223
|
|
197
|
-
class
|
224
|
+
class SetBase
|
225
|
+
|
226
|
+
attr_accessor :input, :output, :category
|
227
|
+
|
198
228
|
def initialize
|
199
|
-
Settings.load_config
|
200
|
-
Settings.get_token
|
201
|
-
Settings.init_config
|
202
|
-
Logs.create_logger
|
229
|
+
Settings.load_config()
|
230
|
+
Settings.get_token()
|
231
|
+
Settings.init_config()
|
232
|
+
Logs.create_logger()
|
203
233
|
end
|
204
|
-
|
205
|
-
|
234
|
+
|
235
|
+
def save
|
236
|
+
Settings.save_config()
|
237
|
+
log()
|
238
|
+
end
|
239
|
+
|
240
|
+
def log
|
241
|
+
x = "New value for '#{@input}' in '#{@category}' => #{@output}"
|
206
242
|
puts "\n#{x}\n".color(:cyan)
|
207
243
|
Logs.rec.info x
|
208
244
|
end
|
209
|
-
|
210
|
-
|
245
|
+
|
246
|
+
end
|
247
|
+
|
248
|
+
class SetFormats < SetBase
|
249
|
+
|
250
|
+
def initialize
|
251
|
+
super
|
252
|
+
@category = 'formats'
|
253
|
+
end
|
254
|
+
|
255
|
+
def table(args)
|
256
|
+
type = args.shift.downcase
|
257
|
+
value = args[0].to_i
|
258
|
+
if type == 'width'
|
259
|
+
@input = 'table width'
|
260
|
+
@output = Validators.width_range(value)
|
261
|
+
Settings.options[:formats][:table][:width] = @output
|
262
|
+
else
|
263
|
+
abort(Status.error_missing_parameters)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
def tables(args)
|
268
|
+
table(args)
|
211
269
|
end
|
270
|
+
|
271
|
+
def list(args)
|
272
|
+
type = args.shift.downcase
|
273
|
+
value = args[0]
|
274
|
+
if type == 'reverse' || type == 'reversed'
|
275
|
+
@input = 'list reverse'
|
276
|
+
@output = Validators.boolean(value)
|
277
|
+
Settings.options[:formats][:list][:reverse] = @output
|
278
|
+
else
|
279
|
+
abort(Status.error_missing_parameters)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
def lists(args)
|
284
|
+
list(args)
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
class SetScroll < SetBase
|
290
|
+
|
291
|
+
def initialize
|
292
|
+
super
|
293
|
+
@category = 'scroll'
|
294
|
+
end
|
295
|
+
|
212
296
|
def validate(t)
|
213
297
|
Validators.timer(t)
|
214
298
|
end
|
299
|
+
|
215
300
|
def timer(t)
|
216
|
-
|
301
|
+
@input = 'timer'
|
302
|
+
@output = validate(t)
|
303
|
+
Settings.options[:scroll][:timer] = @output
|
217
304
|
end
|
305
|
+
|
218
306
|
end
|
219
307
|
|
220
|
-
class SetMovie
|
308
|
+
class SetMovie < SetBase
|
309
|
+
|
221
310
|
def initialize
|
222
|
-
|
223
|
-
|
224
|
-
Settings.init_config
|
225
|
-
Logs.create_logger
|
226
|
-
end
|
227
|
-
def log(args)
|
228
|
-
x = "New value for '#{args[0]}' in 'Movie' => #{args[1]}"
|
229
|
-
puts "\n#{x}\n".color(:cyan)
|
230
|
-
Logs.rec.info x
|
231
|
-
end
|
232
|
-
def save
|
233
|
-
Settings.save_config
|
311
|
+
super
|
312
|
+
@category = 'movie'
|
234
313
|
end
|
314
|
+
|
235
315
|
def hashtag(tag)
|
236
|
-
|
316
|
+
@input = 'hashtag'
|
317
|
+
@output = tag
|
318
|
+
Settings.options[:movie][:hashtag] = @output
|
237
319
|
end
|
320
|
+
|
238
321
|
end
|
239
322
|
|
240
|
-
class SetTVShow
|
323
|
+
class SetTVShow < SetBase
|
324
|
+
|
241
325
|
def initialize
|
242
|
-
|
243
|
-
|
244
|
-
Settings.init_config
|
245
|
-
Logs.create_logger
|
246
|
-
end
|
247
|
-
def log(args)
|
248
|
-
x = "New value for '#{args[0]}' in 'TV Show' => #{args[1]}"
|
249
|
-
puts "\n#{x}\n".color(:cyan)
|
250
|
-
Logs.rec.info x
|
251
|
-
end
|
252
|
-
def save
|
253
|
-
Settings.save_config
|
326
|
+
super
|
327
|
+
@category = 'tvshow'
|
254
328
|
end
|
329
|
+
|
255
330
|
def hashtag(tag)
|
256
|
-
|
331
|
+
@input = 'hashtag'
|
332
|
+
@output = tag
|
333
|
+
Settings.options[:tvshow][:hashtag] = @output
|
257
334
|
end
|
335
|
+
|
258
336
|
end
|
259
337
|
|
260
|
-
class SetNiceRank
|
338
|
+
class SetNiceRank < SetBase
|
339
|
+
|
261
340
|
def initialize
|
262
|
-
|
263
|
-
|
264
|
-
Settings.init_config
|
265
|
-
Logs.create_logger
|
266
|
-
end
|
267
|
-
def log(args)
|
268
|
-
x = "New value for '#{args[0]}' in 'NiceRank' => #{args[1]}"
|
269
|
-
puts "\n#{x}\n".color(:cyan)
|
270
|
-
Logs.rec.info x
|
271
|
-
end
|
272
|
-
def save
|
273
|
-
Settings.save_config
|
341
|
+
super
|
342
|
+
@category = 'nicerank'
|
274
343
|
end
|
344
|
+
|
275
345
|
def filter value
|
276
|
-
|
346
|
+
@input = 'filter'
|
347
|
+
@output = Validators.boolean(value)
|
348
|
+
Settings.options[:nicerank][:filter] = @output
|
277
349
|
end
|
350
|
+
|
278
351
|
def filter_unranked value
|
279
|
-
|
352
|
+
@input = 'filter_unranked'
|
353
|
+
@output = Validators.boolean(value)
|
354
|
+
Settings.options[:nicerank][:filter_unranked] = @output
|
280
355
|
end
|
356
|
+
|
281
357
|
def threshold value
|
282
|
-
|
358
|
+
@input = 'threshold'
|
359
|
+
@output = Validators.threshold(value)
|
360
|
+
Settings.options[:nicerank][:threshold] = @output
|
283
361
|
end
|
362
|
+
|
284
363
|
def cache value
|
285
|
-
|
364
|
+
@input = 'cache'
|
365
|
+
@output = Validators.cache_range(value.to_i)
|
366
|
+
Settings.options[:nicerank][:cache] = @output
|
286
367
|
end
|
368
|
+
|
287
369
|
end
|
288
370
|
|
289
|
-
class SetBackup
|
371
|
+
class SetBackup < SetBase
|
372
|
+
|
290
373
|
def initialize
|
291
|
-
|
292
|
-
|
293
|
-
Settings.init_config
|
294
|
-
Logs.create_logger
|
295
|
-
end
|
296
|
-
def log(args)
|
297
|
-
x = "New value for '#{args[0]}' in 'Backup' => #{args[1]}"
|
298
|
-
puts "\n#{x}\n".color(:cyan)
|
299
|
-
Logs.rec.info x
|
300
|
-
end
|
301
|
-
def save
|
302
|
-
Settings.save_config
|
374
|
+
super
|
375
|
+
@category = 'backup'
|
303
376
|
end
|
377
|
+
|
304
378
|
def validate(value)
|
305
379
|
Validators.boolean(value)
|
306
380
|
end
|
381
|
+
|
307
382
|
def method_missing(meth, options)
|
308
|
-
|
383
|
+
@input = meth.to_s
|
384
|
+
@output = validate(options)
|
385
|
+
case @input
|
309
386
|
when 'auto_save_sent_posts', 'auto_save_sent_messages', 'auto_save_lists'
|
310
|
-
Settings.options[:backup][meth.to_sym] =
|
387
|
+
Settings.options[:backup][meth.to_sym] = @output
|
311
388
|
else
|
312
389
|
super
|
313
390
|
end
|
314
391
|
end
|
392
|
+
|
315
393
|
end
|
316
394
|
|
317
|
-
class SetCounts
|
395
|
+
class SetCounts < SetBase
|
396
|
+
|
318
397
|
def initialize
|
319
|
-
|
320
|
-
|
321
|
-
Settings.init_config
|
322
|
-
Logs.create_logger
|
323
|
-
end
|
324
|
-
def log(args)
|
325
|
-
x = "New value for '#{args[0]}' in 'Counts' => #{args[1]}"
|
326
|
-
puts "\n#{x}\n".color(:cyan)
|
327
|
-
Logs.rec.info x
|
328
|
-
end
|
329
|
-
def save
|
330
|
-
Settings.save_config
|
398
|
+
super
|
399
|
+
@category = 'counts'
|
331
400
|
end
|
401
|
+
|
332
402
|
def validate(value)
|
333
403
|
Validators.index_range(1, 200, value)
|
334
404
|
end
|
405
|
+
|
335
406
|
def method_missing(meth, options)
|
407
|
+
@input = meth.to_s.capitalize
|
408
|
+
@output = validate(options.to_i)
|
336
409
|
case meth.to_s
|
337
410
|
when 'default', 'unified', 'checkins', 'conversations', 'global', 'photos', 'trending', 'mentions', 'convo', 'posts', 'messages', 'search', 'whoreposted', 'whostarred', 'whatstarred', 'files'
|
338
|
-
Settings.options[:counts][meth.to_sym] =
|
411
|
+
Settings.options[:counts][meth.to_sym] = @output
|
339
412
|
else
|
340
413
|
super
|
341
414
|
end
|
342
415
|
end
|
416
|
+
|
343
417
|
end
|
344
418
|
|
345
|
-
class SetTimeline
|
419
|
+
class SetTimeline < SetBase
|
420
|
+
|
346
421
|
def initialize
|
347
|
-
|
348
|
-
|
349
|
-
Settings.init_config
|
350
|
-
Logs.create_logger
|
422
|
+
super
|
423
|
+
@category = 'timeline'
|
351
424
|
end
|
425
|
+
|
352
426
|
def validate(value)
|
353
427
|
Validators.boolean(value)
|
354
428
|
end
|
355
|
-
|
356
|
-
x = "New value for '#{args[0]}' in 'Timeline' => #{args[1]}"
|
357
|
-
puts "\n#{x}\n".color(:cyan)
|
358
|
-
Logs.rec.info x
|
359
|
-
end
|
360
|
-
def save
|
361
|
-
Settings.save_config
|
362
|
-
end
|
429
|
+
|
363
430
|
def method_missing(meth, options)
|
364
|
-
|
431
|
+
@input = meth.to_s
|
432
|
+
@output = validate(options)
|
433
|
+
case @input
|
365
434
|
when 'directed', 'html', 'show_source', 'show_symbols', 'show_real_name', 'show_date', 'show_spinner', 'show_debug'
|
366
|
-
Settings.options[:timeline][meth.to_sym] =
|
435
|
+
Settings.options[:timeline][meth.to_sym] = @output
|
367
436
|
when 'deleted', 'annotations'
|
368
437
|
abort(Status.not_mutable)
|
369
438
|
else
|
370
439
|
super
|
371
440
|
end
|
372
441
|
end
|
442
|
+
|
373
443
|
end
|
374
444
|
|
375
|
-
class SetColor
|
445
|
+
class SetColor < SetBase
|
446
|
+
|
376
447
|
def initialize
|
377
|
-
|
378
|
-
|
379
|
-
Settings.init_config
|
380
|
-
Logs.create_logger
|
448
|
+
super
|
449
|
+
@category = 'colors'
|
381
450
|
end
|
382
451
|
|
383
452
|
def validate(color)
|
384
453
|
Validators.color(color)
|
385
454
|
end
|
386
455
|
|
387
|
-
def log(args)
|
388
|
-
x = "New value for '#{args[0]}' in 'Colors' => #{args[1]}"
|
389
|
-
puts "\n#{x}\n".color(:cyan)
|
390
|
-
Logs.rec.info x
|
391
|
-
end
|
392
|
-
|
393
|
-
def save
|
394
|
-
Settings.save_config
|
395
|
-
end
|
396
|
-
|
397
456
|
def method_missing(meth, options)
|
457
|
+
@input = meth.to_s.capitalize
|
458
|
+
@output = validate(options)
|
398
459
|
case meth.to_s
|
399
460
|
when 'id', 'index', 'username', 'name', 'date', 'link', 'dots', 'hashtags', 'mentions', 'source', 'symbols', 'debug'
|
400
|
-
Settings.options[:colors][meth.to_sym] =
|
461
|
+
Settings.options[:colors][meth.to_sym] = @output
|
401
462
|
when 'hashtag', 'mention', 'symbol'
|
402
|
-
Settings.options[:colors]["#{meth}s".to_sym] =
|
463
|
+
Settings.options[:colors]["#{meth}s".to_sym] = @output
|
403
464
|
when 'client'
|
404
|
-
Settings.options[:colors][:source] =
|
465
|
+
Settings.options[:colors][:source] = @output
|
405
466
|
else
|
406
467
|
super
|
407
468
|
end
|
408
469
|
end
|
470
|
+
|
409
471
|
end
|
410
472
|
end
|
data/lib/ayadn/settings.rb
CHANGED
@@ -98,6 +98,7 @@ module Ayadn
|
|
98
98
|
conf[:nowplaying] = {} if conf[:nowplaying].nil?
|
99
99
|
conf[:movie] = {hashtag: 'nowwatching'} if conf[:movie].nil?
|
100
100
|
conf[:tvshow] = {hashtag: 'nowwatching'} if conf[:tvshow].nil?
|
101
|
+
conf[:formats][:list] = {reverse: true} if conf[:formats][:list].nil?
|
101
102
|
|
102
103
|
@options = conf
|
103
104
|
self.write_config_file(config_file, @options)
|
@@ -196,6 +197,9 @@ module Ayadn
|
|
196
197
|
formats: {
|
197
198
|
table: {
|
198
199
|
width: 75
|
200
|
+
},
|
201
|
+
list: {
|
202
|
+
reverse: true
|
199
203
|
}
|
200
204
|
},
|
201
205
|
colors: {
|
data/lib/ayadn/version.rb
CHANGED
data/lib/ayadn/workers.rb
CHANGED
@@ -508,9 +508,14 @@ module Ayadn
|
|
508
508
|
end
|
509
509
|
|
510
510
|
def build_users_array(list)
|
511
|
-
list.map do |key, value|
|
511
|
+
users = list.map do |key, value|
|
512
512
|
{:username => value[0], :name => value[1], :you_follow => value[2], :follows_you => value[3], :id => key}
|
513
513
|
end
|
514
|
+
if Settings.options[:formats][:list][:reverse]
|
515
|
+
return users.reverse
|
516
|
+
else
|
517
|
+
return users
|
518
|
+
end
|
514
519
|
end
|
515
520
|
|
516
521
|
def extract_checkins(post)
|
data/spec/unit/set_spec.rb
CHANGED
@@ -27,7 +27,10 @@ def init_stubs
|
|
27
27
|
show_spinner: true,
|
28
28
|
show_debug: false
|
29
29
|
},
|
30
|
-
formats: {
|
30
|
+
formats: {
|
31
|
+
table: {width: 75},
|
32
|
+
list: {reverse: true}
|
33
|
+
},
|
31
34
|
counts: {
|
32
35
|
default: 50,
|
33
36
|
unified: 100,
|
@@ -104,10 +107,6 @@ describe Ayadn::SetScroll do
|
|
104
107
|
expect(Ayadn::Settings.options[:scroll][:timer]).to eq 3
|
105
108
|
Ayadn::SetScroll.new.timer('johnson')
|
106
109
|
expect(Ayadn::Settings.options[:scroll][:timer]).to eq 3
|
107
|
-
Ayadn::SetScroll.new.timer('-666')
|
108
|
-
expect(Ayadn::Settings.options[:scroll][:timer]).to eq 3
|
109
|
-
Ayadn::SetScroll.new.timer('0')
|
110
|
-
expect(Ayadn::Settings.options[:scroll][:timer]).to eq 3
|
111
110
|
end
|
112
111
|
end
|
113
112
|
|
@@ -138,6 +137,44 @@ describe Ayadn::SetColor do
|
|
138
137
|
end
|
139
138
|
end
|
140
139
|
|
140
|
+
describe Ayadn::SetFormats do
|
141
|
+
before do
|
142
|
+
init_stubs
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "#table" do
|
146
|
+
it "creates a default table width" do
|
147
|
+
Ayadn::SetFormats.new.send(:table, ['width', '80'])
|
148
|
+
expect(Ayadn::Settings.options[:formats][:table][:width]).to eq 80
|
149
|
+
end
|
150
|
+
it "creates a default table width" do
|
151
|
+
Ayadn::SetFormats.new.send(:table, ['width', '33'])
|
152
|
+
expect(Ayadn::Settings.options[:formats][:table][:width]).to eq 75
|
153
|
+
end
|
154
|
+
it "creates a default table width" do
|
155
|
+
Ayadn::SetFormats.new.send(:table, ['width', 'yolo'])
|
156
|
+
expect(Ayadn::Settings.options[:formats][:table][:width]).to eq 75
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe "#list" do
|
161
|
+
it "creates a default list order" do
|
162
|
+
Ayadn::SetFormats.new.send(:list, ['reverse', 'false'])
|
163
|
+
expect(Ayadn::Settings.options[:formats][:list][:reverse]).to eq false
|
164
|
+
end
|
165
|
+
it "raises an error" do
|
166
|
+
printed = capture_stderr do
|
167
|
+
expect(lambda {Ayadn::SetFormats.new.send(:list, ['reverse', 'yolo'])}).to raise_error(SystemExit)
|
168
|
+
end
|
169
|
+
expect(printed).to include 'You have to submit valid items'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
after do
|
174
|
+
File.delete('spec/mock/ayadn.log')
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
141
178
|
describe Ayadn::SetTimeline do
|
142
179
|
before do
|
143
180
|
init_stubs
|
data/spec/unit/workers_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'helpers'
|
3
3
|
require 'json'
|
4
|
-
#require 'io/console'
|
5
4
|
|
6
5
|
describe Ayadn::Workers do
|
7
6
|
|
@@ -12,7 +11,7 @@ describe Ayadn::Workers do
|
|
12
11
|
mentions: :red,
|
13
12
|
username: :green
|
14
13
|
},
|
15
|
-
formats: {table: {width: 75}}
|
14
|
+
formats: {table: {width: 75}, list: {reverse: true}}
|
16
15
|
})
|
17
16
|
Ayadn::Logs.stub(:rec).and_return("logged")
|
18
17
|
Ayadn::Databases.stub(:blacklist).and_return("blacklist")
|
@@ -27,6 +26,7 @@ describe Ayadn::Workers do
|
|
27
26
|
let(:regex_post) { JSON.parse(File.read("spec/mock/regex.json")) }
|
28
27
|
let(:users_list) { JSON.parse(File.read("spec/mock/fwr_@ayadn.json")) }
|
29
28
|
let(:rest) {Ayadn::CNX = double} #verbose in RSpec output, but useful
|
29
|
+
let(:list) { {"007"=>["bond", "James Bond", true, true], "666"=>["mrtest", "Mr Test", false, false]} }
|
30
30
|
|
31
31
|
describe "#build_posts" do
|
32
32
|
it "builds posts hash from stream" do
|
@@ -116,8 +116,6 @@ describe Ayadn::Workers do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
let(:list) { {"007"=>["bond", "James Bond", true, true], "666"=>["mrtest", "Mr Test", false, false]} }
|
120
|
-
|
121
119
|
describe "#build_followers_list" do
|
122
120
|
before do
|
123
121
|
rest.stub(:get)
|
@@ -140,7 +138,6 @@ describe Ayadn::Workers do
|
|
140
138
|
printed = capture_stdout do
|
141
139
|
puts @workers.build_followings_list(list, "@test")
|
142
140
|
end
|
143
|
-
#expect(printed).to include "+~~~~"
|
144
141
|
expect(printed).to include "@test"
|
145
142
|
expect(printed).to include "@bond"
|
146
143
|
expect(printed).to include "Mr Test"
|
@@ -155,7 +152,6 @@ describe Ayadn::Workers do
|
|
155
152
|
printed = capture_stdout do
|
156
153
|
puts @workers.build_muted_list(list)
|
157
154
|
end
|
158
|
-
#expect(printed).to include "+----"
|
159
155
|
expect(printed).to include "@bond"
|
160
156
|
expect(printed).to include "Mr Test"
|
161
157
|
end
|
@@ -169,7 +165,6 @@ describe Ayadn::Workers do
|
|
169
165
|
printed = capture_stdout do
|
170
166
|
puts @workers.build_blocked_list(list)
|
171
167
|
end
|
172
|
-
#expect(printed).to include "+----"
|
173
168
|
expect(printed).to include "@bond"
|
174
169
|
expect(printed).to include "Mr Test"
|
175
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ayadn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|