lita-server_status 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/server_status.rb +11 -6
- data/lita-server_status.gemspec +1 -1
- data/spec/lita/handlers/server_status_spec.rb +17 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa823e27040eeab4be70ce6477dca2838fb6046
|
4
|
+
data.tar.gz: 122209a480a1c0774bf8c23a8538fa3164cbe6bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0d62697d4c3fecb4c8f31fa92051dd9b0d47f4b6aff92de8e0495ba4ceb2ded8c5813954630437fb7eb415335a4404db0d3e9bbaeba4d6ceff7122b9aeb6fc2
|
7
|
+
data.tar.gz: f85fbf9e74fb9bea5b456b00a480cc7ae6060ae644ad991130e356e7a1076f4ed759355ab905f336b11cb8bacc35cdfce8c246c5fcc02e8ed785895b0eaed877
|
@@ -13,18 +13,23 @@ module Lita
|
|
13
13
|
user, application, branch, environment = message.match(MESSAGE_REGEX).captures
|
14
14
|
|
15
15
|
apply_status = { id: "#{application}:#{environment}",
|
16
|
-
message: "#{application} #{environment}: #{branch} (#{user} @ #{
|
16
|
+
message: "#{application} #{environment}: #{branch} (#{user} @ #{formatted_time})" }
|
17
17
|
|
18
18
|
redis.set("server_status:#{apply_status[:id]}", apply_status[:message])
|
19
19
|
end
|
20
20
|
|
21
21
|
def list_statuses(response)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
response.reply status_message
|
23
|
+
end
|
24
|
+
|
25
|
+
def status_message
|
26
|
+
messages = redis.keys("server_status*").map { |key| redis.get(key) }
|
27
|
+
messages << "I don't know what state the servers are in." if messages.empty?
|
28
|
+
messages.join("\n")
|
29
|
+
end
|
26
30
|
|
27
|
-
|
31
|
+
def formatted_time
|
32
|
+
Time.now.strftime("%Y-%m-%d %H:%M")
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
data/lita-server_status.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-server_status"
|
3
|
-
spec.version = "0.0.
|
3
|
+
spec.version = "0.0.2"
|
4
4
|
spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic"]
|
5
5
|
spec.email = ["michael.beuken@gmail.com", "ruben.a.estevez@gmail.com", "jorbabe@gmail.com", "mathieu.gilbert@ama.ab.ca", "ryan.michael.jones@gmail.com", "darko.dosenovic@ama.ab.ca"]
|
6
6
|
spec.description = %q{Store and list out the statuses of applications}
|
@@ -2,6 +2,12 @@ require "spec_helper"
|
|
2
2
|
require "timecop"
|
3
3
|
|
4
4
|
describe Lita::Handlers::ServerStatus, lita_handler: true do
|
5
|
+
let(:formatted_local_time) { Time.now.strftime("%Y-%m-%d %H:%M") }
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
allow_any_instance_of(Lita::Handlers::ServerStatus).to receive(:formatted_time).and_return(formatted_local_time)
|
9
|
+
end
|
10
|
+
|
5
11
|
it { routes("Waffle McRib is starting deploy of 'APPNAME' from branch 'MASTER' to PRODUCTION").to(:save_status) }
|
6
12
|
it { routes_command("server status").to(:list_statuses) }
|
7
13
|
|
@@ -11,24 +17,29 @@ describe Lita::Handlers::ServerStatus, lita_handler: true do
|
|
11
17
|
end
|
12
18
|
|
13
19
|
it "update the server status if it changes" do
|
14
|
-
Timecop.freeze do
|
20
|
+
Timecop.freeze(Time.now) do
|
15
21
|
send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
|
16
22
|
send_command("server status")
|
17
|
-
expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{
|
23
|
+
expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
|
18
24
|
|
19
25
|
send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'WAFFLE' to PRODUCTION})
|
20
26
|
send_command("server status")
|
21
|
-
expect(replies.last).to include("FAKEAPP PRODUCTION: WAFFLE (Waffle McRib @ #{
|
27
|
+
expect(replies.last).to include("FAKEAPP PRODUCTION: WAFFLE (Waffle McRib @ #{formatted_local_time})")
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
25
31
|
it "should list the current server statuses" do
|
26
|
-
Timecop.freeze do
|
32
|
+
Timecop.freeze(Time.now) do
|
27
33
|
send_message(%{Waffle McRib is starting deploy of 'FAKEAPP' from branch 'MASTER' to PRODUCTION})
|
28
34
|
send_message(%{Waffle McRib is starting deploy of 'BATMAN' from branch 'AWESOME' to STAGING})
|
29
35
|
send_command("server status")
|
30
|
-
expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{
|
31
|
-
expect(replies.last).to include("BATMAN STAGING: AWESOME (Waffle McRib @ #{
|
36
|
+
expect(replies.last).to include("FAKEAPP PRODUCTION: MASTER (Waffle McRib @ #{formatted_local_time})")
|
37
|
+
expect(replies.last).to include("BATMAN STAGING: AWESOME (Waffle McRib @ #{formatted_local_time})")
|
32
38
|
end
|
33
39
|
end
|
40
|
+
|
41
|
+
it "admits when there are no statuses" do
|
42
|
+
send_command("server status")
|
43
|
+
expect(replies.last).to eq("I don't know what state the servers are in.")
|
44
|
+
end
|
34
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-server_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-
|
16
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: lita
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.4.1
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Store and list out the statuses of applications
|