lita-pullrequests 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2eeaab6bd4a825ee5ce6018fb4c2de5b7e1d514
4
- data.tar.gz: da7813b33b98caa2b6b51dd03f79de499d92f2df
3
+ metadata.gz: 67a9de81353aaec844771cb2829ec714ba015481
4
+ data.tar.gz: 5814f6cc0ba4a548413daae6b5b4821de48fd1ed
5
5
  SHA512:
6
- metadata.gz: 19bc54da7c1049c1f770ad2ae62a2b6cff3e6ff67ef88ca3a8e5441ca76c0fcc707d63e2973a3a7890a7d541c7765873b4196039621eedfd4e6bcadcfe5a25bc
7
- data.tar.gz: b146587dfa273e7b887b0aa98b456eb890f7835f5e33e69084bb6819a611afcef17f4b93263ab38230f1e601d653f799aef0a83ee6efa711ccd37dbbe5c07c0c
6
+ metadata.gz: 856690826d022b56ec598672446823095c833c2c9b0de161b8b1c4cf92e07bd84b9764a69fba8c4b8b90e71473927edb61b00ec1f32d306a7d6947530e81cd27
7
+ data.tar.gz: 86e57efa9b4303bc6f6e3e200b715ce739bdad36d3d96ad58c114ba555e3d19023199b8be07432dd533ae093acf3e3babbfc631aec0ff82df42a9ca22d02ae7f
@@ -22,8 +22,16 @@ module Lita
22
22
  "(summarize|all) pull requests" => "Lists all pull requests that need action."
23
23
  })
24
24
 
25
- route(/^set pull requests reminder for (.*)$/, :set_reminder, command: true, help: {
26
- "set pull requests reminder for CRON EXPRESSION" => "Sets a cron task that will trigger a pr summary."
25
+ route(/^set pull request(s)? reminder for (.*)$/, :set_reminder, command: true, help: {
26
+ "set pull request(s)? reminder for CRON EXPRESSION" => "Sets a cron task that will trigger a pr summary."
27
+ })
28
+
29
+ route(/^stop reminding me about pull requests$/, :remove_reminder, command: true, help: {
30
+ "stop reminding me about pull requests" => "Shows you info about your next pull request reminder."
31
+ })
32
+
33
+ route(/^show pull request(s)? reminder$/, :show_reminder, command: true, help: {
34
+ "show pull request(s) reminder" => "Shows you info about your next pull request reminder."
27
35
  })
28
36
 
29
37
  def remember_reminder(payload)
@@ -99,7 +107,7 @@ module Lita
99
107
  end
100
108
 
101
109
  def set_reminder(chat)
102
- input = chat.matches[0][0].split(" ")
110
+ input = chat.matches[0][1].split(" ")
103
111
  cron_expression = input[0..4].join(" ")
104
112
  job = SCHEDULER.cron cron_expression do |job|
105
113
  list_all_pull_requests(chat)
@@ -114,6 +122,28 @@ module Lita
114
122
 
115
123
  chat.reply("I will post a pull request summary according to this cron: #{cron_expression}")
116
124
  end
125
+
126
+ def show_reminder(chat)
127
+ reminder = redis.hgetall(REDIS_KEY)["reminder-info"]
128
+ if reminder
129
+ info = MultiJson.load(reminder)
130
+ chat.reply "I will remind you in channel #{info["room"]} at #{info["cron_expression"]}"
131
+ else
132
+ chat.reply "Your reminder is not set."
133
+ end
134
+ end
135
+
136
+ def remove_reminder(chat)
137
+ reminder = redis.hgetall(REDIS_KEY)["reminder-info"]
138
+ if reminder
139
+ info = MultiJson.load(reminder)
140
+ SCHEDULER.unschedule(info["j_id"])
141
+ redis.hdel(REDIS_KEY, "reminder-info")
142
+ chat.reply "okay, I turned off your reminder."
143
+ else
144
+ chat.reply "Your reminder is not set."
145
+ end
146
+ end
117
147
  end
118
148
 
119
149
  Lita.register_handler(Pullrequests)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-pullrequests"
3
- spec.version = "0.0.4"
3
+ spec.version = "0.0.5"
4
4
  spec.authors = ["Taylor Lapeyre"]
5
5
  spec.email = ["taylorlapeyre@gmail.com"]
6
6
  spec.description = %q{A Lita handler to help you keep track of your pull requests.}
@@ -14,6 +14,10 @@ describe Lita::Handlers::Pullrequests, lita_handler: true do
14
14
  it { is_expected.to route_command("all pull requests").to(:list_all_pull_requests) }
15
15
  it { is_expected.to route_command("summarize pull requests").to(:list_all_pull_requests) }
16
16
  it { is_expected.to route_command("set pull requests reminder for 0 20 * * 1-5").to(:set_reminder) }
17
+ it { is_expected.to route_command("set pull request reminder for 0 20 * * 1-5").to(:set_reminder) }
18
+ it { is_expected.to route_command("stop reminding me about pull requests").to(:remove_reminder) }
19
+ it { is_expected.to route_command("show pull requests reminder").to(:show_reminder) }
20
+ it { is_expected.to route_command("show pull request reminder").to(:show_reminder) }
17
21
 
18
22
  it { is_expected.to_not route_command("all pull requests").to(:get_random_pr) }
19
23
 
@@ -34,4 +38,18 @@ describe Lita::Handlers::Pullrequests, lita_handler: true do
34
38
  send_command("set pull requests reminder for 0 20 * * 1-5")
35
39
  expect(replies.last).to match /0 20 \* \* 1\-5/
36
40
  end
41
+
42
+ it "can stop reminding you" do
43
+ send_command("set pull requests reminder for 0 20 * * 1-5")
44
+ expect(replies.last).to match /0 20 \* \* 1\-5/
45
+ send_command("stop reminding me about pull requests")
46
+ expect(replies.last).to eq "okay, I turned off your reminder."
47
+ end
48
+
49
+ it "can tell you when it will remind you next" do
50
+ send_command("set pull requests reminder for 0 20 * * 1-5")
51
+ expect(replies.last).to match /0 20 \* \* 1\-5/
52
+ send_command("show pull requests reminder")
53
+ expect(replies.last).to match /I will remind you/
54
+ end
37
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-pullrequests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Lapeyre