lita-poetry 0.0.2 → 0.1.0
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 +7 -2
- data/lib/lita/handlers/poetry.rb +6 -1
- data/lita-poetry.gemspec +1 -1
- data/spec/lita/handlers/poetry_spec.rb +14 -1
- 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: 0ba908fe51218c4defcb94d5725dbb03fd613010
|
4
|
+
data.tar.gz: f2050fa3f1c2d0187febf20329f1bc5e2b1e986f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503ded515d18be493e8b41b136c4661f5946f61798c552c899ad02b140dbda95eaedf68ea5b6f972a4aa1d36271941a7bf426b3b65b8ceaf8fbb30eda7b8e0cd
|
7
|
+
data.tar.gz: 1e17bf9394dc71f16dcc5a723db47c3a3b6d181e3a8e2b6a95dfa95a31a6272139b145a19f2013c1b1d10a62395cce91644bb1450e53728ab318b80c0c38ac3e
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# lita-poetry
|
4
4
|
|
5
|
-
Lita-poetry passively listens for haikus (
|
5
|
+
Lita-poetry passively listens for haikus (accidental or not) and alerts the channel when a haiku has formed.
|
6
6
|
|
7
7
|
```
|
8
8
|
Jimmy > Flash of steel stills me
|
@@ -24,7 +24,12 @@ gem "lita-poetry"
|
|
24
24
|
|
25
25
|
## Configuration
|
26
26
|
|
27
|
-
|
27
|
+
strict_mode (defaults to false) will only allow haikus by a single user, whereas disabling strict_mode will allow multi-user haikus.
|
28
|
+
```
|
29
|
+
Lita.configure do |config|
|
30
|
+
config.handlers.poetry.strict_mode = true || false
|
31
|
+
end
|
32
|
+
```
|
28
33
|
|
29
34
|
## License
|
30
35
|
|
data/lib/lita/handlers/poetry.rb
CHANGED
@@ -8,6 +8,8 @@ module Lita
|
|
8
8
|
|
9
9
|
@lock = Mutex.new
|
10
10
|
|
11
|
+
config :strict_mode, types: [TrueClass, FalseClass], default: false
|
12
|
+
|
11
13
|
route(/.+/, :process)
|
12
14
|
on(:loaded, :populate)
|
13
15
|
|
@@ -32,7 +34,10 @@ module Lita
|
|
32
34
|
one = MultiJson.load(one)
|
33
35
|
two = MultiJson.load(two)
|
34
36
|
|
35
|
-
|
37
|
+
if config.strict_mode == true
|
38
|
+
return unless one['id'] == two['id'] && two['id'] == three['id']
|
39
|
+
end
|
40
|
+
|
36
41
|
if one['count'] == 5 && two['count'] == 7 && three['count'] == 5
|
37
42
|
request.reply('Garth, that was a haiku!')
|
38
43
|
end
|
data/lita-poetry.gemspec
CHANGED
@@ -5,6 +5,11 @@ describe Lita::Handlers::Poetry, lita_handler: true do
|
|
5
5
|
it {is_expected.to route_event(:loaded).to(:populate)}
|
6
6
|
it {is_expected.to route('a string').to(:process)}
|
7
7
|
|
8
|
+
before do
|
9
|
+
registry.config.handlers.poetry.strict_mode = true;
|
10
|
+
end
|
11
|
+
|
12
|
+
|
8
13
|
|
9
14
|
describe '#process' do
|
10
15
|
before {robot.trigger(:loaded)}
|
@@ -24,7 +29,7 @@ describe Lita::Handlers::Poetry, lita_handler: true do
|
|
24
29
|
send_message("So let it be with Caesar. The noble Brutus")
|
25
30
|
send_message("Hath told you Caesar was ambitious:")
|
26
31
|
send_message("If it were so, it was a grievous fault,")
|
27
|
-
send_message("And grievously hath Caesar answer
|
32
|
+
send_message("And grievously hath Caesar answer\’d it.")
|
28
33
|
|
29
34
|
expect(replies.size).to eq(0)
|
30
35
|
end
|
@@ -86,6 +91,14 @@ describe Lita::Handlers::Poetry, lita_handler: true do
|
|
86
91
|
expect(replies.size).to eq(13)
|
87
92
|
end
|
88
93
|
|
94
|
+
xit "Handles special situations and special vowel rules" do
|
95
|
+
send_message("The Boa from Goa")
|
96
|
+
send_message("Weighed nearly eight hundred tonnes")
|
97
|
+
send_message("He loved his deer pie")
|
98
|
+
expect(replies.last).to eq('Garth, that was a haiku!')
|
99
|
+
|
100
|
+
end
|
101
|
+
|
89
102
|
end
|
90
103
|
|
91
104
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-poetry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Woodrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|