lita-vaxcalc 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 +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +28 -0
- data/Rakefile +6 -0
- data/lib/lita-vaxcalc.rb +12 -0
- data/lib/lita/handlers/vaxcalc.rb +25 -0
- data/lita-vaxcalc.gemspec +26 -0
- data/locales/en.yml +4 -0
- data/spec/lita/handlers/vaxcalc_spec.rb +33 -0
- data/spec/spec_helper.rb +14 -0
- data/templates/.gitkeep +0 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cb350de7fa812526ab581f48bd8f8957809fbe5389498adbfa19407a9ecacfe5
|
4
|
+
data.tar.gz: 94751ae28549811c0dd60ac06c76e65b054459de3d3134af9867d0da937183b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e4a01d5a2287952bf0aeab6cb8d072b0ac05e55a4d293e91ae1d179233d3c7551d5431bef03ecd3e7bd69a3c99ae98c46048c1277f6914ed06d817b41e796f2
|
7
|
+
data.tar.gz: 8869c9c690d893b4a4e3e0a036a4c71283612ecd91deca4cfa8a5b62fa23dbf2830924cb9038c1931d4933a9466cff0eed0aa4479efcf84b6ec945c8048af39a
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Chris Downey
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# lita-vaxcalc
|
2
|
+
|
3
|
+
[](https://travis-ci.org/Yenwod/lita-vaxcalc)
|
4
|
+
[](https://coveralls.io/r/Yenwod/lita-vaxcalc)
|
5
|
+
|
6
|
+
Provides the capability to chat about vaccines and their ingredients.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add lita-vaxcalc to your Lita instance's Gemfile:
|
11
|
+
|
12
|
+
``` ruby
|
13
|
+
gem "lita-vaxcalc"
|
14
|
+
```
|
15
|
+
|
16
|
+
## Configuration
|
17
|
+
|
18
|
+
None yet.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
This is an early pre-alpha stage gem. Right now, it does almost nothing except repeat back whatever string you send in.
|
23
|
+
|
24
|
+
Eventually, it will support something like this:
|
25
|
+
|
26
|
+
Q: What vaccines contain aluminum?
|
27
|
+
|
28
|
+
A: X number of vaccines contain aluminum, including: DTaP, HepB, ....
|
data/Rakefile
ADDED
data/lib/lita-vaxcalc.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "lita"
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join("..", "..", "locales", "*.yml"), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require "lita/handlers/vaxcalc"
|
8
|
+
|
9
|
+
Lita::Handlers::Vaxcalc.template_root File.expand_path(
|
10
|
+
File.join("..", "..", "templates"),
|
11
|
+
__FILE__
|
12
|
+
)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Vaxcalc < Handler
|
4
|
+
# insert handler code here
|
5
|
+
|
6
|
+
route(
|
7
|
+
/^contains\s+(\D+)$/i, :respond_with_double,
|
8
|
+
command: true,
|
9
|
+
help: { 'contains [ingredient]' => 'prints vaccine list' }
|
10
|
+
)
|
11
|
+
|
12
|
+
def double_number(n)
|
13
|
+
n + n
|
14
|
+
end
|
15
|
+
|
16
|
+
def respond_with_double(response)
|
17
|
+
# Read up on the Ruby MatchData class for more options
|
18
|
+
n = response.match_data.captures.first
|
19
|
+
response.reply "#{n}"
|
20
|
+
end
|
21
|
+
|
22
|
+
Lita.register_handler(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lita-vaxcalc"
|
3
|
+
spec.version = "0.1.0"
|
4
|
+
spec.authors = ["Chris Downey"]
|
5
|
+
spec.email = ["cdowney@gmail.com"]
|
6
|
+
spec.description = "VaxCalc (vaccine ingredient calculator) skills"
|
7
|
+
spec.summary = "Provides vaccine ingredient information via VaxCalc API"
|
8
|
+
spec.homepage = "https://censored.vaxcalc.org/category/vaxbot"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($/)
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "lita", ">= 4.7"
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", '~> 2.0', '>= 2.0.2'
|
20
|
+
spec.add_development_dependency "pry-byebug"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "rack-test"
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
24
|
+
spec.add_development_dependency "simplecov"
|
25
|
+
spec.add_development_dependency "coveralls"
|
26
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Lita::Handlers::Vaxcalc, lita_handler: true do
|
4
|
+
|
5
|
+
describe 'routing' do
|
6
|
+
# allow extra whitespace
|
7
|
+
it { is_expected.to_not route('Lita contains 2') }
|
8
|
+
it { is_expected.to_not route('Lita contains 22') } # allow mixed casing
|
9
|
+
it { is_expected.to_not route('Lita conTAins 4') }
|
10
|
+
# ignore numbers that don't look like integers
|
11
|
+
it { is_expected.to route('Lita contains aluminum') }
|
12
|
+
#it { is_expected.to_not route('Lita contains 1e4') }
|
13
|
+
it { is_expected.to_not route('Lita contains 1e4') }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe ':double_number' do
|
17
|
+
|
18
|
+
let(:n) { rand(1..100) }
|
19
|
+
|
20
|
+
it 'returns double the input' do
|
21
|
+
actual = subject.double_number n
|
22
|
+
expected = n * 2
|
23
|
+
expect(actual).to eq(expected)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'doubles numbers when asked to' do
|
27
|
+
send_message 'Lita contains aluminum'
|
28
|
+
expect(replies.last).to eq('aluminum')
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
require "coveralls"
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
])
|
7
|
+
SimpleCov.start { add_filter "/spec/" }
|
8
|
+
|
9
|
+
require "lita-vaxcalc"
|
10
|
+
require "lita/rspec"
|
11
|
+
|
12
|
+
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
|
13
|
+
# was generated with Lita 4, the compatibility mode should be left disabled.
|
14
|
+
Lita.version_3_compatibility_mode = false
|
data/templates/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-vaxcalc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Downey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-03 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: '4.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.0.2
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.0'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.2
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry-byebug
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rack-test
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 3.0.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.0.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: simplecov
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: coveralls
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
description: VaxCalc (vaccine ingredient calculator) skills
|
132
|
+
email:
|
133
|
+
- cdowney@gmail.com
|
134
|
+
executables: []
|
135
|
+
extensions: []
|
136
|
+
extra_rdoc_files: []
|
137
|
+
files:
|
138
|
+
- ".gitignore"
|
139
|
+
- ".travis.yml"
|
140
|
+
- Gemfile
|
141
|
+
- LICENSE
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- lib/lita-vaxcalc.rb
|
145
|
+
- lib/lita/handlers/vaxcalc.rb
|
146
|
+
- lita-vaxcalc.gemspec
|
147
|
+
- locales/en.yml
|
148
|
+
- spec/lita/handlers/vaxcalc_spec.rb
|
149
|
+
- spec/spec_helper.rb
|
150
|
+
- templates/.gitkeep
|
151
|
+
homepage: https://censored.vaxcalc.org/category/vaxbot
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata:
|
155
|
+
lita_plugin_type: handler
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubygems_version: 3.0.6
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Provides vaccine ingredient information via VaxCalc API
|
175
|
+
test_files:
|
176
|
+
- spec/lita/handlers/vaxcalc_spec.rb
|
177
|
+
- spec/spec_helper.rb
|