lita-debug-queue 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +10 -0
- data/README.md +12 -6
- data/lib/lita/handlers/debug_queue.rb +12 -4
- data/lita-debug-queue.gemspec +1 -1
- data/spec/lita/handlers/help_queue_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13062639eb8ef466d93d44bc1421d2d8a6643cd5
|
4
|
+
data.tar.gz: 3349600d80156d2c2df971fc0c61b8bd32ed18a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f8d5c8fe8c84d6d18e3e15e135358e23238bf350e6e3f78471e30b1046500c18d8a97dc80e3b32262c7f0c6d8f5702bd3721b6bfbb24abd67243199ad7030b
|
7
|
+
data.tar.gz: 2c15f5ced824dc95a2d0e246422ba3118ce7f848b3170a980d3ace919afd27d1b8ea098a62a1d60221d0ec9a25b5459fc68532f5c003e554d9e04ba8c79bfb3a
|
data/NEWS.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## News
|
2
2
|
|
3
|
+
### 0.2.0 (2015-10-18)
|
4
|
+
|
5
|
+
* Restrict users adding themselves to the queue
|
6
|
+
to hours defined by weekeday in the configuration.
|
7
|
+
|
8
|
+
A `config.schedule` hash must be present in your
|
9
|
+
config file, mapping `strftime("%a")` keys to hour ranges.
|
10
|
+
|
11
|
+
* Relax routing requirements on instructor commands.
|
12
|
+
|
3
13
|
### 0.1.9 (2015-10-08)
|
4
14
|
|
5
15
|
* Relax some of the routing requirements and fix the tests.
|
data/README.md
CHANGED
@@ -15,16 +15,21 @@ gem "lita-debug-queue"
|
|
15
15
|
|
16
16
|
## Configuration
|
17
17
|
|
18
|
-
lita-debug-queue expects
|
18
|
+
lita-debug-queue expects three things to be present for correct operation:
|
19
19
|
|
20
20
|
1. An `:instructors` authorization group containing admin users.
|
21
|
-
|
22
|
-
|
23
|
-
2. A `classrooms` config option containing a Hash that maps instructor mention names to classroom channels.
|
21
|
+
If you want TAs to also be able to modify (but not clear) the
|
22
|
+
queue you should add them to an `:assistants` group.
|
24
23
|
|
25
|
-
|
24
|
+
2. A `classrooms` config option containing a Hash that maps instructor mention nam es to classroom channels.
|
25
|
+
|
26
|
+
3. A `schedule` config option containing a Hash that maps from days of the week
|
27
|
+
(as from `DateTime.now.strftime("%a")`), to ranges of hours in the
|
28
|
+
[server's time zone][heroku-tz].
|
26
29
|
|
27
|
-
|
30
|
+
[heroku-tz]: http://blog.pardner.com/2012/08/setting-the-default-time-zone-for-a-heroku-app/
|
31
|
+
|
32
|
+
## Usage
|
28
33
|
|
29
34
|
### General Commands
|
30
35
|
|
@@ -34,6 +39,7 @@ All usage is based on commands so statements must be directed `@ironbot: foo` or
|
|
34
39
|
* `debug count` - Count the number of people waiting for help.
|
35
40
|
|
36
41
|
### Instructor Commands
|
42
|
+
|
37
43
|
* `debug next` - Notify the next student to be helped.
|
38
44
|
* `debug drop NAME` - Remove the student with NAME from the queue.
|
39
45
|
* `debug clear` - Empty the queue.
|
@@ -4,6 +4,7 @@ module Lita
|
|
4
4
|
extend Lita::Handler::ChatRouter
|
5
5
|
|
6
6
|
config :classrooms # A mapping from instructor names to classroom channels.
|
7
|
+
config :schedule # A mapping from weekdays to available instructor hours.
|
7
8
|
|
8
9
|
route(/debug me/, :add,
|
9
10
|
help: { 'debug me' => 'Put your name in the queue for debugging help.' })
|
@@ -13,20 +14,22 @@ module Lita
|
|
13
14
|
help: { 'debug queue' => 'Show the current queue for your class.' })
|
14
15
|
route(/debug count/i, :count,
|
15
16
|
help: { 'debug count' => 'Count the number of people waiting for help.' })
|
16
|
-
route(
|
17
|
+
route(/debug next/, :next,
|
17
18
|
restrict_to: [:instructors, :assistants],
|
18
19
|
help: { 'debug next' => 'Notify the next student to be helped.' })
|
19
|
-
route(
|
20
|
+
route(/debug drop\s+(.+)/, :drop,
|
20
21
|
restrict_to: [:instructors, :assistants],
|
21
22
|
help: { 'debug drop NAME' => 'Remove the student with NAME from the queue.' })
|
22
|
-
route(/^debug clear$/, :clear,
|
23
|
+
route(/^debug clear$/, :clear,
|
23
24
|
restrict_to: [:instructors],
|
24
25
|
help: { 'debug clear' => 'Empty the queue.' })
|
25
26
|
|
26
27
|
def add(response)
|
27
28
|
return unless check_room!(response)
|
28
29
|
student = response.user.mention_name
|
29
|
-
if
|
30
|
+
if closed?(DateTime.now)
|
31
|
+
response.reply("#{student}: Sorry, the queue is closed for the day.")
|
32
|
+
elsif @room.include?(student)
|
30
33
|
response.reply("#{student}: Easy there killer. You're already on the list.")
|
31
34
|
else
|
32
35
|
@room.add(student)
|
@@ -95,6 +98,11 @@ module Lita
|
|
95
98
|
def target_for(name)
|
96
99
|
Lita::Source.new(user: Lita::User.find_by_mention_name(name))
|
97
100
|
end
|
101
|
+
|
102
|
+
def closed?(now)
|
103
|
+
hours = config.schedule[now.strftime("%a")]
|
104
|
+
hours && !hours.include?(now.hour)
|
105
|
+
end
|
98
106
|
end
|
99
107
|
|
100
108
|
Lita.register_handler(DebugQueue)
|
data/lita-debug-queue.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-debug-queue"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.2.0"
|
4
4
|
spec.authors = ["Brit Butler"]
|
5
5
|
spec.email = ["brit@kingcons.io"]
|
6
6
|
spec.description = "Queue tracking of users who need debugging help with per-channel management"
|
@@ -10,6 +10,7 @@ describe Lita::Handlers::DebugQueue, lita_handler: true do
|
|
10
10
|
allow(Lita::Handlers::RoomFinder).to receive(:get_room_name) do |room|
|
11
11
|
room.name
|
12
12
|
end
|
13
|
+
allow_any_instance_of(Lita::Handlers::DebugQueue).to receive(:closed?) { false }
|
13
14
|
registry.config.handlers.debug_queue.classrooms = {
|
14
15
|
'brit' => 'rails'
|
15
16
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-debug-queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brit Butler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|