ayadn 1.8.2 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/CHANGELOG.md +73 -52
- data/README.md +17 -3
- data/ayadn.gemspec +3 -4
- data/doc/01-index.md +6 -5
- data/doc/02-install.md +23 -1
- data/doc/03-first-steps.md +22 -28
- data/doc/04-options.md +1 -1
- data/doc/05-streams.md +29 -9
- data/doc/06-post.md +13 -5
- data/doc/07-actions.md +63 -1
- data/doc/08-listings.md +112 -4
- data/doc/09-accounts.md +17 -3
- data/doc/10-nicerank.md +5 -5
- data/doc/11-blacklist.md +8 -14
- data/doc/12-alias.md +1 -13
- data/doc/14-set.md +8 -110
- data/doc/15-nowplaying.md +16 -4
- data/doc/18-contact.md +14 -13
- data/doc/19-examples.md +2 -0
- data/lib/ayadn/action.rb +322 -183
- data/lib/ayadn/alias.rb +17 -45
- data/lib/ayadn/annotations.rb +1 -1
- data/lib/ayadn/api.rb +7 -8
- data/lib/ayadn/app.rb +99 -12
- data/lib/ayadn/authorize.rb +92 -57
- data/lib/ayadn/blacklist.rb +52 -62
- data/lib/ayadn/check.rb +81 -74
- data/lib/ayadn/cnx.rb +77 -26
- data/lib/ayadn/databases.rb +890 -105
- data/lib/ayadn/debug.rb +30 -89
- data/lib/ayadn/descriptions.rb +876 -329
- data/lib/ayadn/endpoints.rb +2 -2
- data/lib/ayadn/errors.rb +9 -9
- data/lib/ayadn/extend.rb +8 -1
- data/lib/ayadn/fileops.rb +10 -8
- data/lib/ayadn/mark.rb +79 -56
- data/lib/ayadn/migration.rb +427 -0
- data/lib/ayadn/nicerank.rb +74 -72
- data/lib/ayadn/nowplaying.rb +123 -60
- data/lib/ayadn/nowwatching.rb +26 -10
- data/lib/ayadn/pinboard.rb +12 -7
- data/lib/ayadn/post.rb +40 -37
- data/lib/ayadn/profile.rb +5 -2
- data/lib/ayadn/scroll.rb +20 -5
- data/lib/ayadn/search.rb +30 -22
- data/lib/ayadn/set.rb +146 -50
- data/lib/ayadn/settings.rb +66 -67
- data/lib/ayadn/status.rb +459 -234
- data/lib/ayadn/stream.rb +80 -46
- data/lib/ayadn/switch.rb +51 -47
- data/lib/ayadn/tvshow.rb +47 -15
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn/view.rb +119 -60
- data/lib/ayadn/workers.rb +144 -92
- data/lib/ayadn.rb +7 -8
- data/spec/mock/ayadn/accounts.sqlite +0 -0
- data/spec/mock/ayadn.sqlite +0 -0
- data/spec/unit/annotations_spec.rb +12 -13
- data/spec/unit/api_spec.rb +3 -4
- data/spec/unit/blacklistworkers_spec.rb +18 -23
- data/spec/unit/databases_spec.rb +51 -36
- data/spec/unit/endpoints_spec.rb +5 -2
- data/spec/unit/extend_spec.rb +24 -0
- data/spec/unit/nicerank_spec.rb +13 -13
- data/spec/unit/post_spec.rb +47 -36
- data/spec/unit/set_spec.rb +67 -96
- data/spec/unit/view_spec.rb +12 -6
- data/spec/unit/workers_spec.rb +38 -12
- data/tags +1285 -0
- metadata +29 -39
- data/spec/mock/aliases.db +0 -0
- data/spec/mock/blacklist.db +0 -0
- data/spec/mock/bookmarks.db +0 -0
- data/spec/mock/channels.db +0 -0
- data/spec/mock/index.db +0 -0
- data/spec/mock/nicerank.db +0 -0
- data/spec/mock/pagination.db +0 -0
- data/spec/mock/users.db +0 -0
- 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][:
|
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][:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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][:
|
48
|
-
puts "\
|
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 "\
|
51
|
-
puts stack
|
52
|
-
puts "\n--*--\n\n"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.
|
57
|
-
if Settings.options[:timeline][:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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}"
|