lita-butt 0.1.1 → 0.1.2

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: 567f3ea8c7f992c3c9b1cf53cc14a4904c6dbd9c
4
- data.tar.gz: a62ece66162d1723eb5c9020e6655ea87065e551
3
+ metadata.gz: f20cea08c515a38a45d64fc73016356fe3e24dd0
4
+ data.tar.gz: de6c9ed990d85f68491976a4810d4bdf14fe8928
5
5
  SHA512:
6
- metadata.gz: dc5ae23ae64e98c379f06df097b8be0e2e4660643af0632562b7ffbb7c7a3a7ab0dec65aeb7fb73bd99c4fc8d6901d40455ec2d50a06bfc45ec984784c3a9df6
7
- data.tar.gz: 05f65f2b1d3c37d893d1badbf1edd58cbdd959b0eddb0e3a4078cf0910ebe4c4cde93b6d36e50cd9d6514cbec125b466cd02e9198868b37db135c54a162303b4
6
+ metadata.gz: 36fc929d948c525c505f44f5771e2fb5b2c0396b11725bff9167fa1f92cca670a4c3229672341d1b3750727df65d93b64451f09715df2f19e716dcedf3528ecf
7
+ data.tar.gz: 20f61bb79810af79339cdaffc20f6b9bcb41c6ef8bc422148871a1f84d34199f2837c6b9cce6890c97e7febdfecd71ee081ed8bcb799b480bee748dede2ee298
data/README.md CHANGED
@@ -25,4 +25,6 @@ Lita > butt
25
25
  (_)_)
26
26
  Lita > buuuuuuuuuuuuuuutt
27
27
  (_______________)_______________)
28
+ Lita > butts
29
+ (_)_) (_)_)
28
30
  ```
@@ -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
- butt = "(#{bottom})#{bottom})"
22
+ "(#{bottom})#{bottom})"
23
+ end
14
24
 
15
- if groups.last == 's'
16
- response.reply [butt, butt].join ' '
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
- response.reply butt
31
+ butt
19
32
  end
20
33
  end
21
34
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-butt'
3
- spec.version = '0.1.1'
3
+ spec.version = '0.1.2'
4
4
  spec.authors = ['Nick Pegg']
5
5
  spec.email = ['git@nickpegg.com']
6
6
  spec.description = 'Lita Handler to print ASCII butts'
@@ -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(:butt) }
7
- it { is_expected.to route('btt').to(:butt) }
8
- it { is_expected.to route('buuuuuutt').to(:butt) }
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.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-18 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita