lita-key-value 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/key_value.rb +7 -7
- data/lita-key-value.gemspec +3 -3
- data/spec/lita/handlers/key_value_spec.rb +5 -5
- data/spec/spec_helper.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82f0ee31ca473fd0e97adc6c3a9248150d584f53
|
4
|
+
data.tar.gz: 5c09b282b317d394cac58e5a112cd842714c330e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b2022a3c3defc7bd663ba3469a45f1a498eeafe5f3d653a585ad935067afa82424c4c09b9802dee949146bb127244b5431399e626346054115d6e7f7a9d4b77
|
7
|
+
data.tar.gz: 30d563ea31295ec8364c863d7219ad270cb99fbff56ca4306536f9140f88dd058115f52cc30cb1bc193e29906a442ee12999ff8f60feee2abc307cf330395acc
|
@@ -4,11 +4,12 @@ module Lita
|
|
4
4
|
module Handlers
|
5
5
|
class KeyValue < Handler
|
6
6
|
REDIS_KEY = "kv"
|
7
|
-
KEY_PATTERN = /[\w\._]+/
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
config :key_pattern, type: Regexp, default: /[\w\._]+/
|
9
|
+
config :key_normalizer do
|
10
|
+
validate do |value|
|
11
|
+
"must be a callable object" unless value.respond_to?(:call)
|
12
|
+
end
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.define_routes(pattern)
|
@@ -36,8 +37,7 @@ module Lita
|
|
36
37
|
on :loaded, :define_routes
|
37
38
|
|
38
39
|
def define_routes(payload)
|
39
|
-
|
40
|
-
self.class.define_routes(pattern.source)
|
40
|
+
self.class.define_routes(config.key_pattern.source)
|
41
41
|
end
|
42
42
|
|
43
43
|
def set(response)
|
@@ -100,7 +100,7 @@ module Lita
|
|
100
100
|
def normalize_key(key)
|
101
101
|
normalizer = config.key_normalizer
|
102
102
|
|
103
|
-
if normalizer
|
103
|
+
if normalizer
|
104
104
|
normalizer.call(key)
|
105
105
|
else
|
106
106
|
key.to_s.downcase.strip
|
data/lita-key-value.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-key-value"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "1.0.0"
|
4
4
|
spec.authors = ["Jimmy Cuadra"]
|
5
5
|
spec.email = ["jimmy@jimmycuadra.com"]
|
6
6
|
spec.description = %q{A Lita handler for storing snippets of text.}
|
@@ -14,11 +14,11 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
|
-
spec.add_runtime_dependency "lita", ">=
|
17
|
+
spec.add_runtime_dependency "lita", ">= 4.0"
|
18
18
|
|
19
19
|
spec.add_development_dependency "bundler", "~> 1.3"
|
20
20
|
spec.add_development_dependency "rake"
|
21
|
-
spec.add_development_dependency "rspec", ">= 3.0.0
|
21
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
22
22
|
spec.add_development_dependency "simplecov"
|
23
23
|
spec.add_development_dependency "coveralls"
|
24
24
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::KeyValue, lita_handler: true do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
8
|
-
it {
|
4
|
+
it { is_expected.to route_command("kv set foo bar").to(:set) }
|
5
|
+
it { is_expected.to route_command("kv get foo").to(:get) }
|
6
|
+
it { is_expected.to route_command("kv delete foo").to(:delete) }
|
7
|
+
it { is_expected.to route_command("kv list").to(:list) }
|
8
|
+
it { is_expected.to route_command("kv search foo").to(:search) }
|
9
9
|
|
10
10
|
it "sets and gets keys" do
|
11
11
|
send_command("kv set foo bar")
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-key-value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Cuadra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.0.0
|
61
|
+
version: 3.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0.0
|
68
|
+
version: 3.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|