lita-die 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+
4
+ Style/Documentation:
5
+ Exclude:
6
+ - '**/version.rb'
7
+
8
+ Style/FileName:
9
+ Exclude:
10
+ - 'lib/lita-watson-irc.rb'
11
+ - 'lib/lita-watson_irc.rb'
12
+
13
+ inherit_from: .rubocop_todo.yml
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
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
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,13 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require 'rubocop/rake_task'
7
+
8
+ RuboCop::RakeTask.new
9
+
10
+ task default: :test
11
+
12
+ desc 'Runs all the tests'
13
+ task test: [:spec, :rubocop]
@@ -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,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ die:
@@ -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
@@ -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
File without changes
@@ -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