hato-plugin-ikachan 0.0.3 → 0.0.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 +4 -4
- data/README.md +12 -1
- data/lib/hato/plugin/ikachan/version.rb +1 -1
- data/lib/hato/plugin/ikachan.rb +10 -2
- data/spec/lib/hato/plugin/ikachan_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73ecdda925f76a73a317154ac8db5a54ada85802
|
4
|
+
data.tar.gz: 588498f0a8c7e2026f672697f115fae8dff08e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e3e33efca0ba41d223e2aaf72f706c285cebcbefc119237fe4335349ae1f6963749dc7b0e42fe50012727fd01309c659586fc1486d0cd0cbb099b9272a137a
|
7
|
+
data.tar.gz: 8f8da4fd3b06749d65a65132fbe54e31896bc7ea423642c208d13163da22426f6595209042f0d8b202e02fc11bb40452fc193bbd07b9c3c0554f06cf27f9f0e9
|
data/README.md
CHANGED
@@ -17,7 +17,18 @@ Hato::Config.define do
|
|
17
17
|
scheme 'http'
|
18
18
|
host 'irc.example.com'
|
19
19
|
port 4979
|
20
|
-
channel %w[hato pigeon]
|
20
|
+
channel %w[hato pigeon]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# with message template
|
25
|
+
tag 'test2' do
|
26
|
+
plugin 'Ikachan' do
|
27
|
+
scheme 'http'
|
28
|
+
host 'irc.example.com'
|
29
|
+
port 4979
|
30
|
+
channel %w[hato pigeon]
|
31
|
+
template 'Message from Hato: <%= args[:message] %>'
|
21
32
|
end
|
22
33
|
end
|
23
34
|
|
data/lib/hato/plugin/ikachan.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'hato/plugin'
|
2
2
|
require 'hato/plugin/ikachan/version'
|
3
3
|
|
4
|
+
require 'erb'
|
4
5
|
require 'uri'
|
5
6
|
require 'net/http'
|
6
7
|
|
@@ -13,13 +14,20 @@ module Hato
|
|
13
14
|
|
14
15
|
channel.each do |c|
|
15
16
|
send_message(:join, c)
|
16
|
-
send_message(:notice, c, args
|
17
|
+
send_message(:notice, c, args)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
21
|
protected
|
21
22
|
|
22
|
-
def send_message(action, channel,
|
23
|
+
def send_message(action, channel, args = {})
|
24
|
+
message = args[:message]
|
25
|
+
|
26
|
+
if config.template
|
27
|
+
erb = ERB.new(config.template)
|
28
|
+
message = erb.result(binding).chomp
|
29
|
+
end
|
30
|
+
|
23
31
|
url = '%s://%s:%s/%s' % [
|
24
32
|
config.scheme || 'http',
|
25
33
|
config.host,
|
@@ -9,7 +9,7 @@ describe Hato::Plugin::Ikachan do
|
|
9
9
|
subject {
|
10
10
|
described_class.new(
|
11
11
|
Hato::Config::Plugin.new('Ikachan') {
|
12
|
-
|
12
|
+
host 'example.com'
|
13
13
|
channel 'test'
|
14
14
|
}
|
15
15
|
)
|
@@ -28,7 +28,7 @@ describe Hato::Plugin::Ikachan do
|
|
28
28
|
subject {
|
29
29
|
described_class.new(
|
30
30
|
Hato::Config::Plugin.new('Ikachan') {
|
31
|
-
|
31
|
+
host 'example.com'
|
32
32
|
channel %w[test1 test2]
|
33
33
|
}
|
34
34
|
)
|
@@ -49,7 +49,7 @@ describe Hato::Plugin::Ikachan do
|
|
49
49
|
subject {
|
50
50
|
described_class.new(
|
51
51
|
Hato::Config::Plugin.new('Ikachan') {
|
52
|
-
|
52
|
+
host 'example.com'
|
53
53
|
channel 'test'
|
54
54
|
}
|
55
55
|
)
|
@@ -72,7 +72,7 @@ describe Hato::Plugin::Ikachan do
|
|
72
72
|
subject {
|
73
73
|
described_class.new(
|
74
74
|
Hato::Config::Plugin.new('Ikachan') {
|
75
|
-
|
75
|
+
hos t 'example.com'
|
76
76
|
channel 'test'
|
77
77
|
}
|
78
78
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hato-plugin-ikachan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Kuribayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hato
|