ayadn 1.8.2 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/CHANGELOG.md +73 -52
  4. data/README.md +17 -3
  5. data/ayadn.gemspec +3 -4
  6. data/doc/01-index.md +6 -5
  7. data/doc/02-install.md +23 -1
  8. data/doc/03-first-steps.md +22 -28
  9. data/doc/04-options.md +1 -1
  10. data/doc/05-streams.md +29 -9
  11. data/doc/06-post.md +13 -5
  12. data/doc/07-actions.md +63 -1
  13. data/doc/08-listings.md +112 -4
  14. data/doc/09-accounts.md +17 -3
  15. data/doc/10-nicerank.md +5 -5
  16. data/doc/11-blacklist.md +8 -14
  17. data/doc/12-alias.md +1 -13
  18. data/doc/14-set.md +8 -110
  19. data/doc/15-nowplaying.md +16 -4
  20. data/doc/18-contact.md +14 -13
  21. data/doc/19-examples.md +2 -0
  22. data/lib/ayadn/action.rb +322 -183
  23. data/lib/ayadn/alias.rb +17 -45
  24. data/lib/ayadn/annotations.rb +1 -1
  25. data/lib/ayadn/api.rb +7 -8
  26. data/lib/ayadn/app.rb +99 -12
  27. data/lib/ayadn/authorize.rb +92 -57
  28. data/lib/ayadn/blacklist.rb +52 -62
  29. data/lib/ayadn/check.rb +81 -74
  30. data/lib/ayadn/cnx.rb +77 -26
  31. data/lib/ayadn/databases.rb +890 -105
  32. data/lib/ayadn/debug.rb +30 -89
  33. data/lib/ayadn/descriptions.rb +876 -329
  34. data/lib/ayadn/endpoints.rb +2 -2
  35. data/lib/ayadn/errors.rb +9 -9
  36. data/lib/ayadn/extend.rb +8 -1
  37. data/lib/ayadn/fileops.rb +10 -8
  38. data/lib/ayadn/mark.rb +79 -56
  39. data/lib/ayadn/migration.rb +427 -0
  40. data/lib/ayadn/nicerank.rb +74 -72
  41. data/lib/ayadn/nowplaying.rb +123 -60
  42. data/lib/ayadn/nowwatching.rb +26 -10
  43. data/lib/ayadn/pinboard.rb +12 -7
  44. data/lib/ayadn/post.rb +40 -37
  45. data/lib/ayadn/profile.rb +5 -2
  46. data/lib/ayadn/scroll.rb +20 -5
  47. data/lib/ayadn/search.rb +30 -22
  48. data/lib/ayadn/set.rb +146 -50
  49. data/lib/ayadn/settings.rb +66 -67
  50. data/lib/ayadn/status.rb +459 -234
  51. data/lib/ayadn/stream.rb +80 -46
  52. data/lib/ayadn/switch.rb +51 -47
  53. data/lib/ayadn/tvshow.rb +47 -15
  54. data/lib/ayadn/version.rb +1 -1
  55. data/lib/ayadn/view.rb +119 -60
  56. data/lib/ayadn/workers.rb +144 -92
  57. data/lib/ayadn.rb +7 -8
  58. data/spec/mock/ayadn/accounts.sqlite +0 -0
  59. data/spec/mock/ayadn.sqlite +0 -0
  60. data/spec/unit/annotations_spec.rb +12 -13
  61. data/spec/unit/api_spec.rb +3 -4
  62. data/spec/unit/blacklistworkers_spec.rb +18 -23
  63. data/spec/unit/databases_spec.rb +51 -36
  64. data/spec/unit/endpoints_spec.rb +5 -2
  65. data/spec/unit/extend_spec.rb +24 -0
  66. data/spec/unit/nicerank_spec.rb +13 -13
  67. data/spec/unit/post_spec.rb +47 -36
  68. data/spec/unit/set_spec.rb +67 -96
  69. data/spec/unit/view_spec.rb +12 -6
  70. data/spec/unit/workers_spec.rb +38 -12
  71. data/tags +1285 -0
  72. metadata +29 -39
  73. data/spec/mock/aliases.db +0 -0
  74. data/spec/mock/blacklist.db +0 -0
  75. data/spec/mock/bookmarks.db +0 -0
  76. data/spec/mock/channels.db +0 -0
  77. data/spec/mock/index.db +0 -0
  78. data/spec/mock/nicerank.db +0 -0
  79. data/spec/mock/pagination.db +0 -0
  80. data/spec/mock/users.db +0 -0
  81. data/spec/unit/status_spec.rb +0 -9
data/lib/ayadn/debug.rb CHANGED
@@ -3,107 +3,48 @@ module Ayadn
3
3
  class Debug
4
4
 
5
5
  def self.skipped dic
6
- if Settings.options[:timeline][:show_debug] == true
6
+ if Settings.options[:timeline][:debug] == true
7
7
  Logs.rec.debug "SKIPPED: #{dic.keys.first.to_s.capitalize} => #{dic.values.first}"
8
8
  end
9
9
  end
10
10
 
11
11
  def self.http response, url
12
- if Settings.options[:timeline][:show_debug] == true
13
- # deb = ":::::\n"
14
- # deb << "Url:\t\t#{url}\n\n"
15
- # deb << "Headers:\t#{response.headers}\n"
16
- # deb << ":::::\n"
17
- # puts deb.color(Settings.options[:colors][:debug])
12
+ if Settings.options[:timeline][:debug] == true
13
+ deb = "\n"
14
+ deb << "+ HTTP\n"
15
+ deb << "* t#{Time.now.to_i}\n"
16
+ deb << "Url: #{url}\n"
17
+ deb << "Code: #{response.code}\n"
18
+ deb << "\n"
19
+ puts deb.color(:green)
18
20
  Logs.rec.debug "HTTP/URL: #{url}"
19
21
  Logs.rec.debug "HTTP/HEADERS: #{response.headers}"
20
22
  end
21
23
  end
22
24
 
23
- def self.db dbs
24
- if Settings.options[:timeline][:show_debug] == true
25
- # puts "/////\nSETTINGS\n"
26
- # jj JSON.parse((Settings.config).to_json)
27
- # jj JSON.parse((Settings.options).to_json)
28
- # Logs.rec.debug "SETTINGS/CONFIG: #{Settings.config}"
29
- # Logs.rec.debug "SETTINGS/OPTIONS: #{Settings.options}"
30
- # puts "/////\n\n"
31
-
32
- #puts ">>>>>\nDATABASES\n"
33
- dbs.each do |db|
34
- #puts "Path:\t#{db.file}\nLength:\t#{db.size}\nSize:\t#{db.bytesize / 1024}KB"
35
- Logs.rec.debug "DB: #{File.basename(db.file)} - Length: #{db.size}, Size: #{db.bytesize / 1024}KB"
36
- end
37
- #puts ">>>>>\n\n"
38
-
39
- # puts "^^^^^\nTOKEN\n"
40
- # puts Settings.user_token
41
- # puts "^^^^^\n\n"
42
- end
43
- end
44
-
45
25
  def self.err error, stack
46
- Logs.rec.debug "+DEBUG STACK: #{stack}"
47
- if Settings.options[:timeline][:show_debug] == true
48
- puts "\n--*--\nERROR:\n"
26
+ # Logs.rec.debug "+DEBUG STACK: #{stack}"
27
+ if Settings.options[:timeline][:debug] == true
28
+ puts "\nDEBUG:\n"
29
+ puts error.inspect
49
30
  raise error
50
- puts "\n--*--\nSTACK:\n"
51
- puts stack
52
- puts "\n--*--\n\n"
53
- end
54
- end
55
-
56
- def self.how_many_ranks niceranks, get_these
57
- if Settings.options[:timeline][:show_debug] == true
58
- # deb = "=====\n"
59
- # deb << "NR from DB:\t#{niceranks}\n\n"
60
- # deb << "NR to get:\t#{get_these}\n"
61
- # deb << "=====\n"
62
- # puts deb.color(Settings.options[:colors][:debug])
63
- Logs.rec.debug "NR/FROM DB: #{niceranks}"
64
- Logs.rec.debug "NR/TO GET: #{get_these}"
65
- end
66
- end
67
-
68
- def self.ranks_pool niceranks
69
- if Settings.options[:timeline][:show_debug] == true
70
- # deb = "=====\n"
71
- # deb << "NR in pool:\t#{niceranks}\n"
72
- # deb << "=====\n"
73
- # puts deb.color(Settings.options[:colors][:debug])
74
- Logs.rec.debug "NR/IN POOL: #{niceranks}"
75
- end
76
- end
77
-
78
- def self.niceranks_error resp
79
- if Settings.options[:timeline][:show_debug] == true
80
- # deb = "=====\n"
81
- # deb << "NR Error:\t#{resp}\n"
82
- # deb << "=====\n"
83
- # puts deb.color(Settings.options[:colors][:debug])
84
- Logs.rec.error "NR/ERROR: #{resp}"
85
- end
86
- end
87
-
88
- def self.total_ranks niceranks
89
- if Settings.options[:timeline][:show_debug] == true
90
- # deb = "=====\n"
91
- # deb << "NiceRanks:\t#{niceranks}\n\n"
92
- # deb << "DB size:\t#{Databases.nicerank.size}\n"
93
- # deb << "=====\n"
94
- # puts deb.color(Settings.options[:colors][:debug])
95
- Logs.rec.debug "NR/RANKS: #{niceranks}"
96
- Logs.rec.debug "NR/DB SIZE: #{Databases.nicerank.size}"
97
- end
98
- end
99
-
100
- def self.stream stream, options, target
101
- if Settings.options[:timeline][:show_debug] == true
102
- # deb = "+++++\nStream meta:\t#{stream['meta']}\n\n"
103
- # deb << "Options:\t#{options.inspect}\n\n"
104
- # deb << "Target:\t\t#{target.inspect}\n\n"
105
- # deb << "Posts:\t\t#{stream['data'].length}\n+++++\n"
106
- # puts deb.color(Settings.options[:colors][:debug])
31
+ # puts "\nSTACK:\n"
32
+ # puts stack
33
+ # puts "\n--*--\n\n"
34
+ end
35
+ end
36
+
37
+ def self.stream(stream, options, target)
38
+ if Settings.options[:timeline][:debug] == true
39
+ deb = "\n"
40
+ deb << "+ STREAM\n"
41
+ deb << "* t#{Time.now.to_i}\n"
42
+ deb << "Options:\t#{options.inspect}\n"
43
+ deb << "Target:\t\t#{target.inspect}\n"
44
+ deb << "Posts:\t\t#{stream['data'].length}\n"
45
+ deb << "Meta:\t\t#{stream['meta']}\n"
46
+ deb << "\n"
47
+ puts deb.color(Settings.options[:colors][:debug])
107
48
  Logs.rec.debug "STREAM/META: #{stream['meta']}"
108
49
  Logs.rec.debug "STREAM/OPTIONS: #{options.inspect}"
109
50
  Logs.rec.debug "STREAM/TARGET: #{target.inspect}"