lita-butt 0.1.1 → 0.1.2
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 +2 -0
- data/lib/lita/handlers/butt.rb +17 -4
- data/lita-butt.gemspec +1 -1
- data/spec/lita/handlers/butt_spec.rb +12 -3
- 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: f20cea08c515a38a45d64fc73016356fe3e24dd0
|
4
|
+
data.tar.gz: de6c9ed990d85f68491976a4810d4bdf14fe8928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36fc929d948c525c505f44f5771e2fb5b2c0396b11725bff9167fa1f92cca670a4c3229672341d1b3750727df65d93b64451f09715df2f19e716dcedf3528ecf
|
7
|
+
data.tar.gz: 20f61bb79810af79339cdaffc20f6b9bcb41c6ef8bc422148871a1f84d34199f2837c6b9cce6890c97e7febdfecd71ee081ed8bcb799b480bee748dede2ee298
|
data/README.md
CHANGED
data/lib/lita/handlers/butt.rb
CHANGED
@@ -8,14 +8,27 @@ module Lita
|
|
8
8
|
def butt(response)
|
9
9
|
groups = response.matches.first
|
10
10
|
width = groups.first.size
|
11
|
+
butt = make_butt width
|
11
12
|
|
13
|
+
if groups.last == 's'
|
14
|
+
response.reply(escape([butt, butt].join(' ')))
|
15
|
+
else
|
16
|
+
response.reply(escape(butt))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def make_butt(width = 1)
|
12
21
|
bottom = '_' * width
|
13
|
-
|
22
|
+
"(#{bottom})#{bottom})"
|
23
|
+
end
|
14
24
|
|
15
|
-
|
16
|
-
|
25
|
+
# Properly escape the butt for a given chat service
|
26
|
+
def escape(butt, adapter = robot.config.robot.adapter)
|
27
|
+
case adapter
|
28
|
+
when :slack
|
29
|
+
"`#{butt}`"
|
17
30
|
else
|
18
|
-
|
31
|
+
butt
|
19
32
|
end
|
20
33
|
end
|
21
34
|
|
data/lita-butt.gemspec
CHANGED
@@ -3,10 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe Lita::Handlers::Butt, lita_handler: true do
|
4
4
|
subject { described_class.new(robot) }
|
5
5
|
|
6
|
-
it { is_expected.to route('butt').to
|
7
|
-
it { is_expected.to route('btt').to
|
8
|
-
it { is_expected.to route('buuuuuutt').to
|
6
|
+
it { is_expected.to route('butt').to :butt }
|
7
|
+
it { is_expected.to route('btt').to :butt }
|
8
|
+
it { is_expected.to route('buuuuuutt').to :butt }
|
9
9
|
|
10
|
+
it { is_expected.to route('butts').to :butt }
|
11
|
+
it { is_expected.to route('btts').to :butt }
|
12
|
+
it { is_expected.to route('buuuuuutts').to :butt }
|
10
13
|
describe '#butt' do
|
11
14
|
it 'replies with a butt' do
|
12
15
|
send_message 'butt'
|
@@ -33,4 +36,10 @@ describe Lita::Handlers::Butt, lita_handler: true do
|
|
33
36
|
expect(replies.last).to eq '(_____)_____) (_____)_____)'
|
34
37
|
end
|
35
38
|
end
|
39
|
+
|
40
|
+
describe '#escape' do
|
41
|
+
it 'escapes a Slack butt' do
|
42
|
+
expect(subject.escape(subject.make_butt, :slack)).to eq '`(_)_)`'
|
43
|
+
end
|
44
|
+
end
|
36
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-butt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pegg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|