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
@@ -17,13 +17,14 @@ describe Ayadn::View do
17
17
  symbols: :green,
18
18
  index: :blue,
19
19
  date: :cyan,
20
- link: :magenta
20
+ link: :magenta,
21
+ excerpt: :green
21
22
  },
22
23
  timeline: {
23
- show_real_name: true,
24
- show_date: true,
25
- show_symbols: true,
26
- show_source: true
24
+ name: true,
25
+ date: true,
26
+ symbols: true,
27
+ source: true
27
28
  },
28
29
  formats: {
29
30
  table: {width: 75},
@@ -31,16 +32,21 @@ describe Ayadn::View do
31
32
  },
32
33
  counts: {
33
34
  default: 33
34
- }
35
+ },
36
+ blacklist: {active: true}
35
37
  })
36
38
  Ayadn::Settings.stub(:config).and_return({
37
39
  identity: {
38
40
  username: 'test'
39
41
  }
40
42
  })
43
+ Ayadn::Settings.stub(:global).and_return({
44
+ scrolling: false
45
+ })
41
46
  Ayadn::Logs.stub(:rec).and_return("logged")
42
47
  Ayadn::Databases.stub(:blacklist).and_return("blacklist")
43
48
  Ayadn::Databases.stub(:save_indexed_posts).and_return("indexed")
49
+ Ayadn::Databases.stub(:is_in_blacklist?).and_return(false)
44
50
  end
45
51
 
46
52
  describe "#settings" do
@@ -9,17 +9,39 @@ describe Ayadn::Workers do
9
9
  colors: {
10
10
  hashtags: :cyan,
11
11
  mentions: :red,
12
- username: :green
12
+ username: :green,
13
+ excerpt: :green
13
14
  },
14
15
  timeline: {compact: false},
15
- formats: {table: {width: 75}, list: {reverse: true}}
16
+ formats: {table: {width: 75}, list: {reverse: true}},
17
+ blacklist: {active: true}
16
18
  })
19
+ Ayadn::Settings.stub(:config).and_return({
20
+ identity: {
21
+ username: 'test',
22
+ handle: '@test'
23
+ },
24
+ post_max_length: 256,
25
+ message_max_length: 2048,
26
+ version: 'wee',
27
+ paths: {
28
+ db: 'spec/mock/',
29
+ log: 'spec/mock'
30
+ }
31
+ })
32
+ Ayadn::Settings.stub(:global).and_return({
33
+ scrolling: false,
34
+ force: false
35
+ })
17
36
  Ayadn::Logs.stub(:rec).and_return("logged")
18
37
  Ayadn::Databases.stub(:blacklist).and_return("blacklist")
19
38
  Ayadn::Databases.stub(:users).and_return("users")
20
- Ayadn::Databases.stub(:get_post_from_index).and_return({id: 3312})
21
39
  Ayadn::Databases.stub(:get_index_length).and_return(50)
40
+ Ayadn::Databases.stub(:get_post_from_index).and_return(30000)
41
+ Ayadn::Databases.stub(:is_in_blacklist?).and_return(false)
42
+ Dir.stub(:home).and_return("spec/mock")
22
43
  @workers = Ayadn::Workers.new
44
+ Ayadn::Databases.open_databases
23
45
  end
24
46
 
25
47
  let(:data) { JSON.parse(File.read("spec/mock/stream.json")) }
@@ -28,7 +50,7 @@ describe Ayadn::Workers do
28
50
  let(:users_list) { JSON.parse(File.read("spec/mock/fwr_@ayadn.json")) }
29
51
  #let(:rest) {Ayadn::CNX = double} #verbose in RSpec output, but useful
30
52
  let(:rest) {Ayadn::CNX}
31
- let(:list) { {"007"=>["bond", "James Bond", true, true], "666"=>["mrtest", "Mr Test", false, false]} }
53
+ let(:list) { {"007"=>["bond", "James Bond", true, true, 7], "666"=>["mrtest", "Mr Test", false, false, 33012]} }
32
54
 
33
55
  describe "#build_posts" do
34
56
  it "builds posts hash from stream" do
@@ -48,7 +70,6 @@ describe Ayadn::Workers do
48
70
  expect(posts[23187443][:has_checkins]).to be false
49
71
  expect(posts[23187443][:mentions]).to eq []
50
72
  expect(posts[23187443][:checkins]).to be_empty
51
- expect(posts[23187443].length).to eq 33
52
73
  end
53
74
  it "gets oembed link from checkins post" do
54
75
  posts = @workers.build_posts(checkins['data'])
@@ -65,10 +86,9 @@ describe Ayadn::Workers do
65
86
  end
66
87
  end
67
88
 
68
- describe "#get_real_post_id" do
69
- it "gets real post id" do
70
- id = @workers.get_real_post_id(8)
71
- expect(id).to eq 3312
89
+ describe "#get_post_from_index" do
90
+ it "returns the true post id if number is not in index" do
91
+ expect(@workers.get_post_from_index("30000")).to eq 30000
72
92
  end
73
93
  end
74
94
 
@@ -96,9 +116,9 @@ describe Ayadn::Workers do
96
116
  describe "#extract_users" do
97
117
  it "extracts users" do
98
118
  usr = @workers.extract_users(users_list[0])
99
- expect(usr["52985"]).to eq ["schmidt_fu", "Florian Schmidt", false, false]
100
- expect(usr["185581"]).to eq ["aya_tests", "@ericd's tests account", nil, nil]
101
- expect(usr["69904"]).to eq ["ericd", "Eric Dejonckheere", true, true]
119
+ expect(usr["52985"]).to eq ["schmidt_fu", "Florian Schmidt", false, false, 5370]
120
+ expect(usr["185581"]).to eq ["aya_tests", "@ericd's tests account", nil, nil, 662]
121
+ expect(usr["69904"]).to eq ["ericd", "Eric Dejonckheere", true, true, 4513]
102
122
  end
103
123
  end
104
124
 
@@ -129,6 +149,8 @@ describe Ayadn::Workers do
129
149
  expect(printed).to include "@test"
130
150
  expect(printed).to include "@bond"
131
151
  expect(printed).to include "Mr Test"
152
+ expect(printed).to include "33012"
153
+ expect(printed).to include "7"
132
154
  end
133
155
  end
134
156
 
@@ -143,6 +165,8 @@ describe Ayadn::Workers do
143
165
  expect(printed).to include "@test"
144
166
  expect(printed).to include "@bond"
145
167
  expect(printed).to include "Mr Test"
168
+ expect(printed).to include "33012"
169
+ expect(printed).to include "7"
146
170
  end
147
171
  end
148
172
 
@@ -156,6 +180,7 @@ describe Ayadn::Workers do
156
180
  end
157
181
  expect(printed).to include "@bond"
158
182
  expect(printed).to include "Mr Test"
183
+ expect(printed).to include "33012"
159
184
  end
160
185
  end
161
186
 
@@ -169,6 +194,7 @@ describe Ayadn::Workers do
169
194
  end
170
195
  expect(printed).to include "@bond"
171
196
  expect(printed).to include "Mr Test"
197
+ expect(printed).to include "33012"
172
198
  end
173
199
  end
174
200