lita-roll 1.0.1
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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/README.md +13 -0
- data/lib/lita-roll.rb +1 -0
- data/lib/lita/handlers/die.rb +19 -0
- data/lita-roll.gemspec +20 -0
- data/spec/lita/handlers/die_spec.rb +20 -0
- data/spec/spec_helper.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4fa3ccdd242227899561b7f758e8c70ede350684
|
|
4
|
+
data.tar.gz: 205f0b3815208f9c6ccf567b60a5691d0c6761d0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5ca59d49e0952e3de05c944ad3f9827ae0ae415c7b79999e9c7ddb7daf06709943bcf54596b5f8b841837875c2c855c508ce81bded3a93f2d391e41f63b43faf
|
|
7
|
+
data.tar.gz: 832bcd8234dcaa55b01e0d12d67cd12fa971c0a60249e50ff5ad1075894118043a8de1aba6fdc04b8eafe721c002a0327852483fb87d490e000909fed07203bc
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# lita-roll
|
|
2
|
+
|
|
3
|
+
**lita-roll** is a handler for [Lita](https://github.com/jimmycuadra/lita) that helps you make a decision by rolling the dice.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add `lita-roll` to your Lita instance's Gemfile:
|
|
8
|
+
``` ruby
|
|
9
|
+
gem "lita-roll"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Usage
|
|
13
|
+
`Lita: roll me one, two, three` - summon Lita's mystical powers of randomosity.
|
data/lib/lita-roll.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'lita/handlers/die'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'lita'
|
|
2
|
+
|
|
3
|
+
module Lita
|
|
4
|
+
module Handlers
|
|
5
|
+
class Die < Handler
|
|
6
|
+
|
|
7
|
+
# http://www.rubular.com/r/7w0BXzS80a
|
|
8
|
+
route(/\broll me (.+)/i, :roll, command: true, help: { 'roll me' => 'roll the die, fate takes over' })
|
|
9
|
+
|
|
10
|
+
def roll(response)
|
|
11
|
+
choices = response.matches.flatten.first.split(',')
|
|
12
|
+
response.reply('Performing complex, mathematical randomization...')
|
|
13
|
+
response.reply(%Q(The result: "#{choices.sample.strip}"))
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Lita.register_handler(Die)
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lita-roll.gemspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = 'lita-roll'
|
|
3
|
+
spec.version = '1.0.1'
|
|
4
|
+
spec.authors = ['Jay Hayes']
|
|
5
|
+
spec.email = ['ur@iamvery.com']
|
|
6
|
+
spec.description = %q{Lita handler for making decisions}
|
|
7
|
+
spec.summary = %q{Lita handler for making decisions}
|
|
8
|
+
spec.homepage = 'https://github.com/iamvery/lita-roll'
|
|
9
|
+
spec.license = 'MIT'
|
|
10
|
+
|
|
11
|
+
spec.files = `git ls-files`.split($/)
|
|
12
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
13
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
14
|
+
spec.require_paths = ['lib']
|
|
15
|
+
|
|
16
|
+
spec.add_runtime_dependency 'lita'
|
|
17
|
+
|
|
18
|
+
spec.add_development_dependency 'rspec', '>= 3.0.0.beta2'
|
|
19
|
+
spec.add_development_dependency 'pry'
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Lita::Handlers::Die, lita_handler: true do
|
|
4
|
+
it{ routes_command('roll me one, two').to :roll }
|
|
5
|
+
|
|
6
|
+
describe '#roll' do
|
|
7
|
+
let(:reply){ replies.last }
|
|
8
|
+
|
|
9
|
+
it 'replies with a magically selected choice' do
|
|
10
|
+
choices = ['first thing', 'second thing']
|
|
11
|
+
|
|
12
|
+
send_command("roll me #{choices.join(', ')}")
|
|
13
|
+
|
|
14
|
+
# http://www.rubular.com/r/h6eLkB0ZwY
|
|
15
|
+
pick = reply.scan(/"(.+)"/).flatten.first
|
|
16
|
+
|
|
17
|
+
expect(choices).to include(pick)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: lita-roll
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jay Hayes
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: lita
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 3.0.0.beta2
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 3.0.0.beta2
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pry
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: Lita handler for making decisions
|
|
56
|
+
email:
|
|
57
|
+
- ur@iamvery.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- Gemfile
|
|
64
|
+
- README.md
|
|
65
|
+
- lib/lita-roll.rb
|
|
66
|
+
- lib/lita/handlers/die.rb
|
|
67
|
+
- lita-roll.gemspec
|
|
68
|
+
- spec/lita/handlers/die_spec.rb
|
|
69
|
+
- spec/spec_helper.rb
|
|
70
|
+
homepage: https://github.com/iamvery/lita-roll
|
|
71
|
+
licenses:
|
|
72
|
+
- MIT
|
|
73
|
+
metadata: {}
|
|
74
|
+
post_install_message:
|
|
75
|
+
rdoc_options: []
|
|
76
|
+
require_paths:
|
|
77
|
+
- lib
|
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
requirements: []
|
|
89
|
+
rubyforge_project:
|
|
90
|
+
rubygems_version: 2.2.0
|
|
91
|
+
signing_key:
|
|
92
|
+
specification_version: 4
|
|
93
|
+
summary: Lita handler for making decisions
|
|
94
|
+
test_files:
|
|
95
|
+
- spec/lita/handlers/die_spec.rb
|
|
96
|
+
- spec/spec_helper.rb
|
|
97
|
+
has_rdoc:
|