lita-status 0.0.2
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 +18 -0
- data/.rubocop.yml +14 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/README.md +62 -0
- data/Rakefile +19 -0
- data/lib/lita/handlers/status.rb +136 -0
- data/lib/lita-status.rb +16 -0
- data/lib/status_helper/redis.rb +35 -0
- data/lib/status_helper/regex.rb +7 -0
- data/lib/status_helper/utility.rb +11 -0
- data/lita-status.gemspec +25 -0
- data/locales/en.yml +41 -0
- data/spec/lita/handlers/status_spec.rb +116 -0
- data/spec/spec_helper.rb +12 -0
- data/templates/.gitkeep +0 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fec0d9b2897a10bf0fe292c33eec83f9b0debef4
|
4
|
+
data.tar.gz: 8a0e345bd9c499ee21409f85fea4e9655b176e9b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7900017fdef3eefb75f6c9b8894580933ed4b0004bc27291e13860cd33904631941bca1097d77fc5752e0e1af914374b00a276ba62199164ca6c29023cb5ce1
|
7
|
+
data.tar.gz: df30e7ff2e1421d0d0235d84f5a59a7706cf64f95f6a700d05634a24ae515d914c82744c721e8cc0008e9c93a7b22ec22c91f3f03cbd755a604a41539300b1de
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# lita-status
|
2
|
+
|
3
|
+
[](https://travis-ci.org/visioncritical/lita-status)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add lita-status to your Lita instance's Gemfile:
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
gem "lita-status", :git => "https://github.com/visioncritical/lita-status"
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```
|
16
|
+
litabot status set STATUS_MESSAGE - Sets your status
|
17
|
+
litabot status on behalf set USER PASSWORD STATUS_MESSAGE - Allows a bot to set your status
|
18
|
+
litabot status get [USER] - Get a user's status or your own if a user is not specified
|
19
|
+
litabot statuses - Returns all statuses
|
20
|
+
litabot status remove - Removes your status
|
21
|
+
litabot status remove USER PASSWORD - Allows a bot to remove your status
|
22
|
+
litabot status password set PASSWORD - Sets a password (WARNING: stored in plain text inside Redis)
|
23
|
+
litabot status password remove - Removes your password
|
24
|
+
```
|
25
|
+
|
26
|
+
```
|
27
|
+
Some User [6:18 PM]
|
28
|
+
litabot status set Looking at Cat gifs
|
29
|
+
|
30
|
+
Litabot [6:18 PM]
|
31
|
+
Some User has a new status.
|
32
|
+
|
33
|
+
Other User [7:25 PM]
|
34
|
+
litabot statuses
|
35
|
+
|
36
|
+
Litabot [7:25 PM]
|
37
|
+
Some User: Looking at Cat gifs
|
38
|
+
```
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The MIT License (MIT)
|
43
|
+
|
44
|
+
Copyright (c) 2015 Vision Critical
|
45
|
+
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
48
|
+
in the Software without restriction, including without limitation the rights
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
51
|
+
furnished to do so, subject to the following conditions:
|
52
|
+
|
53
|
+
The above copyright notice and this permission notice shall be included in all
|
54
|
+
copies or substantial portions of the Software.
|
55
|
+
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
62
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
6
|
+
t.rspec_opts = '--color -fd spec/lita'
|
7
|
+
end
|
8
|
+
|
9
|
+
task default: :spec
|
10
|
+
|
11
|
+
# Style tests (Rubocop)
|
12
|
+
namespace :style do
|
13
|
+
desc 'Run Ruby style checks'
|
14
|
+
RuboCop::RakeTask.new :ruby
|
15
|
+
end
|
16
|
+
|
17
|
+
# Run all style tasks
|
18
|
+
desc 'Run all style checks'
|
19
|
+
task style: ['style:ruby']
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Status < Handler
|
4
|
+
include ::StatusHelper::Redis
|
5
|
+
include ::StatusHelper::Regex
|
6
|
+
include ::StatusHelper::Utility
|
7
|
+
|
8
|
+
route(
|
9
|
+
/\Astatus\sset\s#{STATUS_PATTERN}\z/,
|
10
|
+
:set,
|
11
|
+
command: true,
|
12
|
+
help: { t('help.set.syntax') => t('help.set.desc') }
|
13
|
+
)
|
14
|
+
|
15
|
+
route(
|
16
|
+
/\Astatus\son\sbehalf\sset\s#{USER_PATTERN}\s#{PASSWORD_PATTERN}\s#{STATUS_PATTERN}\z/,
|
17
|
+
:on_behalf_set,
|
18
|
+
command: true,
|
19
|
+
help: { t('help.on_behalf_set.syntax') => t('help.on_behalf_set.desc') }
|
20
|
+
)
|
21
|
+
|
22
|
+
route(
|
23
|
+
/\Astatus\sget(|\s#{USER_PATTERN})\z/,
|
24
|
+
:get,
|
25
|
+
command: true,
|
26
|
+
help: { t('help.get.syntax') => t('help.get.desc') }
|
27
|
+
)
|
28
|
+
|
29
|
+
route(
|
30
|
+
/\Astatuses\z/,
|
31
|
+
:statuses,
|
32
|
+
command: true,
|
33
|
+
help: { t('help.get_all.syntax') => t('help.get_all.desc') }
|
34
|
+
)
|
35
|
+
|
36
|
+
route(
|
37
|
+
/\Astatus\sremove\z/,
|
38
|
+
:remove,
|
39
|
+
command: true,
|
40
|
+
help: { t('help.remove.syntax') => t('help.remove.desc') }
|
41
|
+
)
|
42
|
+
|
43
|
+
route(
|
44
|
+
/\Astatus\son\sbehalf\sremove\s#{USER_PATTERN}\s#{PASSWORD_PATTERN}\z/,
|
45
|
+
:on_behalf_remove,
|
46
|
+
command: true,
|
47
|
+
help: { t('help.on_behalf_remove.syntax') => t('help.on_behalf_remove.desc') }
|
48
|
+
)
|
49
|
+
|
50
|
+
route(
|
51
|
+
/\Astatus\spassword\sset\s#{PASSWORD_PATTERN}\z/,
|
52
|
+
:password_set,
|
53
|
+
command: true,
|
54
|
+
help: { t('help.password_set.syntax') => t('help.password_set.desc') }
|
55
|
+
)
|
56
|
+
|
57
|
+
route(
|
58
|
+
/\Astatus\spassword\sremove\z/,
|
59
|
+
:password_remove,
|
60
|
+
command: true,
|
61
|
+
help: { t('help.password_remove.syntax') => t('help.password_remove.desc') }
|
62
|
+
)
|
63
|
+
|
64
|
+
def set(response, lita_user = nil)
|
65
|
+
status = response.match_data['status']
|
66
|
+
# Set user to the calling user if nil
|
67
|
+
lita_user ||= response.user
|
68
|
+
store_status lita_user, status
|
69
|
+
response.reply t('set.new', name: lita_user.name)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Allows your status to be set by bots (EX: IFTTT)
|
73
|
+
def on_behalf_set(response)
|
74
|
+
lita_user = find_user response.match_data['user']
|
75
|
+
return response.reply t('error.no_user', name: lita_user.name) if lita_user.nil?
|
76
|
+
stored_password = fetch_password lita_user
|
77
|
+
if stored_password.eql? response.match_data['password']
|
78
|
+
return set response, lita_user
|
79
|
+
end
|
80
|
+
return response.reply t('error.password_nil', action: 'set', name: lita_user.name) if stored_password.nil?
|
81
|
+
response.reply t('error.password_mistmatch', action: 'set', name: lita_user.name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def get(response)
|
85
|
+
lita_user = find_user response.match_data['user']
|
86
|
+
if lita_user.nil? && !response.match_data['user'].nil?
|
87
|
+
return response.reply t('error.no_user', name: response.match_data['user'])
|
88
|
+
end
|
89
|
+
# If lita_user is nil, we're getting our own status
|
90
|
+
lita_user ||= response.user
|
91
|
+
status = fetch_status lita_user
|
92
|
+
return response.reply t('error.no_status', name: lita_user.name) if status.nil?
|
93
|
+
response.reply t('get', name: lita_user.name, status: status)
|
94
|
+
end
|
95
|
+
|
96
|
+
def statuses(response)
|
97
|
+
ids = retrieve_keys
|
98
|
+
ids.each do |id|
|
99
|
+
lita_user = find_user id.gsub('status_', ''), :find_by_id
|
100
|
+
status = fetch_status lita_user
|
101
|
+
return response.reply t('error.no_status', name: lita_user.name) if status.nil?
|
102
|
+
response.reply t('get', name: lita_user.name, status: status)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def remove(response)
|
107
|
+
delete_status response.user
|
108
|
+
response.reply t('remove', name: response.user.name)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Allows your status to be removed by bots (EX: IFTTT)
|
112
|
+
def on_behalf_remove(response)
|
113
|
+
lita_user = find_user response.match_data['user']
|
114
|
+
return response.reply t('error.no_user', name: lita_user.name) if lita_user.nil?
|
115
|
+
stored_password = fetch_password lita_user
|
116
|
+
if stored_password.eql? response.match_data['password']
|
117
|
+
delete_status lita_user
|
118
|
+
return response.reply t('remove', name: lita_user.name)
|
119
|
+
end
|
120
|
+
return response.reply t('error.password_nil', action: 'remove', name: lita_user.name) if stored_password.nil?
|
121
|
+
response.reply t('error.password_mistmatch', action: 'remove', name: lita_user.name)
|
122
|
+
end
|
123
|
+
|
124
|
+
def password_set(response)
|
125
|
+
store_password response.user, response.match_data['password']
|
126
|
+
response.reply_privately t('password.set', name: response.user.name)
|
127
|
+
end
|
128
|
+
|
129
|
+
def password_remove(response)
|
130
|
+
remove_password response.user
|
131
|
+
response.reply_privately t('password.remove', name: response.user.name)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
Lita.register_handler Status
|
135
|
+
end
|
136
|
+
end
|
data/lib/lita-status.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'lita'
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join('..', '..', 'locales', '*.yml'), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require 'status_helper/redis'
|
8
|
+
require 'status_helper/regex'
|
9
|
+
require 'status_helper/utility'
|
10
|
+
|
11
|
+
require 'lita/handlers/status'
|
12
|
+
|
13
|
+
Lita::Handlers::Status.template_root File.expand_path(
|
14
|
+
File.join('..', '..', 'templates'),
|
15
|
+
__FILE__
|
16
|
+
)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module StatusHelper
|
2
|
+
module Redis
|
3
|
+
def store_status(user, message)
|
4
|
+
redis.hset format_status(user), 'message', message
|
5
|
+
end
|
6
|
+
|
7
|
+
def fetch_status(user)
|
8
|
+
redis.hget format_status(user), 'message'
|
9
|
+
end
|
10
|
+
|
11
|
+
def delete_status(user)
|
12
|
+
redis.hdel format_status(user), 'message'
|
13
|
+
end
|
14
|
+
|
15
|
+
def store_password(user, password)
|
16
|
+
redis.hset format_status(user), 'password', password
|
17
|
+
end
|
18
|
+
|
19
|
+
def fetch_password(user)
|
20
|
+
redis.hget format_status(user), 'password'
|
21
|
+
end
|
22
|
+
|
23
|
+
def remove_password(user)
|
24
|
+
redis.hdel format_status(user), 'password'
|
25
|
+
end
|
26
|
+
|
27
|
+
def format_status(user)
|
28
|
+
"status_#{user.id}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def retrieve_keys
|
32
|
+
redis.keys 'status_*'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module StatusHelper
|
2
|
+
module Utility
|
3
|
+
# Find Lita::User by particular method
|
4
|
+
# Returns nil if it finds nothing
|
5
|
+
def find_user(user, search_method = :find_by_mention_name)
|
6
|
+
method_obj = Lita::User.method search_method
|
7
|
+
found_user = method_obj.call user
|
8
|
+
found_user
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lita-status.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-status'
|
3
|
+
spec.version = '0.0.2'
|
4
|
+
spec.authors = ['Riley Shott']
|
5
|
+
spec.email = ['riley.shott@visioncritical.com']
|
6
|
+
spec.description = 'Allows you to store statuses with Lita'
|
7
|
+
spec.summary = 'Allows you to store statuses with Lita'
|
8
|
+
spec.homepage = 'https://github.com/visioncritical/lita-status'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.metadata = { 'lita_plugin_type' => 'handler' }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($RS)
|
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.3'
|
18
|
+
|
19
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
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 'rubocop', '>= 0.28.0'
|
25
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
en:
|
2
|
+
lita:
|
3
|
+
handlers:
|
4
|
+
status:
|
5
|
+
error:
|
6
|
+
password_nil: "Failed to %{action} status. There's no password set for %{name}."
|
7
|
+
password_mismatch: "Failed to %{action} status. Password did not match stored password for %{name}."
|
8
|
+
no_user: "Could not find a user with the name %{name}."
|
9
|
+
no_status: "%{name} has no status."
|
10
|
+
help:
|
11
|
+
set:
|
12
|
+
syntax: status set STATUS_MESSAGE
|
13
|
+
desc: Sets your status
|
14
|
+
on_behalf_set:
|
15
|
+
syntax: status on behalf set USER PASSWORD STATUS_MESSAGE
|
16
|
+
desc: Allows a bot to set your status
|
17
|
+
get:
|
18
|
+
syntax: status get [USER]
|
19
|
+
desc: Get a user's status or your own if a user is not specified
|
20
|
+
get_all:
|
21
|
+
syntax: statuses
|
22
|
+
desc: Returns all statuses
|
23
|
+
remove:
|
24
|
+
syntax: status remove
|
25
|
+
desc: Removes your status
|
26
|
+
on_behalf_remove:
|
27
|
+
syntax: status remove USER PASSWORD
|
28
|
+
desc: Allows a bot to remove your status
|
29
|
+
password_set:
|
30
|
+
syntax: status password set PASSWORD
|
31
|
+
desc: "Sets a password (WARNING: stored in plain text inside Redis)"
|
32
|
+
password_remove:
|
33
|
+
syntax: status password remove
|
34
|
+
desc: Removes your password
|
35
|
+
set:
|
36
|
+
new: "%{name} has a new status."
|
37
|
+
get: "%{name}: %{status}"
|
38
|
+
remove: "Status removed for %{name}."
|
39
|
+
password:
|
40
|
+
set: "Password successfully set for %{name}."
|
41
|
+
remove: "Password successfully removed for %{name}."
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::Status, lita_handler: true do
|
4
|
+
it { is_expected.to route_command('status set somestatus').to(:set) }
|
5
|
+
it { is_expected.to route_command('status on behalf set some.user somepassword somestatus').to(:on_behalf_set) }
|
6
|
+
it { is_expected.to route_command('status get').to(:get) }
|
7
|
+
it { is_expected.to route_command('status get some.user').to(:get) }
|
8
|
+
it { is_expected.to route_command('statuses').to(:statuses) }
|
9
|
+
it { is_expected.to route_command('status remove').to(:remove) }
|
10
|
+
it { is_expected.to route_command('status on behalf remove some.user password').to(:on_behalf_remove) }
|
11
|
+
|
12
|
+
describe 'setting a status' do
|
13
|
+
it 'should be successful' do
|
14
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes')
|
15
|
+
send_command('status set just eating my lobster', as: grimey)
|
16
|
+
expect(replies.last).to eq('Frank Grimes has a new status.')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'getting a status' do
|
21
|
+
describe 'for a user with a status' do
|
22
|
+
it 'should return their status' do
|
23
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
24
|
+
send_command('status set just eating my lobster', as: grimey)
|
25
|
+
send_command('status get grimey', as: grimey)
|
26
|
+
expect(replies.last).to eq('Frank Grimes: just eating my lobster')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'for a user without a status' do
|
31
|
+
it 'should inform they don\'t have one' do
|
32
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
33
|
+
send_command('status get grimey', as: grimey)
|
34
|
+
expect(replies.last).to eq('Frank Grimes has no status.')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'for a user that doesn\'t exist' do
|
39
|
+
it 'should inform that no user was found' do
|
40
|
+
send_command('status get grimey')
|
41
|
+
expect(replies.last).to eq('Could not find a user with the name grimey.')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'getting all statuses' do
|
47
|
+
it 'should return everything' do
|
48
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
49
|
+
homer = Lita::User.create(124, name: 'Homer Simpson', mention_name: 'homer')
|
50
|
+
burns = Lita::User.create(125, name: 'Montgomery Burns', mention_name: 'burns')
|
51
|
+
send_command('status set just eating my lobster', as: grimey)
|
52
|
+
send_command('status set peeing on the seat', as: homer)
|
53
|
+
send_command('status set releasing the hounds', as: burns)
|
54
|
+
send_command('statuses')
|
55
|
+
replies.shift(3)
|
56
|
+
expect(replies.grep(/Frank Grimes: just eating my lobster/).first).to eq('Frank Grimes: just eating my lobster')
|
57
|
+
expect(replies.grep(/Homer Simpson: peeing on the seat/).first).to eq('Homer Simpson: peeing on the seat')
|
58
|
+
expect(replies.grep(/Montgomery Burns: releasing the hounds/).first).to eq('Montgomery Burns: releasing the hounds')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'with a password' do
|
63
|
+
describe 'setting a status on behalf' do
|
64
|
+
it 'should be successful' do
|
65
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
66
|
+
send_command('status password set orphan', as: grimey)
|
67
|
+
send_command('status on behalf set grimey orphan going to space, brb', as: grimey)
|
68
|
+
expect(replies.last).to eq('Frank Grimes has a new status.')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'removing a status on behalf' do
|
73
|
+
it 'should be successful' do
|
74
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
75
|
+
send_command('status password set orphan', as: grimey)
|
76
|
+
send_command('status on behalf remove grimey orphan', as: grimey)
|
77
|
+
expect(replies.last).to eq('Status removed for Frank Grimes.')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'without a password' do
|
83
|
+
describe 'setting a status on behalf' do
|
84
|
+
it 'should fail' do
|
85
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
86
|
+
send_command('status on behalf set grimey orphan going to space, brb', as: grimey)
|
87
|
+
expect(replies.last).to eq('Failed to set status. There\'s no password set for Frank Grimes.')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe 'removing a status on behalf' do
|
92
|
+
it 'should fail' do
|
93
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
94
|
+
send_command('status on behalf remove grimey orphan', as: grimey)
|
95
|
+
expect(replies.last).to eq('Failed to remove status. There\'s no password set for Frank Grimes.')
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'setting a password' do
|
101
|
+
it 'should be successful' do
|
102
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
103
|
+
send_command('status password set orphan', as: grimey)
|
104
|
+
expect(replies.last).to eq('Password successfully set for Frank Grimes.')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'removing a password' do
|
109
|
+
it 'should be successful' do
|
110
|
+
grimey = Lita::User.create(123, name: 'Frank Grimes', mention_name: 'grimey')
|
111
|
+
send_command('status password remove', as: grimey)
|
112
|
+
expect(replies.last).to eq('Password successfully removed for Frank Grimes.')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'lita-status'
|
2
|
+
require 'lita/rspec'
|
3
|
+
|
4
|
+
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
|
5
|
+
# was generated with Lita 4, the compatibility mode should be left disabled.
|
6
|
+
Lita.version_3_compatibility_mode = false
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.before do
|
10
|
+
registry.register_handler(Lita::Handlers::Status)
|
11
|
+
end
|
12
|
+
end
|
data/templates/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Riley Shott
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-08 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.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.28.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.28.0
|
111
|
+
description: Allows you to store statuses with Lita
|
112
|
+
email:
|
113
|
+
- riley.shott@visioncritical.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rubocop.yml"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- lib/lita-status.rb
|
125
|
+
- lib/lita/handlers/status.rb
|
126
|
+
- lib/status_helper/redis.rb
|
127
|
+
- lib/status_helper/regex.rb
|
128
|
+
- lib/status_helper/utility.rb
|
129
|
+
- lita-status.gemspec
|
130
|
+
- locales/en.yml
|
131
|
+
- spec/lita/handlers/status_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- templates/.gitkeep
|
134
|
+
homepage: https://github.com/visioncritical/lita-status
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata:
|
138
|
+
lita_plugin_type: handler
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.4.6
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: Allows you to store statuses with Lita
|
159
|
+
test_files:
|
160
|
+
- spec/lita/handlers/status_spec.rb
|
161
|
+
- spec/spec_helper.rb
|