twitter_ebooks 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.travis.yml +1 -1
- data/Gemfile +4 -4
- data/LICENSE +21 -21
- data/README.md +11 -1
- data/Rakefile +2 -2
- data/lib/twitter_ebooks/archive.rb +18 -4
- data/lib/twitter_ebooks/bot.rb +6 -0
- data/lib/twitter_ebooks/suffix.rb +5 -1
- data/lib/twitter_ebooks/version.rb +1 -1
- data/skeleton/bots.rb +5 -0
- data/spec/data/0xabad1dea.model +3 -3
- data/twitter_ebooks.gemspec +36 -34
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d762f4e50e4188c2da0a1b801756776992a9cd3
|
4
|
+
data.tar.gz: 3d731a6279c9ffee25e026f3d258b1a25db47aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd4a618769c7cd18edd180aab8b5e49ef908371e87bff33d60336b57b4c10c781cc2cf927a221e0abbce3ccfd6ea1f547dcb31d8f5ca3ae3fc9b1bbaf80c4c2
|
7
|
+
data.tar.gz: 8bb1eb693315625c9b102c19e6b0c0852d0c8b01c90f974c754d932c58f50ec88694e5e69ae3a8d696ee950eeb45c640dd77507730c76c4810769965af34c473
|
data/.gitattributes
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in twitter_ebooks.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in twitter_ebooks.gemspec
|
4
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2013 Jaiden Mispy
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1
|
+
Copyright (c) 2013 Jaiden Mispy
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Note that 3.0 is not backwards compatible with 2.x, so upgrade carefully! In par
|
|
21
21
|
|
22
22
|
## Installation
|
23
23
|
|
24
|
-
Requires Ruby 2.
|
24
|
+
Requires Ruby 2.1+. Ruby 2.3+ is recommended.
|
25
25
|
|
26
26
|
```bash
|
27
27
|
gem install twitter_ebooks
|
@@ -78,6 +78,16 @@ class MyBot < Ebooks::Bot
|
|
78
78
|
# Reply to a tweet in the bot's timeline
|
79
79
|
# reply(tweet, meta(tweet).reply_prefix + "nice tweet")
|
80
80
|
end
|
81
|
+
|
82
|
+
def on_favorite(user, tweet)
|
83
|
+
# Follow user who just favorited bot's tweet
|
84
|
+
# follow(user.screen_name)
|
85
|
+
end
|
86
|
+
|
87
|
+
def on_retweet(tweet)
|
88
|
+
# Follow user who just retweeted bot's tweet
|
89
|
+
# follow(tweet.user.screen_name)
|
90
|
+
end
|
81
91
|
end
|
82
92
|
|
83
93
|
# Make a MyBot and attach it to an account
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require "bundler/gem_tasks"
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
@@ -50,7 +50,8 @@ module Ebooks
|
|
50
50
|
@client = client || make_client
|
51
51
|
|
52
52
|
if File.exists?(@path)
|
53
|
-
@
|
53
|
+
@filetext = File.read(@path, :encoding => 'utf-8')
|
54
|
+
@tweets = JSON.parse(@filetext, symbolize_names: true)
|
54
55
|
log "Currently #{@tweets.length} tweets for #{@username}"
|
55
56
|
else
|
56
57
|
@tweets.nil?
|
@@ -59,6 +60,21 @@ module Ebooks
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def sync
|
63
|
+
# We use this structure to ensure that
|
64
|
+
# a) if there's an issue opening the file, we error out before download
|
65
|
+
# b) if there's an issue during download we restore the original
|
66
|
+
File.open(@path, 'w') do |file|
|
67
|
+
begin
|
68
|
+
sync_to(file)
|
69
|
+
rescue Exception
|
70
|
+
file.seek(0)
|
71
|
+
file.write(@filetext)
|
72
|
+
raise
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def sync_to(file)
|
62
78
|
retries = 0
|
63
79
|
tweets = []
|
64
80
|
max_id = nil
|
@@ -93,9 +109,7 @@ module Ebooks
|
|
93
109
|
@tweets = tweets.map(&:attrs).each { |tw|
|
94
110
|
tw.delete(:entities)
|
95
111
|
} + @tweets
|
96
|
-
|
97
|
-
f.write(JSON.pretty_generate(@tweets))
|
98
|
-
end
|
112
|
+
file.write(JSON.pretty_generate(@tweets))
|
99
113
|
end
|
100
114
|
end
|
101
115
|
end
|
data/lib/twitter_ebooks/bot.rb
CHANGED
@@ -270,6 +270,12 @@ module Ebooks
|
|
270
270
|
return unless ev.text # If it's not a text-containing tweet, ignore it
|
271
271
|
return if ev.user.id == @user.id # Ignore our own tweets
|
272
272
|
|
273
|
+
if ev.retweet? && ev.retweeted_tweet.user.id == @user.id
|
274
|
+
# Someone retweeted our tweet!
|
275
|
+
fire(:retweet, ev)
|
276
|
+
return
|
277
|
+
end
|
278
|
+
|
273
279
|
meta = meta(ev)
|
274
280
|
|
275
281
|
if blacklisted?(ev.user.screen_name)
|
@@ -89,7 +89,11 @@ module Ebooks
|
|
89
89
|
break if variant
|
90
90
|
end
|
91
91
|
|
92
|
-
|
92
|
+
# If we failed to produce a variation from any alternative, there
|
93
|
+
# is no use running additional passes-- they'll have the same result.
|
94
|
+
break if variant.nil?
|
95
|
+
|
96
|
+
tikis = variant
|
93
97
|
end
|
94
98
|
|
95
99
|
tikis
|
data/skeleton/bots.rb
CHANGED
@@ -51,6 +51,11 @@ class MyBot < Ebooks::Bot
|
|
51
51
|
# Follow user who just favorited bot's tweet
|
52
52
|
# follow(user.screen_name)
|
53
53
|
end
|
54
|
+
|
55
|
+
def on_retweet(tweet)
|
56
|
+
# Follow user who just retweeted bot's tweet
|
57
|
+
# follow(tweet.user.screen_name)
|
58
|
+
end
|
54
59
|
end
|
55
60
|
|
56
61
|
# Make a MyBot and attach it to an account
|
data/spec/data/0xabad1dea.model
CHANGED
@@ -2251,11 +2251,11 @@ ii
|
|
2251
2251
|
|
2252
2252
|
[[i�i�i
|
2253
2253
|
ii"i
|
2254
|
-
i-i
|
2254
|
+
i-i
|
2255
2255
|
i
|
2256
2256
|
i�i�i�i�ini�[i�i�i
|
2257
2257
|
ii"i
|
2258
|
-
i-i
|
2258
|
+
i-i
|
2259
2259
|
i
|
2260
2260
|
i�i�i�i�ini�[ i�i`ii�iLiii
|
2261
2261
|
i
|
@@ -4387,7 +4387,7 @@ i i0ini
|
|
4387
4387
|
ii�3[ii�i#iUiki�[i�3[
|
4388
4388
|
i� i
|
4389
4389
|
igi~iL[i6i�ii>iii�i�3i�i6ii4i*iVi�3ii�ii�ii�iik[i�iim inii�i�[
|
4390
|
-
i)i�ini�3i�3[ i�i�
|
4390
|
+
i)i�ini�3i�3[ i�i�
|
4391
4391
|
il iui�3i�[i�3iii<"i�3ii�i�i�i i>i�3[i i�3i�i
|
4392
4392
|
ii"i`/ii"i�i�iici�3[iiXii�i�i�i�3i�ii�3[iii�3[i�ic[
|
4393
4393
|
i�ii�i�3i�3[i.%ii�3[ i"i;
|
data/twitter_ebooks.gemspec
CHANGED
@@ -1,34 +1,36 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/twitter_ebooks/version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.
|
6
|
-
|
7
|
-
gem.
|
8
|
-
gem.
|
9
|
-
gem.
|
10
|
-
|
11
|
-
gem.
|
12
|
-
|
13
|
-
gem.
|
14
|
-
gem.
|
15
|
-
gem.
|
16
|
-
gem.
|
17
|
-
|
18
|
-
gem.
|
19
|
-
|
20
|
-
gem.add_development_dependency '
|
21
|
-
gem.add_development_dependency '
|
22
|
-
gem.add_development_dependency '
|
23
|
-
gem.add_development_dependency '
|
24
|
-
|
25
|
-
gem.
|
26
|
-
|
27
|
-
gem.add_runtime_dependency '
|
28
|
-
gem.add_runtime_dependency '
|
29
|
-
gem.add_runtime_dependency '
|
30
|
-
gem.add_runtime_dependency '
|
31
|
-
gem.add_runtime_dependency '
|
32
|
-
gem.add_runtime_dependency '
|
33
|
-
gem.add_runtime_dependency '
|
34
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/twitter_ebooks/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.required_ruby_version = '~> 2.1'
|
6
|
+
|
7
|
+
gem.authors = ["Jaiden Mispy"]
|
8
|
+
gem.email = ["^_^@mispy.me"]
|
9
|
+
gem.description = %q{Markov chains for all your friends~}
|
10
|
+
gem.summary = %q{Markov chains for all your friends~}
|
11
|
+
gem.homepage = ""
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.name = "twitter_ebooks"
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
gem.version = Ebooks::VERSION
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rspec'
|
21
|
+
gem.add_development_dependency 'rspec-mocks'
|
22
|
+
gem.add_development_dependency 'memory_profiler'
|
23
|
+
gem.add_development_dependency 'timecop'
|
24
|
+
gem.add_development_dependency 'pry-byebug'
|
25
|
+
gem.add_development_dependency 'yard'
|
26
|
+
|
27
|
+
gem.add_runtime_dependency 'twitter', '~> 5.15'
|
28
|
+
gem.add_runtime_dependency 'rufus-scheduler'
|
29
|
+
gem.add_runtime_dependency 'gingerice'
|
30
|
+
gem.add_runtime_dependency 'htmlentities'
|
31
|
+
gem.add_runtime_dependency 'engtagger'
|
32
|
+
gem.add_runtime_dependency 'fast-stemmer'
|
33
|
+
gem.add_runtime_dependency 'highscore'
|
34
|
+
gem.add_runtime_dependency 'pry'
|
35
|
+
gem.add_runtime_dependency 'oauth'
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_ebooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaiden Mispy
|
@@ -228,6 +228,7 @@ executables:
|
|
228
228
|
extensions: []
|
229
229
|
extra_rdoc_files: []
|
230
230
|
files:
|
231
|
+
- ".gitattributes"
|
231
232
|
- ".gitignore"
|
232
233
|
- ".rspec"
|
233
234
|
- ".travis.yml"
|
@@ -268,9 +269,9 @@ require_paths:
|
|
268
269
|
- lib
|
269
270
|
required_ruby_version: !ruby/object:Gem::Requirement
|
270
271
|
requirements:
|
271
|
-
- - "
|
272
|
+
- - "~>"
|
272
273
|
- !ruby/object:Gem::Version
|
273
|
-
version: '
|
274
|
+
version: '2.1'
|
274
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
276
|
requirements:
|
276
277
|
- - ">="
|