twitter_ebooks 3.1.3 → 3.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8c70b5760bf1a3545b08b1899585ce08e0e10c5
4
- data.tar.gz: 3d98fe56163d2682c516690ab14564c3d6b573dd
3
+ metadata.gz: 8d762f4e50e4188c2da0a1b801756776992a9cd3
4
+ data.tar.gz: 3d731a6279c9ffee25e026f3d258b1a25db47aaa
5
5
  SHA512:
6
- metadata.gz: 8dddfdc46f98ef0184cf8929ae310d9ce1527fad7a22d75301a33d18bc0389542ab05ac802723d47c3455e2141f07c882163c409de7a56d15651fc3e01dd4ddd
7
- data.tar.gz: 97e4d64f43cdb32d4dcecb63fc85634c6c114557faa22cb4f6919c3918feeee9979987fb05c23b4660c60f3862d10724db82f8c0d34ac91ca20e30b7ae2a80d3
6
+ metadata.gz: cdd4a618769c7cd18edd180aab8b5e49ef908371e87bff33d60336b57b4c10c781cc2cf927a221e0abbce3ccfd6ea1f547dcb31d8f5ca3ae3fc9b1bbaf80c4c2
7
+ data.tar.gz: 8bb1eb693315625c9b102c19e6b0c0852d0c8b01c90f974c754d932c58f50ec88694e5e69ae3a8d696ee950eeb45c640dd77507730c76c4810769965af34c473
data/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Require \n style line endings
2
+ * text eol=lf
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  rvm:
2
- - 2.1.4
2
+ - 2.1.7
3
3
  script:
4
4
  - rspec spec
5
5
  notifications:
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.0+
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
- @tweets = JSON.parse(File.read(@path, :encoding => 'utf-8'), symbolize_names: true)
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
- File.open(@path, 'w') do |f|
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
@@ -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
- tikis = variant if variant
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
@@ -1,3 +1,3 @@
1
1
  module Ebooks
2
- VERSION = "3.1.3"
2
+ VERSION = "3.1.4"
3
3
  end
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
@@ -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[iiXi i�i�i�i�3i�ii�3[iii�3[i� ic[
4393
4393
  i�ii� i�3i�3[i.%ii�3[ i"i;
@@ -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.authors = ["Jaiden Mispy"]
6
- gem.email = ["^_^@mispy.me"]
7
- gem.description = %q{Markov chains for all your friends~}
8
- gem.summary = %q{Markov chains for all your friends~}
9
- gem.homepage = ""
10
-
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "twitter_ebooks"
15
- gem.require_paths = ["lib"]
16
- gem.version = Ebooks::VERSION
17
-
18
- gem.add_development_dependency 'rspec'
19
- gem.add_development_dependency 'rspec-mocks'
20
- gem.add_development_dependency 'memory_profiler'
21
- gem.add_development_dependency 'timecop'
22
- gem.add_development_dependency 'pry-byebug'
23
- gem.add_development_dependency 'yard'
24
-
25
- gem.add_runtime_dependency 'twitter', '~> 5.15'
26
- gem.add_runtime_dependency 'rufus-scheduler'
27
- gem.add_runtime_dependency 'gingerice'
28
- gem.add_runtime_dependency 'htmlentities'
29
- gem.add_runtime_dependency 'engtagger'
30
- gem.add_runtime_dependency 'fast-stemmer'
31
- gem.add_runtime_dependency 'highscore'
32
- gem.add_runtime_dependency 'pry'
33
- gem.add_runtime_dependency 'oauth'
34
- end
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.3
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: '0'
274
+ version: '2.1'
274
275
  required_rubygems_version: !ruby/object:Gem::Requirement
275
276
  requirements:
276
277
  - - ">="