lita-die 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +11 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +27 -0
- data/Rakefile +13 -0
- data/lib/lita/handlers/die.rb +19 -0
- data/lib/lita-die.rb +12 -0
- data/lita-die.gemspec +27 -0
- data/locales/en.yml +4 -0
- data/spec/lita/handlers/die_spec.rb +41 -0
- data/spec/spec_helper.rb +14 -0
- data/templates/.gitkeep +0 -0
- data/templates/dies.erb +1 -0
- data/templates/dies.irc.erb +1 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 29f5694da60dd7b212505aa1281b80fb974324f2
|
4
|
+
data.tar.gz: 80f73c8f898da88270755461468f2e77f1cebd85
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2001fa2172ec65db25dd62e8dbe4c777ab7a9347fc50ef89dfa4e941cdf9b0283b55a8a566b3546a6c5b1737713832bd85f169d3d4250dfcfce3924ea9215335
|
7
|
+
data.tar.gz: 069c521bf807310a688abbdcedff36f2cd445f12b4fc76bf1e07b0cfc1b76df4193d41f6fad4ea988c8f245660353408754e0e55d4ccf35426f85d9c294ba693
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-06-19 15:39:52 -0400 using RuboCop version 0.32.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
# Configuration parameters: Exclude.
|
10
|
+
Style/FileName:
|
11
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Christian Höltje http://docwhat.org/
|
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,27 @@
|
|
1
|
+
# lita-die
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/docwhat/lita-die.png?branch=master)](https://travis-ci.org/docwhat/lita-die)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/docwhat/lita-die/badge.png)](https://coveralls.io/r/docwhat/lita-die)
|
5
|
+
|
6
|
+
Adds a `die` command to Lita so you can force it to die or restart. Useful if
|
7
|
+
you run your lita bot under something like [runit](http://smarden.org/runit/).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add lita-die to your Lita instance's Gemfile:
|
12
|
+
|
13
|
+
``` ruby
|
14
|
+
gem "lita-die"
|
15
|
+
```
|
16
|
+
|
17
|
+
## Configuration
|
18
|
+
|
19
|
+
None. Only admin users can call `die`.
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Tell your bot to die:
|
24
|
+
|
25
|
+
```
|
26
|
+
lita die
|
27
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Lita
|
2
|
+
#
|
3
|
+
module Handlers
|
4
|
+
# Die handler
|
5
|
+
class Die < Handler
|
6
|
+
route(
|
7
|
+
/^die$/, :die,
|
8
|
+
command: true, restrict_to: :admins,
|
9
|
+
help: 'dies.')
|
10
|
+
|
11
|
+
def die(response)
|
12
|
+
response.reply(render_template('dies'))
|
13
|
+
robot.shut_down
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Lita.register_handler(Die)
|
18
|
+
end
|
19
|
+
end
|
data/lib/lita-die.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/die'
|
8
|
+
|
9
|
+
Lita::Handlers::Die.template_root File.expand_path(
|
10
|
+
File.join('..', '..', 'templates'),
|
11
|
+
__FILE__
|
12
|
+
)
|
data/lita-die.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-die'
|
3
|
+
spec.version = '1.0.0'
|
4
|
+
spec.authors = ['Christian Höltje']
|
5
|
+
spec.email = ['choltje@us.ibm.com']
|
6
|
+
spec.description = "Adds 'die' command"
|
7
|
+
spec.summary = "Adds a 'die' command accessable only by admins."
|
8
|
+
spec.homepage = 'https://github.com/docwhat/lita-die'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.metadata = { 'lita_plugin_type' => 'handler' }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
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.4'
|
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 'simplecov'
|
25
|
+
spec.add_development_dependency 'coveralls'
|
26
|
+
spec.add_development_dependency 'rubocop'
|
27
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::Die, lita_handler: true do
|
4
|
+
before do
|
5
|
+
allow(robot).to receive(:shut_down)
|
6
|
+
end
|
7
|
+
|
8
|
+
context 'with an admin user' do
|
9
|
+
before do
|
10
|
+
allow(robot.auth).to receive(:user_is_admin?).with(user).and_return(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'dies' do
|
14
|
+
expect(robot).to receive(:shut_down)
|
15
|
+
send_command('die')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sobs' do
|
19
|
+
send_command('die')
|
20
|
+
expect(replies.last).to match(/cries/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with a non-admin user' do
|
25
|
+
it "doesn't die" do
|
26
|
+
expect(robot).not_to receive(:shut_down)
|
27
|
+
send_command('die')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'says nothing' do
|
31
|
+
send_command('die')
|
32
|
+
expect(replies).to be_empty
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'routes' do
|
37
|
+
it { is_expected.to route_command('die').with_authorization_for(:admins).to(:die) }
|
38
|
+
it { is_expected.not_to route_command('die').with_authorization_for(:other) }
|
39
|
+
it { is_expected.not_to route_command('die') }
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
]
|
7
|
+
SimpleCov.start { add_filter '/spec/' }
|
8
|
+
|
9
|
+
require 'lita-die'
|
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
|
data/templates/dies.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
**cries**
|
@@ -0,0 +1 @@
|
|
1
|
+
/me sobs and runs from the room.
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-die
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christian Höltje
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-19 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.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.4'
|
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: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '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'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Adds 'die' command
|
140
|
+
email:
|
141
|
+
- choltje@us.ibm.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".rubocop.yml"
|
149
|
+
- ".rubocop_todo.yml"
|
150
|
+
- ".travis.yml"
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- lib/lita-die.rb
|
156
|
+
- lib/lita/handlers/die.rb
|
157
|
+
- lita-die.gemspec
|
158
|
+
- locales/en.yml
|
159
|
+
- spec/lita/handlers/die_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
- templates/.gitkeep
|
162
|
+
- templates/dies.erb
|
163
|
+
- templates/dies.irc.erb
|
164
|
+
homepage: https://github.com/docwhat/lita-die
|
165
|
+
licenses:
|
166
|
+
- MIT
|
167
|
+
metadata:
|
168
|
+
lita_plugin_type: handler
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.4.8
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: Adds a 'die' command accessable only by admins.
|
189
|
+
test_files:
|
190
|
+
- spec/lita/handlers/die_spec.rb
|
191
|
+
- spec/spec_helper.rb
|