sclemmer-robut 0.6.0 → 0.6.1
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 +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +34 -27
- data/Rakefile +1 -2
- data/bin/robut +6 -1
- data/lib/robut/connection.rb +5 -1
- data/lib/robut/plugin.rb +1 -1
- data/lib/robut/plugin/google_images.rb +1 -1
- data/lib/robut/plugin/later.rb +1 -1
- data/lib/robut/plugin/lunch.rb +3 -3
- data/lib/robut/version.rb +1 -1
- data/test/unit/plugin/pick_test.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c42b291bd9f0f5a60b3e31398f2a9b396c247b1c
|
4
|
+
data.tar.gz: 732a4875ef0aeb2405fe98ec96b06be4434831e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f95b530fc7c66f77d65b3c711a24e3f781e9fd3f42a9036cf793d4d16f799646716ff739acfca021cb58e43d9ae595986663d48d1c9201d32574889a434e0b8e
|
7
|
+
data.tar.gz: 49bdd9fb6e499368502a661fb815c45c735bd9fe5692d54bc622b3e4460bb93ccb3b9a95a96eafe44bc1a3609c7e9fe0ae005c5c03e5b2dc3b9fb01e05a4e6a4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,49 +1,52 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sclemmer-robut (0.
|
4
|
+
sclemmer-robut (0.6.1)
|
5
5
|
sinatra (~> 1.3)
|
6
|
-
xmpp4r (~> 0.5.
|
6
|
+
xmpp4r (~> 0.5.6)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.3.
|
11
|
+
addressable (2.3.8)
|
12
12
|
calc (1.0.0)
|
13
|
-
crack (0.4.
|
14
|
-
safe_yaml (~> 0.
|
15
|
-
docile (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.
|
19
|
-
mini_portile (0.
|
20
|
-
minitest (5.
|
21
|
-
mocha (
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
rack (1.
|
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.
|
30
|
+
rack-test (0.6.3)
|
30
31
|
rack (>= 1.0)
|
31
|
-
rake (10.
|
32
|
-
safe_yaml (0.
|
33
|
-
simplecov (0.
|
32
|
+
rake (10.4.2)
|
33
|
+
safe_yaml (1.0.4)
|
34
|
+
simplecov (0.10.0)
|
34
35
|
docile (~> 1.1.0)
|
35
|
-
|
36
|
-
simplecov-html (~> 0.
|
37
|
-
simplecov-html (0.
|
38
|
-
sinatra (1.4.
|
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 (
|
42
|
-
|
43
|
-
|
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.
|
46
|
-
addressable (>= 2.
|
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
data/bin/robut
CHANGED
data/lib/robut/connection.rb
CHANGED
@@ -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
|
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
|
data/lib/robut/plugin/later.rb
CHANGED
data/lib/robut/plugin/lunch.rb
CHANGED
@@ -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
|
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,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.
|
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-
|
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
|