streambot 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ begin
13
13
  gem.require_path = 'lib'
14
14
  gem.files = %w(Rakefile) + Dir.glob("{lib}/**/*") + %w(VERSION)
15
15
  # the runtime dependencies
16
- gem.add_runtime_dependency "twistream", "~> 0.2.5"
16
+ gem.add_runtime_dependency "twistream", "~> 0.3.0"
17
17
  gem.add_runtime_dependency "oauth","~> 0.4.0"
18
18
  # the development dependencies
19
19
  gem.add_development_dependency "bundler", "~> 1.0.0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -8,8 +8,12 @@ module StreamBot
8
8
 
9
9
  # retweets the status with given id
10
10
  def retweet(id)
11
- LOG.info "retweet status ##{id}"
12
- @handler.post("/statuses/retweet/#{id}.json", nil)
11
+ # one thread per retweet,
12
+ # cause it's much, much faster
13
+ Thread.new do
14
+ LOG.info "retweet status ##{id}"
15
+ @handler.post("/statuses/retweet/#{id}.json", nil)
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -12,7 +12,8 @@ module StreamBot
12
12
  self.params = params
13
13
  @retweet = StreamBot::Retweet.new(self.params)
14
14
  @client = TwiStream::Client.new(authentication)
15
- @client.on_error do |msg, trace|
15
+ @client.on_error.handle do |msg, trace|
16
+ LOG.error "#{msg}"
16
17
  on_error.trigger(msg, trace)
17
18
  end
18
19
  end
@@ -20,17 +21,16 @@ module StreamBot
20
21
  # start the tracker
21
22
  def start
22
23
  keywords = self.params["keywords"]
23
- @client.filter_by_keywords(keywords) do |status|
24
- if retweet?(status)
25
- # one thread per retweet,
26
- # cause it's much, much faster
27
- before_retweet.trigger(status)
28
- @thread = Thread.new do
24
+ @thread = Thread.new do
25
+ @client.filter_by_keywords(keywords) do |status|
26
+ if retweet?(status)
27
+ before_retweet.trigger(status)
29
28
  @retweet.retweet(status["id"])
29
+ after_retweet.trigger(status)
30
30
  end
31
- after_retweet.trigger(status)
32
31
  end
33
32
  end
33
+ @thread.join
34
34
  end
35
35
 
36
36
  # stop the tracker
@@ -15,7 +15,7 @@ describe StreamBot::Tracker do
15
15
 
16
16
  describe "#start" do
17
17
  it "should start" do
18
- @thread = Thread.new do
18
+ Thread.new do
19
19
  @tracker.start
20
20
  end
21
21
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: streambot
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sascha Wessel
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-12 00:00:00 +01:00
13
+ date: 2011-02-18 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 0.2.5
24
+ version: 0.3.0
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency