muzang-plugins 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/muzang-plugins/muzang-meme.rb +1 -1
- data/lib/muzang-plugins/muzang-soupirc.rb +19 -0
- data/lib/muzang-plugins/version.rb +1 -1
- data/spec/soupirc_spec.rb +24 -0
- metadata +24 -17
@@ -0,0 +1,19 @@
|
|
1
|
+
require "soup-client"
|
2
|
+
|
3
|
+
class SoupIRC
|
4
|
+
include Muzang::Plugins::Helpers
|
5
|
+
|
6
|
+
def initialize(bot, soup)
|
7
|
+
@bot = bot
|
8
|
+
@soup = soup || File.open(ENV["HOME"] + "/.muzang/" + "soup").read.split(":") rescue nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(connection, message)
|
12
|
+
message.message.match(/^!soup (.*?)$/) do |m|
|
13
|
+
soup = Soup::Client.new(@soup.first, @soup.last.chomp)
|
14
|
+
soup.login
|
15
|
+
soup.new_image(m[1])
|
16
|
+
connection.msg(@bot.channels.first, "soup updated :) | http://#{@soup.first}.soup.io/")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'muzang-plugins/muzang-soupirc'
|
3
|
+
|
4
|
+
describe "Soup" do
|
5
|
+
before do
|
6
|
+
@bot = stub(:channels => ["#test"])
|
7
|
+
@soup = SoupIRC.new(@bot, ["drugpl", "super_password"])
|
8
|
+
@connection = ConnectionMock.new
|
9
|
+
@message = OpenStruct.new({:channel => "#test", :message => "!soup http://example.com/image.jpg", :nick => "LTe"})
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should send image to soup" do
|
14
|
+
Soup::Client.any_instance.stub(:login)
|
15
|
+
Soup::Client.any_instance.stub(:new_image).with("http://example.com/image.jpg")
|
16
|
+
|
17
|
+
EM.run do
|
18
|
+
@soup.call(@connection, @message)
|
19
|
+
eventually(true) do
|
20
|
+
@connection.messages.include?("soup updated :) | http://drugpl.soup.io/")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muzang-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: em-http-request
|
16
|
-
requirement: &
|
16
|
+
requirement: &40585540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *40585540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: muzang
|
27
|
-
requirement: &
|
27
|
+
requirement: &40585040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *40585040
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: memetron
|
38
|
-
requirement: &
|
38
|
+
requirement: &40584540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.1.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *40584540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: soup-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &40584160 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *40584160
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: em-ventually
|
60
|
-
requirement: &
|
60
|
+
requirement: &40583620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.1.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *40583620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &40583060 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.6.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *40583060
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rake
|
82
|
-
requirement: &
|
82
|
+
requirement: &40582680 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *40582680
|
91
91
|
description: Plugins for Muzang IRC bot
|
92
92
|
email:
|
93
93
|
- piotr.nielacny@gmail.com
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- lib/muzang-plugins/muzang-plusone.rb
|
254
254
|
- lib/muzang-plugins/muzang-reddit.rb
|
255
255
|
- lib/muzang-plugins/muzang-rubygems.rb
|
256
|
+
- lib/muzang-plugins/muzang-soupirc.rb
|
256
257
|
- lib/muzang-plugins/version.rb
|
257
258
|
- muzang-plugins.gemspec
|
258
259
|
- spec/livereload_spec.rb
|
@@ -263,6 +264,7 @@ files:
|
|
263
264
|
- spec/plusone_spec.rb
|
264
265
|
- spec/reddit_spec.rb
|
265
266
|
- spec/rubygems_spec.rb
|
267
|
+
- spec/soupirc_spec.rb
|
266
268
|
- spec/spec_helper.rb
|
267
269
|
- spec/support/connection_mock.rb
|
268
270
|
- spec/support/responses/acts-as-messageable.response
|
@@ -282,12 +284,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
282
284
|
- - ! '>='
|
283
285
|
- !ruby/object:Gem::Version
|
284
286
|
version: '0'
|
287
|
+
segments:
|
288
|
+
- 0
|
289
|
+
hash: 3504913172110565435
|
285
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
291
|
none: false
|
287
292
|
requirements:
|
288
293
|
- - ! '>='
|
289
294
|
- !ruby/object:Gem::Version
|
290
295
|
version: '0'
|
296
|
+
segments:
|
297
|
+
- 0
|
298
|
+
hash: 3504913172110565435
|
291
299
|
requirements: []
|
292
300
|
rubyforge_project:
|
293
301
|
rubygems_version: 1.8.15
|
@@ -295,4 +303,3 @@ signing_key:
|
|
295
303
|
specification_version: 3
|
296
304
|
summary: Basic plugins for Muzang IRC bot
|
297
305
|
test_files: []
|
298
|
-
has_rdoc:
|