sclemmer-robut 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c4da3e382334afd2a055fedbace27798fe5f692
4
- data.tar.gz: 0512c9771139fc9c084bd78a7c4ad4ccfbf68afb
3
+ metadata.gz: c42b291bd9f0f5a60b3e31398f2a9b396c247b1c
4
+ data.tar.gz: 732a4875ef0aeb2405fe98ec96b06be4434831e9
5
5
  SHA512:
6
- metadata.gz: 019eb92981b1a789d4ed91bec9bdbb94817ad0d7847d8c97c616d3347db0a110cef7cc6cd4a7ed675d546119ecd4e5a4a36b901cdc230e5114fda13b83adb972
7
- data.tar.gz: f35d244057fb2bc44a7421ab0269b40c166cc7f0a3b78b11fd9fdd7c6476635b1da82b7b4f2d56fc6d60936d1be40029f66cce35688928f922f7c13ee30deec7
6
+ metadata.gz: f95b530fc7c66f77d65b3c711a24e3f781e9fd3f42a9036cf793d4d16f799646716ff739acfca021cb58e43d9ae595986663d48d1c9201d32574889a434e0b8e
7
+ data.tar.gz: 49bdd9fb6e499368502a661fb815c45c735bd9fe5692d54bc622b3e4460bb93ccb3b9a95a96eafe44bc1a3609c7e9fe0ae005c5c03e5b2dc3b9fb01e05a4e6a4
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gemspec
5
5
  gem 'rake'
6
6
 
7
7
  group :test do
8
+ gem 'test-unit'
8
9
  gem 'simplecov'
9
10
  gem 'webmock'
10
11
  gem 'time-warp'
data/Gemfile.lock CHANGED
@@ -1,49 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sclemmer-robut (0.5.2)
4
+ sclemmer-robut (0.6.1)
5
5
  sinatra (~> 1.3)
6
- xmpp4r (~> 0.5.0)
6
+ xmpp4r (~> 0.5.6)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.3.5)
11
+ addressable (2.3.8)
12
12
  calc (1.0.0)
13
- crack (0.4.1)
14
- safe_yaml (~> 0.9.0)
15
- docile (1.1.1)
13
+ crack (0.4.2)
14
+ safe_yaml (~> 1.0.0)
15
+ docile (1.1.5)
16
+ json (1.8.3)
16
17
  meme_generator (1.9)
17
18
  nokogiri (~> 1.4)
18
- metaclass (0.0.1)
19
- mini_portile (0.5.2)
20
- minitest (5.5.0)
21
- mocha (0.14.0)
19
+ metaclass (0.0.4)
20
+ mini_portile (0.6.2)
21
+ minitest (5.8.0)
22
+ mocha (1.1.0)
22
23
  metaclass (~> 0.0.1)
23
- multi_json (1.8.2)
24
- nokogiri (1.6.1)
25
- mini_portile (~> 0.5.0)
26
- rack (1.5.2)
24
+ nokogiri (1.6.6.2)
25
+ mini_portile (~> 0.6.0)
26
+ power_assert (0.2.4)
27
+ rack (1.6.4)
27
28
  rack-protection (1.5.3)
28
29
  rack
29
- rack-test (0.6.2)
30
+ rack-test (0.6.3)
30
31
  rack (>= 1.0)
31
- rake (10.1.1)
32
- safe_yaml (0.9.7)
33
- simplecov (0.8.2)
32
+ rake (10.4.2)
33
+ safe_yaml (1.0.4)
34
+ simplecov (0.10.0)
34
35
  docile (~> 1.1.0)
35
- multi_json
36
- simplecov-html (~> 0.8.0)
37
- simplecov-html (0.8.0)
38
- sinatra (1.4.5)
36
+ json (~> 1.8)
37
+ simplecov-html (~> 0.10.0)
38
+ simplecov-html (0.10.0)
39
+ sinatra (1.4.6)
39
40
  rack (~> 1.4)
40
41
  rack-protection (~> 1.4)
41
- tilt (~> 1.3, >= 1.3.4)
42
- tilt (1.4.1)
43
- time-warp (1.0.13)
42
+ tilt (>= 1.3, < 3)
43
+ test-unit (3.1.3)
44
+ power_assert
45
+ tilt (2.0.1)
46
+ time-warp (1.0.15)
44
47
  twss-classifier (0.0.1)
45
- webmock (1.16.1)
46
- addressable (>= 2.2.7)
48
+ webmock (1.21.0)
49
+ addressable (>= 2.3.6)
47
50
  crack (>= 0.3.2)
48
51
  xmpp4r (0.5.6)
49
52
 
@@ -60,6 +63,10 @@ DEPENDENCIES
60
63
  rake
61
64
  sclemmer-robut!
62
65
  simplecov
66
+ test-unit
63
67
  time-warp
64
68
  twss-classifier
65
69
  webmock
70
+
71
+ BUNDLED WITH
72
+ 1.10.5
data/Rakefile CHANGED
@@ -23,5 +23,4 @@ Rake::RDocTask.new do |rd|
23
23
  rd.main = "README.rdoc"
24
24
  rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
25
25
  rd.rdoc_dir = 'doc'
26
- end
27
-
26
+ end
data/bin/robut CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require 'robut'
3
+ begin
4
+ require 'robut'
5
+ rescue LoadError
6
+ require 'bundler/setup'
7
+ require 'robut'
8
+ end
4
9
  require 'ostruct'
5
10
  require 'logger'
6
11
 
@@ -68,6 +68,7 @@ class Robut::Connection
68
68
  self.store = self.config.store || Robut::Storage::HashStore # default to in-memory store only
69
69
  self.config.rooms ||= Array(self.config.room) # legacy support?
70
70
  self.config.enable_private_messaging = true if self.config.enable_private_messaging.nil?
71
+ self.config.port ||= 5222
71
72
 
72
73
  if self.config.logger
73
74
  Jabber.logger = self.config.logger
@@ -79,7 +80,7 @@ class Robut::Connection
79
80
  # enters an infinite loop. Any messages sent to the room will pass
80
81
  # through all the included plugins.
81
82
  def connect
82
- client.connect
83
+ client.connect(config.host, config.port)
83
84
  client.auth(config.password)
84
85
  client.send(Jabber::Presence.new.set_type(:available))
85
86
 
@@ -94,6 +95,9 @@ class Robut::Connection
94
95
  Robut::PM.new(self, rooms)
95
96
  end
96
97
 
98
+ client.on_exception do
99
+ config.logger.error 'client.on_exception'
100
+ end
97
101
  trap_signals
98
102
  self
99
103
  end
data/lib/robut/plugin.rb CHANGED
@@ -169,7 +169,7 @@ module Robut::Plugin
169
169
  def fake_message(time, sender_nick, msg)
170
170
  # TODO: ensure this connection is threadsafe
171
171
  plugins = Robut::Plugin.plugins.map { |p| p.new(reply_to, private_sender) }
172
- reply_to.handle_message(plugins, time, sender_nick, msg, name)
172
+ reply_to.handle_message(plugins, time, sender_nick, msg)
173
173
  end
174
174
 
175
175
  # Accessor for the store instance
@@ -6,7 +6,7 @@ class Robut::Plugin::GoogleImages
6
6
 
7
7
  desc "image <query> - responds with the first image from a Google Images search for <query>"
8
8
  match /^image (.*)/, :sent_to_me => true do |query|
9
- image = Google::Search::Image.new(:query => query).first
9
+ image = Google::Search::Image.new(:query => query, :safe => :active).first
10
10
 
11
11
  if image
12
12
  reply image.uri
@@ -35,7 +35,7 @@ class Robut::Plugin::Later
35
35
 
36
36
  sleep_time = count * scale_multiplier(scale)
37
37
 
38
- if sleep_time >= 3600
38
+ if sleep_time >= 21_600
39
39
  reply "Too far into the future--ain't no body got (timeforthat)"
40
40
  return
41
41
  end
@@ -7,7 +7,7 @@ class Robut::Plugin::Lunch
7
7
  [
8
8
  "lunch? / food? - #{nick} will suggest a place to go eat",
9
9
  "#{at_nick} lunch places - lists all the lunch places #{nick} knows about",
10
- "#{at_nick} new lunch place <place> - tells #{nick} about a new place to eat",
10
+ "#{at_nick} (add|new) lunch place <place> - tells #{nick} about a new place to eat",
11
11
  "#{at_nick} remove lunch place <place> - tells #{nick} not to suggest <place> anymore"
12
12
  ]
13
13
  end
@@ -32,11 +32,11 @@ class Robut::Plugin::Lunch
32
32
  reply places.join(', ')
33
33
  end
34
34
  # @robut new lunch place Green Leaf
35
- elsif phrase =~ /new lunch place (.*)/i && sent_to_me?(message)
35
+ elsif phrase =~ /(?:new|add) lunch place (.*)/i && sent_to_me?(message)
36
36
  place = $1
37
37
  new_place(place)
38
38
  reply "Ok, I'll add \"#{place}\" to the the list of lunch places"
39
- # @robut remove luynch place Green Leaf
39
+ # @robut remove lunch place Green Leaf
40
40
  elsif phrase =~ /remove lunch place (.*)/i && sent_to_me?(message)
41
41
  place = $1
42
42
  remove_place(place)
data/lib/robut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Robut # :nodoc:
2
2
  # Robut's version number.
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
  require 'robut/plugin/pick'
3
- require 'mocha'
3
+ require 'mocha/setup'
4
4
 
5
5
  class Robut::Plugin::PickTest < Test::Unit::TestCase
6
6
 
@@ -15,7 +15,7 @@ class Robut::Plugin::PickTest < Test::Unit::TestCase
15
15
  @plugin.handle(Time.now, "@john", "@robut pick a, b, c")
16
16
  assert_equal ["And the winner is... a"], @plugin.reply_to.replies
17
17
  end
18
-
18
+
19
19
  def test_does_nothing_when_no_options_are_given
20
20
  @plugin.handle(Time.now, "@john", "@robut pick")
21
21
  assert @plugin.reply_to.replies.empty?
@@ -25,11 +25,11 @@ class Robut::Plugin::PickTest < Test::Unit::TestCase
25
25
  @plugin.handle(Time.now, "@john", "@robut pick a")
26
26
  assert_equal ["And the winner is... a"], @plugin.reply_to.replies
27
27
  end
28
-
28
+
29
29
  def test_handles_spaces
30
30
  @plugin.stubs(:random).returns(1)
31
31
  @plugin.handle(Time.now, "@john", "@robut pick this is the first option, this is the second option, this is the third option")
32
32
  assert_equal ["And the winner is... this is the second option"], @plugin.reply_to.replies
33
33
  end
34
-
34
+
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sclemmer-robut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Weiss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xmpp4r
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project: robut
132
- rubygems_version: 2.4.5
132
+ rubygems_version: 2.4.5.1
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: A simple plugin-enabled HipChat bot