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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fae74b4091fa03b08ddc0dc186c2af8420797254
4
- data.tar.gz: 4d148bdce58396c0383a458a4d3a028bf73455c9
3
+ metadata.gz: 0ba908fe51218c4defcb94d5725dbb03fd613010
4
+ data.tar.gz: f2050fa3f1c2d0187febf20329f1bc5e2b1e986f
5
5
  SHA512:
6
- metadata.gz: 024137fb66a1864e168c10d99f77e3e466a67928f103c3805ab050c046c39544b5b5587e172fcc7ad4b10355039a888b04019a2fb55ab300f94dde83c192d212
7
- data.tar.gz: 0769821b91b536cec99d39c586530c722b6e542d07d4ae2716dba193c691502af991fc0b1949069d6d75c0e9376850f437a79c8b6c7afbe6be85e33a6d6fb573
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 (accidential or not) and alerts the channel when a haiku has formed.
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
- No configuration is needed in this version.
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
 
@@ -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
- return unless one['id'] == two['id'] && two['id'] == three['id']
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-poetry"
3
- spec.version = "0.0.2"
3
+ spec.version = "0.1.0"
4
4
  spec.authors = ["Chris Woodrich"]
5
5
  spec.email = ["cwoodrich@gmail.com"]
6
6
  spec.description = "A Haiku detector for Lita"
@@ -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 answerd it.")
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.2
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-03-08 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita